mirror of
https://bitbucket.org/wisemapping/wisemapping-frontend.git
synced 2024-11-13 02:37:57 +01:00
Add support for specify zoom as parameter
This commit is contained in:
parent
228fb4e185
commit
5c60c38d23
@ -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);
|
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({
|
const options = buildOptions({
|
||||||
persistenceManager: persistence,
|
persistenceManager: persistence,
|
||||||
readOnly: global.readOnly || false,
|
readOnly: global.readOnly || false,
|
||||||
mapId: global.mapId,
|
mapId: global.mapId,
|
||||||
zoom: global.userOptions.zoom,
|
zoom: zoomParam || global.userOptions.zoom,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Build designer ...
|
// Build designer ...
|
||||||
|
@ -14,20 +14,6 @@ designer.addEvent('loadSuccess', () => {
|
|||||||
document.getElementById('mindplot').classList.add('ready');
|
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...
|
// Load map from XML file persisted on disk...
|
||||||
const persistence = PersistenceManager.getInstance();
|
const persistence = PersistenceManager.getInstance();
|
||||||
const mindmap = persistence.load(mapId);
|
const mindmap = persistence.load(mapId);
|
||||||
|
Loading…
Reference in New Issue
Block a user