From 76d413a2ecfa98c36c8396a43164a5173c0a72e9 Mon Sep 17 00:00:00 2001 From: sixsage Date: Sat, 21 Sep 2024 05:01:11 -0700 Subject: [PATCH 1/5] add zoom in and zoom out buttons on mini map --- .../mini-map/mini-map.component.html | 50 +++++++++++++------ .../mini-map/mini-map.component.scss | 16 +++++- .../mini-map/mini-map.component.ts | 36 +++++++++++++ 3 files changed, 86 insertions(+), 16 deletions(-) diff --git a/core/gui/src/app/workspace/component/workflow-editor/mini-map/mini-map.component.html b/core/gui/src/app/workspace/component/workflow-editor/mini-map/mini-map.component.html index 08168a34367..e2e78df8077 100644 --- a/core/gui/src/app/workspace/component/workflow-editor/mini-map/mini-map.component.html +++ b/core/gui/src/app/workspace/component/workflow-editor/mini-map/mini-map.component.html @@ -1,19 +1,39 @@ - - -
-
-
+ + + +
+
+
+
+
diff --git a/core/gui/src/app/workspace/component/workflow-editor/mini-map/mini-map.component.scss b/core/gui/src/app/workspace/component/workflow-editor/mini-map/mini-map.component.scss index 5a9b0b26458..d5f536ec9d2 100644 --- a/core/gui/src/app/workspace/component/workflow-editor/mini-map/mini-map.component.scss +++ b/core/gui/src/app/workspace/component/workflow-editor/mini-map/mini-map.component.scss @@ -1,10 +1,24 @@ #minimap-button { - position: fixed; + position: absolute; bottom: 0; right: 0; z-index: 4; } +#minimap-zoom-out-button{ + position: absolute; + bottom: 0; + right: 30px; + z-index: 4; +} + +#minimap-zoom-in-button{ + position: absolute; + bottom: 0; + right: 60px; + z-index: 4; +} + #mini-map { height: 200px; width: 300px; diff --git a/core/gui/src/app/workspace/component/workflow-editor/mini-map/mini-map.component.ts b/core/gui/src/app/workspace/component/workflow-editor/mini-map/mini-map.component.ts index 8de83d9b254..5e33530d0c8 100644 --- a/core/gui/src/app/workspace/component/workflow-editor/mini-map/mini-map.component.ts +++ b/core/gui/src/app/workspace/component/workflow-editor/mini-map/mini-map.component.ts @@ -3,6 +3,7 @@ import { UntilDestroy, untilDestroyed } from "@ngneat/until-destroy"; import { WorkflowActionService } from "../../../service/workflow-graph/model/workflow-action.service"; import { MAIN_CANVAS } from "../workflow-editor.component"; import * as joint from "jointjs"; +import {JointGraphWrapper} from "../../../service/workflow-graph/model/joint-graph-wrapper"; @UntilDestroy() @Component({ @@ -68,4 +69,39 @@ export class MiniMapComponent implements AfterViewInit, OnDestroy { navigator.style.height = (editor.offsetHeight / this.paper.scale().sy) * this.scale + "px"; } } + + public onClickZoomOut(): void { + // if zoom is already at minimum, don't zoom out again. + if (this.workflowActionService.getJointGraphWrapper().isZoomRatioMin()) { + return; + } + + // make the ratio small. + this.workflowActionService + .getJointGraphWrapper() + .setZoomProperty( + this.workflowActionService.getJointGraphWrapper().getZoomRatio() - JointGraphWrapper.ZOOM_CLICK_DIFF + ); + } + + /** + * This method will increase the zoom ratio and send the new zoom ratio value + * to the joint graph wrapper to change overall zoom ratio that is used in + * zoom buttons and mouse wheel zoom. + * + * If the zoom ratio already reaches maximum, this method will not do anything. + */ + public onClickZoomIn(): void { + // if zoom is already reach maximum, don't zoom in again. + if (this.workflowActionService.getJointGraphWrapper().isZoomRatioMax()) { + return; + } + + // make the ratio big. + this.workflowActionService + .getJointGraphWrapper() + .setZoomProperty( + this.workflowActionService.getJointGraphWrapper().getZoomRatio() + JointGraphWrapper.ZOOM_CLICK_DIFF + ); + } } From 818fc7167c485c2267b771233dfcf1f862ce7f95 Mon Sep 17 00:00:00 2001 From: sixsage Date: Mon, 23 Sep 2024 23:13:19 -0700 Subject: [PATCH 2/5] remove zoom in and out buttons from menu --- .../component/menu/menu.component.html | 16 ----- .../component/menu/menu.component.ts | 58 ------------------- 2 files changed, 74 deletions(-) diff --git a/core/gui/src/app/workspace/component/menu/menu.component.html b/core/gui/src/app/workspace/component/menu/menu.component.html index 861f3c909f5..52a3fb739c2 100644 --- a/core/gui/src/app/workspace/component/menu/menu.component.html +++ b/core/gui/src/app/workspace/component/menu/menu.component.html @@ -138,22 +138,6 @@ nz-icon nzType="border-outer"> - -