P5-1852 x/y coordinates are no longer stored in sessionStorage

This commit is contained in:
Martin
2017-10-25 08:08:45 +02:00
parent 9f26886d42
commit 16a85b1431
4 changed files with 26 additions and 12 deletions
+5 -5
View File
@@ -2,28 +2,28 @@
function ImageDataHandler(img) {
var _cropData;
/**
* Gets information about how the cropped image is dragged
* @return {Object}
*/
this.getCropData = function () {
return JSON.parse(sessionStorage.getItem('cropData'));
return _cropData;
};
this.setCropData = function() {
var viewportBounds = img.canvas.getViewport().getBounds();
var dragAxis = img.canvas.getViewport().getData().axis;
var cropData = {
_cropData = {
x: dragAxis === 'x' ? (viewportBounds.left - img.left) / (img.width * img.scaleX) : 0,
y: dragAxis === 'y' ? (viewportBounds.top - img.top) / (img.height * img.scaleY) : 0,
};
sessionStorage.setItem('cropData', JSON.stringify(cropData));
};
this.removeCropData = function() {
sessionStorage.removeItem('cropData');
_cropData = null;
};
/**