From 3d8e8dce38520de2ff6ccd3833367f0f7cc511ad Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Sun, 9 Oct 2022 21:00:53 -0700 Subject: [PATCH] Zoom toolbar reandered during load. --- packages/editor/src/components/index.tsx | 30 +++++++++---------- .../toolbar/toolbarConfigBuilder.tsx | 19 +++++++----- 2 files changed, 26 insertions(+), 23 deletions(-) diff --git a/packages/editor/src/components/index.tsx b/packages/editor/src/components/index.tsx index 185a64a5..c11625fb 100644 --- a/packages/editor/src/components/index.tsx +++ b/packages/editor/src/components/index.tsx @@ -80,24 +80,22 @@ const Editor = ({ const locale = options.locale; const msg = I18nMsg.loadLocaleData(locale); - const menubarConfiguration = buildAppBarConfig( - model, - options.mapTitle, - capability, - onAction, - accountConfiguration, - () => { - model.save(true); - }, - ); - - // if the Toolbar is not hidden before the variable 'isMobile' is defined, it appears intermittently when the page loads - // if the Toolbar is not rendered, Menu.ts cant find buttons for create event listeners - // so, with this hack the Toolbar is rendered but no visible until the variable 'isMobile' is defined return ( - + { + model.save(true); + }, + )} + /> + )} , tooltip: $msg('CENTER_POSITION'), onClick: () => { - designer.zoomToFit(); + model.getDesigner().zoomToFit(); }, + disabled: () => !model?.isMapLoadded(), }, { // zoom value candidate, neds to fixit render: () => ( - %{Math.floor((1 / designer.getWorkSpace()?.getZoom()) * 100)} + % + {!model?.isMapLoadded() + ? 100 + : Math.floor((1 / designer.getWorkSpace()?.getZoom()) * 100)} ), + disabled: () => !model?.isMapLoadded(), }, { icon: , tooltip: $msg('ZOOM_IN'), onClick: () => { - designer.zoomIn(); + model.getDesigner().zoomIn(); }, + disabled: () => !model?.isMapLoadded(), }, { icon: , tooltip: $msg('ZOOM_OUT'), onClick: () => { - designer.zoomOut(); + model.getDesigner().zoomOut(); }, + disabled: () => !model?.isMapLoadded(), }, { icon: ,