|
@@ -41,6 +41,11 @@ function SingleImageView(option) {
|
|
|
this.scale = Number(scale);
|
|
|
}
|
|
|
});
|
|
|
+ this.markControl.on('image.position.change', this, function (event, context, topPercent) {
|
|
|
+ if (this.task != undefined) {
|
|
|
+ this.updateScrollTop(topPercent);
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
SingleImageView.prototype.init = function () {
|
|
@@ -146,6 +151,18 @@ SingleImageView.prototype.drawTag = function (tag) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+SingleImageView.prototype.updateScrollTop = function (scrollTopPercent) {
|
|
|
+ var height = this.canvas.height;
|
|
|
+ var minHeight = this.container.height();
|
|
|
+ if (scrollTopPercent != undefined && scrollTopPercent >= 0 && scrollTopPercent <= 1 && height > minHeight) {
|
|
|
+ var left = height * (1 - scrollTopPercent);
|
|
|
+ var scrollTop = left > minHeight ? (height - left) : (height - minHeight);
|
|
|
+ this.container.scrollTop(scrollTop);
|
|
|
+ } else {
|
|
|
+ this.container.scrollTop(0);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
SingleImageView.prototype.container_dom = '<div style="overflow: scroll; width: 100%"><canvas></canvas></div>';
|
|
|
|
|
|
SingleImageView.prototype.image_control_dom = '<em>\
|