diff --git a/apps/viewer/init.js b/apps/viewer/init.js index f2042a099..0356e4510 100644 --- a/apps/viewer/init.js +++ b/apps/viewer/init.js @@ -260,16 +260,17 @@ function initCore() { // add center position and zoom - if (data.states != undefined) { - // Rounds a number to the specified number of decimal places. - function roundTo(num, decimalPlaces) { - const factor = 10 ** decimalPlaces; - return Math.round(num * factor) / factor; - } + console.log('data', data); + if (data.viewerStates != undefined) { const decimalPlaces = 3; - attributes.X = data.states.x, - attributes.Y = data.states.y, - attributes.zoom = roundTo(data.states.zoom, decimalPlaces); + attributes.X = data.viewerStates.x, + attributes.Y = data.viewerStates.y, + attributes.zoom = roundTo(data.viewerStates.zoom, decimalPlaces); + } + // Rounds a number to the specified number of decimal places. + function roundTo(num, decimalPlaces) { + const factor = 10 ** decimalPlaces; + return Math.round(num * factor) / factor; } diff --git a/apps/viewer/uicallbacks.js b/apps/viewer/uicallbacks.js index d273b5533..2b3360e4e 100644 --- a/apps/viewer/uicallbacks.js +++ b/apps/viewer/uicallbacks.js @@ -895,7 +895,7 @@ function annoCallback(data) { noteData.notes = resultString; // get center position and zoom - let states = StatesHelper.getCurrentStates(true); + let viewerStates = StatesHelper.getCurrentStates(true); // save // provenance @@ -922,10 +922,10 @@ function annoCallback(data) { $CAMIC.viewer, $CAMIC.viewer.canvasDrawInstance.getImageFeatureCollection(), ), - states: { - x: states.x, - y: states.y, - zoom: states.z, + viewerStates: { + x: viewerStates.x, + y: viewerStates.y, + zoom: viewerStates.z, }, };