Browse Source

code sync(Canvas输出微调)

TonyKang 3 years ago
parent
commit
36467ed967
1 changed files with 9 additions and 1 deletions
  1. 9 1
      app/public/report/js/jpc_output.js

+ 9 - 1
app/public/report/js/jpc_output.js

@@ -105,6 +105,13 @@ let JpcCanvasOutput = {
             if (rst.length === 0) rst.push(''); //什么都没有,也得整个空串
             return rst;
         }
+        function _chkIfShinkFirst(control, actLines) {
+            let rst = false;
+            if (control.ShrinkFirst === 'T' && control.Wrap !== 'T' && actLines > 1) {
+                rst = true;
+            }
+            return rst;
+        }
         function private_drawText(val, area, font, control) {
             let dftFontHeight = 12;
             let output = [];
@@ -207,7 +214,8 @@ let JpcCanvasOutput = {
                     let lines = Math.floor((area[JV.IDX_BOTTOM] - area[JV.IDX_TOP]) / (dftFontHeight + JV.OUTPUT_OFFSET[JV.OFFSET_IDX_BOTTOM] + JV.OUTPUT_OFFSET[JV.OFFSET_IDX_TOP] + 4));
                     lines = (lines === 0 || (control.Shrink === 'T' && control.ShrinkFirst === 'T'))?1:lines;
                     let actLines = private_splitString(val, validAreaTxtWidth, ctx);
-                    if (actLines.length > lines && dftFontHeight >= 6) {
+                    // if (actLines.length > lines && dftFontHeight >= 6) {
+                    if ((actLines.length > lines || _chkIfShinkFirst(control, actLines.length)) && dftFontHeight >= 6) {
                         dftFontHeight--;
                         ctx.font = "" + dftFontHeight + "px " + font[JV.PROP_NAME];
                     } else {