1
0
Pārlūkot izejas kodu

修复轨迹模式下无法缩略图点击滚动图片问题

ting.yin 4 gadi atpakaļ
vecāks
revīzija
19e7b1878b

+ 1 - 1
stmms-web/src/main/webapp/static/mark-new/js/modules/thumbnail.js

@@ -1,4 +1,4 @@
-//给分板模块
+//缩略图模块
 var thumbnail = function (option, success) {
     var object = new Thumbnail(option);
     success();

+ 17 - 0
stmms-web/src/main/webapp/static/mark-track/js/modules/single-image-view.js

@@ -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>\