From 1f51759048a4e685a927166597ab267213f8ed9d Mon Sep 17 00:00:00 2001
From: itdominator <1itdominator@gmail.com>
Date: Mon, 30 Jun 2025 20:01:00 -0500
Subject: [PATCH] Wiring in majority of minimap-view
---
.../common/services/editor/editors.service.ts | 26 ++++++++++++++++---
src/app/editor/code-view/view.base.ts | 19 ++++++++++++--
src/app/editor/code-view/view.component.ts | 24 ++++++++++-------
src/app/editor/editors.component.html | 1 +
src/app/editor/editors.component.ts | 6 +++++
src/assets/css/styles.css | 4 +++
6 files changed, 64 insertions(+), 16 deletions(-)
diff --git a/src/app/common/services/editor/editors.service.ts b/src/app/common/services/editor/editors.service.ts
index 2008385..ed45e0a 100644
--- a/src/app/common/services/editor/editors.service.ts
+++ b/src/app/common/services/editor/editors.service.ts
@@ -20,6 +20,7 @@ export class EditorsService {
editorSettings: typeof EditorSettings;
activeEditor!: string;
+ miniMapView!: CodeViewComponent;
constructor() {
@@ -37,6 +38,11 @@ export class EditorsService {
}
public set(uuid: string, component: CodeViewComponent) {
+ if (component.isMiniMap) {
+ this.miniMapView = component;
+ return;
+ }
+
this.editors.set(uuid, component);
if (Object.keys(this.editors).length < 1) return;
@@ -60,11 +66,14 @@ export class EditorsService {
public async setSession(file: NewtonFile | undefined | null) {
if ( !file ) return;
- let editorComponent = this.getActiveEditorComponent();
- let editor = editorComponent.editor;
+ let editorComponent = this.getActiveEditorComponent();
+ let editor = editorComponent.editor;
+
+ editorComponent.activeFile = file;
+ this.miniMapView.activeFile = file;
- editorComponent.activeFile = file;
editor.setSession(file.session);
+ this.miniMapView.editor.setSession(file.session);
}
public getSession() {
@@ -75,13 +84,22 @@ export class EditorsService {
}
public setActiveEditor(activeEditor: string) {
- this.activeEditor = activeEditor;
+ this.activeEditor = activeEditor;
+ let editorComponent = this.getActiveEditorComponent();
+ this.miniMapView.activeFile = editorComponent.editor.activeFile;
+
+ this.miniMapView.editor.setSession(editorComponent.editor.getSession());
}
public getActiveEditorComponent(): any {
return this.get(this.activeEditor);
}
+ public clearminiMapView() {
+ this.miniMapView.newSession();
+ this.miniMapView.activeFile = null;
+ }
+
protected getActiveEditor(): any {
let editorComponent = this.get(this.activeEditor);
let editor = editorComponent.editor;
diff --git a/src/app/editor/code-view/view.base.ts b/src/app/editor/code-view/view.base.ts
index b570cf6..278c456 100644
--- a/src/app/editor/code-view/view.base.ts
+++ b/src/app/editor/code-view/view.base.ts
@@ -18,6 +18,7 @@ import { ServiceMessage } from '../../common/types/service-message.type';
export class CodeViewBase {
public uuid: string = uuid.v4();
@Input() public isDefault: boolean = false;
+ @Input() public isMiniMap: boolean = false;
public leftSiblingUUID!: string;
public rightSiblingUUID!: string;
@@ -150,16 +151,30 @@ export class CodeViewBase {
window.main.toggleFullScreen();
}
+ public setAsMiniMapView() {
+ this.editor.renderer.showLineNumbers = false;
+ this.editor.renderer.setShowGutter(false);
+
+ this.editor.setReadOnly(true);
+ this.editor.setFontSize(2);
+ this.editor.setHighlightActiveLine(false);
+ this.editor.setHighlightGutterLine(false);
+ this.editor.setShowFoldWidgets(false);
+ this.editor.setShowPrintMargin(false);
+ this.editorElm.nativeElement.parentElement.classList.add("col-1");
+ this.editorElm.nativeElement.parentElement.classList.add("zero-margin-padding");
+ }
+
public zoomIn() {
this.editor.setFontSize(
parseInt(this.editor.getFontSize()) + 1
- )
+ );
}
public zoomOut() {
this.editor.setFontSize(
parseInt(this.editor.getFontSize()) - 1
- )
+ );
}
public movelinesUp() {
diff --git a/src/app/editor/code-view/view.component.ts b/src/app/editor/code-view/view.component.ts
index ac30195..cc9d634 100644
--- a/src/app/editor/code-view/view.component.ts
+++ b/src/app/editor/code-view/view.component.ts
@@ -26,7 +26,7 @@ import { ServiceMessage } from '../../common/types/service-message.type';
templateUrl: './view.component.html',
styleUrl: './view.component.css',
host: {
- 'class': 'col'
+ 'class': 'col zero-margin-padding'
}
})
export class CodeViewComponent extends CodeViewBase {
@@ -34,24 +34,28 @@ export class CodeViewComponent extends CodeViewBase {
constructor() {
super();
-
- this.editorsService.set(this.uuid, this);
}
private ngAfterViewInit(): void {
+ this.loadAce();
+ }
+
+ private loadAce(): void {
+ this.editorsService.set(this.uuid, this);
+
+ this.configAceAndBindToElement()
+ this.loadAceKeyBindings();
+ this.loadAceEventBindings();
+
if (this.isDefault) {
this.editorsService.setActiveEditor(this.uuid);
this.addActiveStyling();
}
- this.loadAce();
- }
-
- private loadAce(): void {
- this.configAceAndBindToElement()
- this.loadAceKeyBindings();
- this.loadAceEventBindings();
+ if (this.isMiniMap) {
+ this.setAsMiniMapView();
+ }
}
private configAceAndBindToElement(): void {
diff --git a/src/app/editor/editors.component.html b/src/app/editor/editors.component.html
index e05f8aa..c4e7150 100644
--- a/src/app/editor/editors.component.html
+++ b/src/app/editor/editors.component.html
@@ -4,6 +4,7 @@