+
+ // mark
+ // {
+ // label: "...",
+ // coords: [x, y, w, h]
+ // }
+ createMark: function(mark) {
+ var $mark = $('<div class="mark"><div class="label">' +
+ mark.label + '</div></div>');
+ var ratio = this.zoomForStep(this.currentZoom()) *
+ this.initial_size[0] / (100 * this.natural_size()[0]);
+ var scale = function (v) {
+ return v * ratio;
+ }
+ if (mark.coords[1][0] < 0 || mark.coords[1][1] < 0) { // whole
+ var s = self.natural_size();
+ if (mark.coords[1][0] < 0) mark.coords[1][0] = s[0];
+ if (mark.coords[1][1] < 0) mark.coords[1][1] = s[1];
+ }
+
+ var coords = [[scale(mark.coords[0][0]), scale(mark.coords[0][1])],
+ [scale(mark.coords[1][0]), scale(mark.coords[1][1])]];
+ this.element.append($mark);
+ $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]});
+ return $mark.get(0);
+ },