From 4066964ed5baef2daa1551ae35b94c5f8c0fab93 Mon Sep 17 00:00:00 2001 From: liuyang Date: Tue, 8 Sep 2020 17:41:51 +0800 Subject: [PATCH] refactor(rander): reander --- src/global/getRowlen.js | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/global/getRowlen.js b/src/global/getRowlen.js index 8e54887..f0566e4 100644 --- a/src/global/getRowlen.js +++ b/src/global/getRowlen.js @@ -416,7 +416,7 @@ function getCellTextInfo(cell , ctx, option){ textContent.rotate = rt; rt = Math.abs(rt); - let anchor = 0, preHeight = 0, preWidth=0, preStr; + let anchor = 0, preHeight = 0, preWidth=0, preStr, preTextHeight; for(let i = 1; i <= value.length; i++){ let str = value.substring(anchor, i); let measureText = getMeasureText(str, ctx); @@ -445,6 +445,7 @@ function getCellTextInfo(cell , ctx, option){ left:0, top:0, splitIndex:splitIndex, + textHeight:preTextHeight }); splitIndex +=1; @@ -458,7 +459,8 @@ function getCellTextInfo(cell , ctx, option){ height:height, left:0, top:0, - colIndex:splitIndex, + splitIndex:splitIndex, + textHeight:textHeight }); } } @@ -488,7 +490,7 @@ function getCellTextInfo(cell , ctx, option){ height:height, left:0, top:0, - colIndex:splitIndex, + splitIndex:splitIndex, }); } } @@ -496,18 +498,20 @@ function getCellTextInfo(cell , ctx, option){ preWidth = width; preHeight = height; preStr = str; + preTextHeight = textHeight; } let split_all_size = []; for(let i = 0; i <= splitIndex; i++){ let splitLists = text_all_split[i]; - let sWidth = 0, sHeight=0; + let sWidth = 0, sHeight=0, textHeight=0; for(let s=0;s