Bladeren bron

造价对比,画图调整

MaiXinRong 2 jaren geleden
bovenliggende
commit
facddc5606
1 gewijzigde bestanden met toevoegingen van 12 en 4 verwijderingen
  1. 12 4
      app/public/js/spreadjs_rela/spreadjs_zh.js

+ 12 - 4
app/public/js/spreadjs_rela/spreadjs_zh.js

@@ -2576,7 +2576,8 @@ const SpreadJsObj = {
                 canvas.fill();
                 canvas.restore();
             };
-            const drawSB = function (canvas, x, y, w, h, r, color) {
+            const drawSB = function (canvas, x, y, w, h, color) {
+                const r = ZhCalc.div(h, 2, 2);
                 canvas.save();
                 // 设置偏移量
                 canvas.translate(0.5, 0.5);
@@ -2584,8 +2585,15 @@ const SpreadJsObj = {
                 canvas.beginPath();
                 canvas.moveTo(x, y);
                 canvas.lineTo(x+w, y);
-                canvas.arcTo(x+w, y+h, x, y+h, Math.min(r, w));
-                canvas.lineTo(x, y+h);
+                if (w > r) {
+                    canvas.arcTo(x+w, y+h, x, y+h, r);
+                    canvas.lineTo(x, y+h);
+                } else {
+                    canvas.arcTo(x+w, y+h-r+w, x, y+h-r+w, Math.min(r, w));
+                    canvas.lineTo(x, y+h-r+w);
+                }
+                //canvas.arcTo(x+w, y+h, x, y+h, Math.min(r, w));
+                //canvas.lineTo(x, y+h);
                 canvas.lineTo(x, y);
                 canvas.stroke();
                 canvas.fillStyle = color;
@@ -2623,7 +2631,7 @@ const SpreadJsObj = {
                     if (width < defaultR) continue;
                     const top = col.stackedBarCover ? startTop : startTop + height * i + i - 1;
                     //drawBarBefore99(canvas, left, top, width, height, ZhCalc.mul(height, defaultR, 2), bd.color);
-                    drawSB(canvas, left, top, width, height, ZhCalc.mul(height, 0.5, 2), bd.color);
+                    drawSB(canvas, left, top, width, height, bd.color);
                 }
             };