Add support for specify zoom as parameter

This commit is contained in:
Paulo Gustavo Veiga 2022-01-08 10:48:21 -08:00
parent 228fb4e185
commit 5c60c38d23
2 changed files with 5 additions and 15 deletions

View File

@ -52,11 +52,15 @@ if (!global.memoryPersistence && !global.readOnly) {
persistence = new LocalStorageManager(`/c/restful/maps/{id}/${global.historyId ? `${global.historyId}/` : ''}document/xml${!global.isAuth ? '-pub' : ''}`, true);
}
// Obtain map zoom from query param if it was specified...
const params = new URLSearchParams(window.location.search.substring(1));
const zoomParam = Number.parseFloat(params.get('zoom'), 10);
const options = buildOptions({
persistenceManager: persistence,
readOnly: global.readOnly || false,
mapId: global.mapId,
zoom: global.userOptions.zoom,
zoom: zoomParam || global.userOptions.zoom,
});
// Build designer ...

View File

@ -14,20 +14,6 @@ designer.addEvent('loadSuccess', () => {
document.getElementById('mindplot').classList.add('ready');
});
const zoomInButton = document.getElementById('zoom-plus');
const zoomOutButton = document.getElementById('zoom-minus');
if (zoomInButton) {
zoomInButton.addEventListener('click', () => {
designer.zoomIn();
});
}
if (zoomOutButton) {
zoomOutButton.addEventListener('click', () => {
designer.zoomOut();
});
}
// Load map from XML file persisted on disk...
const persistence = PersistenceManager.getInstance();
const mindmap = persistence.load(mapId);