From 472845d4dba67935e4f5bbbfa07b54b23921dab5 Mon Sep 17 00:00:00 2001 From: Marcin Koziej Date: Mon, 16 Dec 2013 12:06:57 +0100 Subject: [PATCH] scale initial mark with the image --- apps/wolnelektury_core/static/js/picture.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/apps/wolnelektury_core/static/js/picture.js b/apps/wolnelektury_core/static/js/picture.js index 0d6d0cbcf..174a9ffa4 100644 --- a/apps/wolnelektury_core/static/js/picture.js +++ b/apps/wolnelektury_core/static/js/picture.js @@ -147,6 +147,10 @@ this._ratio = ratio; this.element.css(target); + if (this._initial_mark) { + this._initial_mark = this.redrawMark(this._initial_mark); + } + }, allowedPosition: function(off) { @@ -188,7 +192,12 @@ return undefined; }, - + redrawMark: function(mark) { + var $mark = $(mark); + var $newmark = this.createMark($mark.data('mark')); + $mark.remove(); + return $newmark; + }, // mark // { // label: "...", @@ -216,6 +225,8 @@ $mark.width(coords[1][0] - coords[0][0]); $mark.height(coords[1][1] - coords[0][1]); $mark.css({left: coords[0][0], top: coords[0][1]}); + + $mark.data('mark', mark); return $mark.get(0); }, }); -- 2.20.1