浏览代码

sjs相关,activeImageButton单元格调整

MaiXinRong 5 年之前
父节点
当前提交
a285c02898
共有 2 个文件被更改,包括 30 次插入7 次删除
  1. 30 6
      app/public/js/spreadjs_rela/spreadjs_zh.js
  2. 0 1
      app/public/js/stage.js

+ 30 - 6
app/public/js/spreadjs_rela/spreadjs_zh.js

@@ -1802,8 +1802,16 @@ const SpreadJsObj = {
              注释部分以进入鼠标进入图片,点击图片为基准更新图片,鼠标快速移动时,可能失效
               */
             proto.processMouseDown = function (hitinfo) {
-                const col = hitinfo.sheet.zh_setting.cols[hitinfo.col];
-                const img = this.getImage(hitinfo.sheet, hitinfo.row, hitinfo.col);
+                const col = options.sheet.zh_setting.cols[hitinfo.col];
+
+                const sortData = SpreadJsObj.getSortData(hitinfo.sheet);
+                const data = sortData ? sortData[hitinfo.row] : null;
+                let showImage = true;
+                if (col.showImage && Object.prototype.toString.apply(col.showImage) === "[object Function]") {
+                    showImage = col.showImage(data);
+                }
+                const img = showImage ? this.getImage(hitinfo.sheet, hitinfo.row, hitinfo.col) : null;
+
                 const halfX = img.width / 2, halfY = img.height / 2;
                 const indent = col.indent ? col.indent : 10;
                 const centerX = hitinfo.cellStyle.hAlign === spreadNS.HorizontalAlign.right
@@ -1818,8 +1826,16 @@ const SpreadJsObj = {
                 }
             };
             proto.processMouseUp = function (hitinfo) {
-                const col = hitinfo.sheet.zh_setting.cols[hitinfo.col];
-                const img = this.getImage(hitinfo.sheet, hitinfo.row, hitinfo.col);
+                const col = options.sheet.zh_setting.cols[hitinfo.col];
+
+                const sortData = SpreadJsObj.getSortData(hitinfo.sheet);
+                const data = sortData ? sortData[hitinfo.row] : null;
+                let showImage = true;
+                if (col.showImage && Object.prototype.toString.apply(col.showImage) === "[object Function]") {
+                    showImage = col.showImage(data);
+                }
+                const img = showImage ? this.getImage(hitinfo.sheet, hitinfo.row, hitinfo.col) : null;
+
                 const halfX = img.width / 2, halfY = img.height / 2;
                 const indent = col.indent ? col.indent : 10;
                 const centerX = hitinfo.cellStyle.hAlign === spreadNS.HorizontalAlign.right
@@ -1840,8 +1856,16 @@ const SpreadJsObj = {
                 }
             };
             proto.processMouseMove = function (hitinfo) {
-                const col = hitinfo.sheet.zh_setting.cols[hitinfo.col];
-                const img = this.getImage(hitinfo.sheet, hitinfo.row, hitinfo.col);
+                const col = options.sheet.zh_setting.cols[hitinfo.col];
+
+                const sortData = SpreadJsObj.getSortData(hitinfo.sheet);
+                const data = sortData ? sortData[hitinfo.row] : null;
+                let showImage = true;
+                if (col.showImage && Object.prototype.toString.apply(col.showImage) === "[object Function]") {
+                    showImage = col.showImage(data);
+                }
+                const img = showImage ? this.getImage(hitinfo.sheet, hitinfo.row, hitinfo.col) : null;
+
                 const halfX = img.width / 2, halfY = img.height / 2;
                 const indent = col.indent ? col.indent : 10;
                 const centerX = hitinfo.cellStyle.hAlign === spreadNS.HorizontalAlign.right

+ 0 - 1
app/public/js/stage.js

@@ -511,7 +511,6 @@ $(document).ready(() => {
         return data !== undefined && data !== null;
     };
     posSpreadSetting.imageClick = function (data) {
-        if (!data) return;
         const node = SpreadJsObj.getSelectObject(slSpread.getActiveSheet());
         changesObj.loadChanges({bills: node, pos: data});
     };