Fix zoom load on maps.

This commit is contained in:
Paulo Gustavo Veiga 2022-12-05 20:35:25 -08:00
parent 0246851f41
commit c43faeb06a
3 changed files with 6 additions and 5 deletions

View File

@ -47,6 +47,7 @@ import { SpinnerCentered } from './style';
export type EditorOptions = { export type EditorOptions = {
mode: EditorRenderMode; mode: EditorRenderMode;
locale: string; locale: string;
zoom: number;
enableKeyboardEvents: boolean; enableKeyboardEvents: boolean;
}; };
@ -140,6 +141,7 @@ const Editor = ({
id="mindmap-comp" id="mindmap-comp"
mode={options.mode} mode={options.mode}
locale={options.locale} locale={options.locale}
zoom={options.zoom}
/> />
<Notifier id="headerNotifier" /> <Notifier id="headerNotifier" />

View File

@ -15,6 +15,7 @@ export type MindplotWebComponentInterface = {
mode: string; mode: string;
ref: object; ref: object;
locale?: string; locale?: string;
zoom?: number;
}; };
/** /**
* WebComponent implementation for minplot designer. * WebComponent implementation for minplot designer.
@ -60,6 +61,7 @@ class MindplotWebComponent extends HTMLElement {
buildDesigner(persistence?: PersistenceManager, widgetManager?: WidgetManager) { buildDesigner(persistence?: PersistenceManager, widgetManager?: WidgetManager) {
const editorRenderMode = this.getAttribute('mode') as EditorRenderMode; const editorRenderMode = this.getAttribute('mode') as EditorRenderMode;
const locale = this.getAttribute('locale'); const locale = this.getAttribute('locale');
const zoom = this.getAttribute('zoom');
const persistenceManager = persistence || new LocalStorageManager('map.xml', false, false); const persistenceManager = persistence || new LocalStorageManager('map.xml', false, false);
const mode = editorRenderMode || 'viewonly'; const mode = editorRenderMode || 'viewonly';
@ -69,7 +71,7 @@ class MindplotWebComponent extends HTMLElement {
widgetManager, widgetManager,
divContainer: this._shadowRoot.getElementById('mindplot'), divContainer: this._shadowRoot.getElementById('mindplot'),
container: 'mindplot', container: 'mindplot',
zoom: 1, zoom: zoom ? Number.parseFloat(zoom) : 1,
locale: locale || 'en', locale: locale || 'en',
}); });
this._designer = buildDesigner(options); this._designer = buildDesigner(options);

View File

@ -12,10 +12,7 @@ class EditorOptionsBuilder {
if (!AppConfig.isDevelopEnv()) { if (!AppConfig.isDevelopEnv()) {
options = { options = {
zoom: zoom: globalThis.userOptions?.zoom ? globalThis?.userOptions?.zoom : 0.8,
globalThis.userOptions?.zoom != undefined
? Number.parseFloat(globalThis?.userOptions?.zoom as string)
: 0.8,
locked: globalThis.mindmapLocked, locked: globalThis.mindmapLocked,
lockedMsg: globalThis.mindmapLockedMsg, lockedMsg: globalThis.mindmapLockedMsg,
mapTitle: globalThis.mapTitle, mapTitle: globalThis.mapTitle,