Skip to content

Commit

Permalink
change name from states to viewerStates
Browse files Browse the repository at this point in the history
  • Loading branch information
YukaUU committed Jul 18, 2024
1 parent 88d1846 commit 10a8801
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
19 changes: 10 additions & 9 deletions apps/viewer/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}


Expand Down
10 changes: 5 additions & 5 deletions apps/viewer/uicallbacks.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
},
};

Expand Down

0 comments on commit 10a8801

Please sign in to comment.