From c43faeb06a52f9ed17380b2b9f5ff9401002c494 Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Mon, 5 Dec 2022 20:35:25 -0800 Subject: [PATCH] Fix zoom load on maps. --- packages/editor/src/components/index.tsx | 2 ++ packages/mindplot/src/components/MindplotWebComponent.ts | 4 +++- .../src/components/editor-page/EditorOptionsBuilder.ts | 5 +---- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/editor/src/components/index.tsx b/packages/editor/src/components/index.tsx index de7c6bfc..d1819300 100644 --- a/packages/editor/src/components/index.tsx +++ b/packages/editor/src/components/index.tsx @@ -47,6 +47,7 @@ import { SpinnerCentered } from './style'; export type EditorOptions = { mode: EditorRenderMode; locale: string; + zoom: number; enableKeyboardEvents: boolean; }; @@ -140,6 +141,7 @@ const Editor = ({ id="mindmap-comp" mode={options.mode} locale={options.locale} + zoom={options.zoom} /> diff --git a/packages/mindplot/src/components/MindplotWebComponent.ts b/packages/mindplot/src/components/MindplotWebComponent.ts index 969c8a71..08360481 100644 --- a/packages/mindplot/src/components/MindplotWebComponent.ts +++ b/packages/mindplot/src/components/MindplotWebComponent.ts @@ -15,6 +15,7 @@ export type MindplotWebComponentInterface = { mode: string; ref: object; locale?: string; + zoom?: number; }; /** * WebComponent implementation for minplot designer. @@ -60,6 +61,7 @@ class MindplotWebComponent extends HTMLElement { buildDesigner(persistence?: PersistenceManager, widgetManager?: WidgetManager) { const editorRenderMode = this.getAttribute('mode') as EditorRenderMode; const locale = this.getAttribute('locale'); + const zoom = this.getAttribute('zoom'); const persistenceManager = persistence || new LocalStorageManager('map.xml', false, false); const mode = editorRenderMode || 'viewonly'; @@ -69,7 +71,7 @@ class MindplotWebComponent extends HTMLElement { widgetManager, divContainer: this._shadowRoot.getElementById('mindplot'), container: 'mindplot', - zoom: 1, + zoom: zoom ? Number.parseFloat(zoom) : 1, locale: locale || 'en', }); this._designer = buildDesigner(options); diff --git a/packages/webapp/src/components/editor-page/EditorOptionsBuilder.ts b/packages/webapp/src/components/editor-page/EditorOptionsBuilder.ts index ae378e49..37b93472 100644 --- a/packages/webapp/src/components/editor-page/EditorOptionsBuilder.ts +++ b/packages/webapp/src/components/editor-page/EditorOptionsBuilder.ts @@ -12,10 +12,7 @@ class EditorOptionsBuilder { if (!AppConfig.isDevelopEnv()) { options = { - zoom: - globalThis.userOptions?.zoom != undefined - ? Number.parseFloat(globalThis?.userOptions?.zoom as string) - : 0.8, + zoom: globalThis.userOptions?.zoom ? globalThis?.userOptions?.zoom : 0.8, locked: globalThis.mindmapLocked, lockedMsg: globalThis.mindmapLockedMsg, mapTitle: globalThis.mapTitle,