Quellcode durchsuchen

签章移动相关功能优化,移动签章,限制在表格以内

lishihao vor 2 Jahren
Ursprung
Commit
5b384ad7c0
1 geänderte Dateien mit 8 neuen und 6 gelöschten Zeilen
  1. 8 6
      app/public/report/js/rpt_move_signature.js

+ 8 - 6
app/public/report/js/rpt_move_signature.js

@@ -156,19 +156,21 @@ class MoveSignatureTool {
     templateSignatureMove(event, me) {
         // 表格大小
         const size = me.jpcOutput.getReportSizeInPixel(me.pageObj, getScreenDPI());
+        const reportMarginTop= me.pageObj.打印页面_信息.页边距.Top * 96/2;
+        const reportMarginBottom= me.pageObj.打印页面_信息.页边距.Bottom * 96/2;
         const { top, left } = $("#rptCanvas").position();
         const signatureWidth = $("#templateSignature").width();
         const signatureHeight = $("#templateSignature").height();
-        const maxTop = size[1] + top - signatureHeight + me.jpcOutput.offsetY * 2; //签章的最大y坐标
-        const maxLeft = size[0] + left - signatureWidth + me.jpcOutput.offsetX * 2; //签章的最大x坐标
+        const maxTop = size[1] + top - signatureHeight + me.jpcOutput.offsetY - reportMarginBottom  ; //签章的最大y坐标
+        const maxLeft =  me.pageObj.MergeBand.Right + left - signatureWidth + me.jpcOutput.offsetX ; //签章的最大x坐标
 
         const mousePos = me.getMousePos(event, me);
         let newTop = mousePos.y - me.subPos.y + top;
         let newLeft = mousePos.x - me.subPos.x + left;
-        if ((mousePos.y - me.subPos.y) < 0) newTop = top + me.jpcOutput.offsetY;
-        if ((mousePos.x - me.subPos.x) < 0) newLeft = left + me.jpcOutput.offsetX;
-        if ((mousePos.y - me.subPos.y) > maxTop - top) newTop = maxTop ;
-        if ((mousePos.x - me.subPos.x) > maxLeft - left) newLeft = maxLeft;
+        if ((mousePos.y - me.subPos.y) < reportMarginTop+top) newTop = reportMarginTop + top + me.jpcOutput.offsetY;
+        if ((mousePos.x - me.subPos.x) < me.pageObj.MergeBand.Left) newLeft = me.pageObj.MergeBand.Left+left + me.jpcOutput.offsetX;
+        if ((mousePos.y - me.subPos.y) > maxTop ) newTop = maxTop + me.jpcOutput.offsetY*2;
+        if ((mousePos.x - me.subPos.x) > maxLeft - left) newLeft = maxLeft + me.jpcOutput.offsetX/2;
 
         event.currentTarget.style.top = `${newTop}px`;
         event.currentTarget.style.left = `${newLeft}px`;