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 = {
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}
/>
<Notifier id="headerNotifier" />

View File

@ -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);

View File

@ -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,