Browse Source

fix(render bug fix): new render method

master
wbfsa 5 years ago
parent
commit
a1bcf81562
  1. 4
      src/controllers/menuButton.js
  2. 48
      src/global/draw.js
  3. 368
      src/global/getRowlen.js
  4. 40
      src/index.html

4
src/controllers/menuButton.js

@ -2948,10 +2948,10 @@ const menuButton = {
}
if(attr == "tb" || attr == "tr" || attr == "fs"){
jfrefreshgrid(d, Store.luckysheet_select_save, cfg, null, true);
jfrefreshgrid(d, Store.luckysheet_select_save, cfg, null, true, false);
}
else{
jfrefreshgrid(d, Store.luckysheet_select_save);
jfrefreshgrid(d, Store.luckysheet_select_save, undefined, undefined,undefined,false);
}
},
updateFormat_mc: function(d, foucsStatus){

48
src/global/draw.js

@ -1517,7 +1517,17 @@ let cellRender = function(r, c, start_r, start_c, end_r, end_c, value, luckyshee
let value = textInfo.values[0]
let horizonAlignPos = pos_x + value.left;
let verticalAlignPos = pos_y + value.top;
let verticalAlignPos = pos_y + value.top- textInfo.textHeightAll;
if(verticalAlign == "0"){ //居中对齐
verticalAlignPos = pos_y + cellHeight/2 - textInfo.textHeightAll/2;
}
else if(verticalAlign == "1"){ //上对齐
verticalAlignPos = pos_y;
}
else if(verticalAlign == "2"){ //下对齐
verticalAlignPos =verticalAlignPos - textInfo.desc;
}
verticalAlignPos = verticalAlignPos/Store.zoomRatio;
horizonAlignPos = horizonAlignPos/Store.zoomRatio;
@ -1530,12 +1540,12 @@ let cellRender = function(r, c, start_r, start_c, end_r, end_c, value, luckyshee
32,
pos_x/Store.zoomRatio ,
verticalAlignPos,
textContent.textHeightAll/Store.zoomRatio,
textContent.textHeightAll/Store.zoomRatio
textInfo.textHeightAll/Store.zoomRatio,
textInfo.textHeightAll/Store.zoomRatio
);
if(horizonAlign != "0" && horizonAlign != "2"){ //左对齐时 文本渲染空出一个图标的距离
horizonAlignPos = horizonAlignPos + textContent.textHeightAll/Store.zoomRatio;
horizonAlignPos = horizonAlignPos + textInfo.textHeightAll/Store.zoomRatio;
}
}
@ -1805,10 +1815,15 @@ function getCellOverflowMap(canvas, col_st, col_ed, row_st, row_end){
// value = getcellvalue(r, c);
// }
let textMetrics = getCellTextInfo(cell, canvas,{
let textMetricsObj = getCellTextInfo(cell, canvas,{
r:r,
c:c,
}).textWidthAll;
});
let textMetrics = 0;
if(textMetricsObj!=null){
textMetrics = textMetricsObj.textWidthAll;
}
//canvas.measureText(value).width;
let start_c = c - 1 < 0 ? 0 : Store.visibledatacolumn[c - 1];
@ -2008,12 +2023,24 @@ function cellOverflow_colIn(map, r, c, col_st, col_ed){
}
function cellTextRender(textInfo, ctx, option){
if(textInfo==null){
return
}
let values = textInfo.values;
let pos_x = option.pos_x, pos_y = option.pos_y;
if(values==null){
return;
}
console.log(textInfo, pos_x, pos_y, values[0].width, values[0].left, ctx);
// console.log(textInfo, pos_x, pos_y, values[0].width, values[0].left, ctx);
// for(let i=0;i<values.length;i++){
// let word = values[i];
// ctx.font = word.style;
// ctx.fillText(word.content, (pos_x + word.left)/Store.zoomRatio, (pos_y+word.top)/Store.zoomRatio);
// }
// ctx.fillStyle = "rgba(255,255,0,0.2)";
// ctx.fillRect((pos_x + values[0].left)/Store.zoomRatio, (pos_y+values[0].top-values[0].asc)/Store.zoomRatio, textInfo.textWidthAll, textInfo.textHeightAll)
if(textInfo.rotate!=0 && textInfo.type!="verticalWrap"){
ctx.save();
@ -2022,13 +2049,16 @@ function cellTextRender(textInfo, ctx, option){
ctx.translate(-(textInfo.textLeftAll+pos_x), -(pos_y+textInfo.textTopAll));
}
// ctx.fillStyle = "rgb(0,0,0)";
for(let i=0;i<values.length;i++){
let word = values[i];
ctx.font = word.style;
ctx.fillText(word.content, (pos_x + word.left)/Store.zoomRatio, (pos_y+word.top)/Store.zoomRatio);
}
// ctx.fillStyle = "rgba(0,0,0,0.2)";
// ctx.fillRect((pos_x + values[0].left)/Store.zoomRatio, (pos_y+values[0].top-values[0].asc)/Store.zoomRatio, textInfo.textWidthAll, textInfo.textHeightAll)
// ctx.fillStyle = "rgba(255,0,0,1)";
// ctx.fillRect(pos_x+textInfo.textLeftAll-2, pos_y+textInfo.textTopAll-2, 4,4);
if(textInfo.rotate!=0 && textInfo.type!="verticalWrap"){
ctx.restore();
}

368
src/global/getRowlen.js

@ -35,13 +35,19 @@ function rowlenByRange(d, r1, r2, cfg) {
}
if(cell != null && cell.v != null){
let cellWidth = colLocationByIndex(c)[1] - colLocationByIndex(c)[0] - 2;
let textInfo = getCellTextInfo(cell, canvas,{
r:r,
c:c,
cellWidth:cellWidth
});
let computeRowlen = textInfo.textHeightAll;
let computeRowlen = 0;
// console.log("rowlen", textInfo);
if(textInfo!=null){
computeRowlen = textInfo.textHeightAll;
}
// let fontset = luckysheetfontformat(cell);
// canvas.font = fontset;
@ -227,6 +233,7 @@ function getCellTextInfo(cell , ctx, option){
let cellWidth = option.cellWidth;
let cellHeight = option.cellHeight;
let isMode = "", isModeSplit = "";
// console.log("initialinfo", cell, option);
if(cellWidth==null){
isMode = "onlyWidth";
isModeSplit = "_";
@ -303,9 +310,15 @@ function getCellTextInfo(cell , ctx, option){
let fontset = luckysheetfontformat(cell);
ctx.font = fontset;
let value = cell.m;
if(value == null){
value = cell.v;
let value;
if(cell instanceof Object){
value = cell.m;
if(value == null){
value = cell.v;
}
}
else{
value = cell;
}
if(isRealNull(value)){
@ -394,6 +407,7 @@ function getCellTextInfo(cell , ctx, option){
textContent.textHeightAll = textH_all;
if(isMode=="onlyWidth"){
// console.log("verticalWrap", textContent,cell, option);
return textContent;
}
@ -442,6 +456,7 @@ function getCellTextInfo(cell , ctx, option){
let textW_all = 0; //拆分后宽高度合计
let textH_all = 0;
let textW_all_inner = 0;
// let oneWordWidth = getMeasureText(vArr[0], ctx).width;
let splitIndex=0, text_all_cache=0, text_all_split = {}, text_all_splitLen=[];
@ -470,9 +485,9 @@ function getCellTextInfo(cell , ctx, option){
// textW_all += textW;
if(rt!=0){//rotate
console.log("all",anchor, i , str);
// console.log("all",anchor, i , str);
if((height+space_height)>cellHeight && text_all_split[splitIndex]!=null){
console.log("cut",anchor, i , str);
// console.log("cut",anchor, i , str);
anchor = i-1;
text_all_split[splitIndex].push({
@ -492,7 +507,7 @@ function getCellTextInfo(cell , ctx, option){
splitIndex +=1;
}
else if(i== value.length){
console.log("last",anchor, i , str);
// console.log("last",anchor, i , str);
if(text_all_split[splitIndex]==null){
text_all_split[splitIndex]= [];
}
@ -571,15 +586,15 @@ function getCellTextInfo(cell , ctx, option){
}
let split_all_size = [];
// console.log(splitIndex, text_all_split);
let split_all_size = [], oneLinemaxWordCount=0;
// console.log("split",splitIndex, text_all_split);
let splitLen = Object.keys(text_all_split).length;
for(let i = 0; i < splitLen; i++){
let splitLists = text_all_split[i];
if(splitLists==null){
continue;
}
let sWidth = 0, sHeight=0;
let sWidth = 0, sHeight=0, maxDesc=0,maxAsc=0, lineHeight=0, maxWordCount=0;
for(let s=0;s<splitLists.length;s++){
let sp = splitLists[s];
if(rt!=0){//rotate
@ -590,15 +605,22 @@ function getCellTextInfo(cell , ctx, option){
sWidth += sp.width;
sHeight = Math.max(sHeight, sp.height-(supportBoundBox?sp.desc:0));
}
maxDesc = Math.max(maxDesc,(supportBoundBox?sp.desc:0));
maxAsc = Math.max(maxAsc, sp.asc);
maxWordCount++;
}
lineHeight = sHeight/1.5;
oneLinemaxWordCount = Math.max(oneLinemaxWordCount, maxWordCount);
if(rt!=0){//rotate
sHeight+=sHeight/1.5;
textW_all = Math.max(textW_all, sWidth);
sHeight+=lineHeight;
textW_all_inner = Math.max(textW_all_inner, sWidth);
// textW_all = Math.max(textW_all, sWidth+ (textH_all)/Math.tan(rt*Math.PI/180));
textH_all += sHeight;
}
else{//plain
sHeight+=sHeight/1.5;
// console.log("textH_all",textW_all, textH_all);
sHeight+=lineHeight;
textW_all=Math.max(textW_all, sWidth);
textH_all+=sHeight;
}
@ -606,28 +628,47 @@ function getCellTextInfo(cell , ctx, option){
split_all_size.push({
width:sWidth,
height:sHeight
height:sHeight,
desc:maxDesc,
asc:maxAsc,
lineHeight:lineHeight,
wordCount: maxWordCount
});
}
// let cumColumnWidth = 0;
let cumWordHeight = 0,cumColumnWidth = 0;
let rw = textH_all/Math.sin(rt*Math.PI/180) + textW_all*Math.cos(rt*Math.PI/180);
let rh = textW_all*Math.sin(rt*Math.PI/180);
if(rt!=0){
textContent.textWidthAll = rw;
textContent.textHeightAll = rh;
let rtPI = rt*Math.PI/180;
let lastLine = split_all_size[splitLen-1];
let lastLineSpaceHeight = lastLine.lineHeight;
textH_all = textH_all - lastLineSpaceHeight + lastLine.desc;
let rw = (textH_all)/Math.sin(rtPI) + textW_all_inner*Math.cos(rtPI);
let rh = textW_all_inner*Math.sin(rtPI), fixOneLineLeft = 0;
if(splitLen==1){
textW_all = textW_all_inner + 2*(textH_all/Math.tan(rtPI));
fixOneLineLeft = textH_all/Math.tan(rtPI);
}
else{
textW_all = textW_all_inner + textH_all/Math.tan(rtPI);
}
// if(rt!=0){
// textContent.textWidthAll = rw;
// textContent.textHeightAll = rh;
// }
// else{
textContent.textWidthAll = textW_all;
textContent.textHeightAll = textH_all;
}
// }
if(isMode=="onlyWidth"){
// console.log("plainWrap", textContent,cell, option);
return textContent;
}
for(let i = 0; i < splitLen; i++){
let splitLists = text_all_split[i];
if(splitLists==null){
@ -641,60 +682,182 @@ function getCellTextInfo(cell , ctx, option){
let wordGroup = splitLists[c];
let left, top;
if(rt!=0){//rotate
let x, y = cumWordHeight + wordGroup.textHeight / Math.sin(rt*Math.PI/180)*isRotateDown;
let x, y = cumWordHeight+size.asc;
if(isRotateUp=="1"){
if(horizonAlign=="2"){
x = (cumWordHeight)/Math.tan(rt*Math.PI/180);
// x = (cumWordHeight)/Math.tan(rtPI) + cumColumnWidth;
if(verticalAlign=="2"){
x = (cumWordHeight+size.height)/Math.tan(rtPI) + cumColumnWidth;
}
else if(verticalAlign=="0"){
x = (cumWordHeight+size.height/2)/Math.tan(rtPI) + cumColumnWidth;
}
else{
x = (cumWordHeight - wordGroup.asc)/Math.tan(rt*Math.PI/180) + cumColumnWidth;
x = (cumWordHeight)/Math.tan(rtPI) + cumColumnWidth;
}
if(horizonAlign == "0"){//center
let sh = textH_all/Math.sin(rtPI);
x = (cumWordHeight+size.height)/Math.tan(rt*Math.PI/180) + cumColumnWidth;
if(verticalAlign == "0"){//mid
left = x + cellWidth/2 - (textW_all/2);
top = y + cellHeight/2 - textH_all/2;
}
else if(verticalAlign == "1"){//top
left = x + cellWidth/2 - textW_all/2- lastLineSpaceHeight*Math.cos(rtPI)/2;
top = y - (textH_all/2 - rh/2) + lastLineSpaceHeight*Math.sin(rtPI)/2;
}
else if(verticalAlign == "2"){//bottom
left = x + cellWidth/2 - (textW_all/2);
top = y + cellHeight - rh/2-textH_all/2;
}
}
else if(horizonAlign == "1"){//left
if(verticalAlign == "0"){//mid
left = x - rh*Math.sin(rtPI)/2;
top = y + cellHeight/2 + rh*Math.cos(rtPI)/2;
}
else if(verticalAlign == "1"){//top
left = x - rh*Math.sin(rtPI);
top = y + rh*Math.cos(rtPI);
}
else if(verticalAlign == "2"){//bottom
left = x;
top = y + cellHeight;
}
}
else if(horizonAlign == "2"){//right
x = (cumWordHeight)/Math.tan(rt*Math.PI/180) + cumColumnWidth;
if(verticalAlign == "0"){//mid
// left = x + cellWidth - ( textH_all/Math.tan(rtPI) + (rh/2)*Math.sin(rtPI));
// top = y + cellHeight/2 - (textH_all - (rh/2)*Math.cos(rtPI));
left = x + cellWidth - rw/2 - (textW_all/2+(textH_all/2)/Math.tan(rtPI));
top = y + cellHeight/2 - textH_all/2;
}
else if(verticalAlign == "1"){//top fixOneLineLeft
left = x + cellWidth - textW_all + lastLine.height*Math.cos(rtPI)/2;
top = y - textH_all + lastLine.height*Math.sin(rtPI)/2;
}
else if(verticalAlign == "2"){//bottom
left = x + cellWidth - rw*Math.cos(rtPI) + lastLineSpaceHeight*Math.cos(rtPI);
top = y + cellHeight - rw*Math.sin(rtPI) + lastLineSpaceHeight*Math.sin(rtPI);
}
}
}
else{
if(horizonAlign=="2"){
x = (textH_all-cumWordHeight)/Math.tan(rt*Math.PI/180) + cumColumnWidth;
x = (textH_all-cumWordHeight)/Math.tan(rtPI) + cumColumnWidth;
if(horizonAlign == "0"){//center
let sh = textH_all/Math.sin(rtPI);
x = (cumWordHeight+wordGroup.textHeight)/Math.tan(rt*Math.PI/180) + cumColumnWidth;
if(verticalAlign == "0"){//mid
left = x + cellWidth/2 - (textW_all/2);
top = y + cellHeight/2 - textH_all/2;
}
else if(verticalAlign == "1"){//top
left = x + cellWidth/2 - textW_all/2;
top = y - (textH_all/2 - rh/2)+wordGroup.textHeight/1.5;
}
else if(verticalAlign == "2"){//bottom
left = x + cellWidth/2 - (textW_all/2);
top = y + cellHeight - rh/2-textH_all/2-wordGroup.textHeight/1.5;
}
}
else{
x = (textH_all-cumWordHeight-wordGroup.asc)/Math.tan(rt*Math.PI/180) + cumColumnWidth;
else if(horizonAlign == "1"){//left
if(verticalAlign == "0"){//mid
left = x - rh*Math.sin(rtPI)/2;
top = y + cellHeight/2 + rh*Math.cos(rtPI)/2;
}
else if(verticalAlign == "1"){//top
left = x - lastLineSpaceHeight*Math.cos(rtPI);
top = y- textH_all + lastLineSpaceHeight*Math.sin(rtPI);
}
else if(verticalAlign == "2"){//bottom
left = x;
top = y + cellHeight;
}
}
else if(horizonAlign == "2"){//right
x = (cumWordHeight+wordGroup.textHeight)/Math.tan(rt*Math.PI/180) + cumColumnWidth;
if(verticalAlign == "0"){//mid
// left = x + cellWidth - ( textH_all/Math.tan(rtPI) + (rh/2)*Math.sin(rtPI));
// top = y + cellHeight/2 - (textH_all - (rh/2)*Math.cos(rtPI));
left = x + cellWidth - rh/2 - (textW_all/2+(textH_all/2)/Math.tan(rtPI));
top = y + cellHeight/2 - textH_all/2+wordGroup.textHeight/1.5;
}
else if(verticalAlign == "1"){//top
left = x + cellWidth - textW_all+fixOneLineLeft;
top = y - textH_all+wordGroup.textHeight/1.5;
}
else if(verticalAlign == "2"){//bottom
left = x + cellWidth - rw*Math.cos(rtPI);
top = y + cellHeight - rw*Math.sin(rtPI);
}
}
}
x -= wordGroup.textHeight / Math.sin(rt*Math.PI/180)*isRotateDown;
let leftOffset = textH_all/Math.sin(rt*Math.PI/180) - textH_all/Math.tan(rt*Math.PI/180);
left = x + leftOffset;
if(horizonAlign == "0"){
//+ space_width*textH_all_ColumnHeight.length
left = x + cellWidth / 2 + leftOffset - rw/2;
}
else if(horizonAlign == "2"){
left = x + cumColumnWidth + cellWidth + leftOffset - rw;
}
//( textH_all/2 - rh/2 )
let topOffset = (textH_all/2 - rh/2);
// let x, y = cumWordHeight; //+ wordGroup.textHeight / Math.sin(rt*Math.PI/180)*isRotateDown;
// if(isRotateUp=="1"){
// if(horizonAlign=="2"){
// x = (cumWordHeight)/Math.tan(rt*Math.PI/180) + cumColumnWidth;
// }
// else if(horizonAlign=="0"){
// x = (cumWordHeight)/Math.tan(rt*Math.PI/180) + cumColumnWidth;
// }
// else{
// x = (cumWordHeight)/Math.tan(rt*Math.PI/180) + cumColumnWidth;
// }
// }
// else{
// if(horizonAlign=="2"){
// x = (textH_all-cumWordHeight)/Math.tan(rt*Math.PI/180) + cumColumnWidth;
// }
// else if(horizonAlign=="0"){
// x = (textH_all-cumWordHeight)/Math.tan(rt*Math.PI/180) + cumColumnWidth;
// }
// else{
// x = (textH_all-cumWordHeight)/Math.tan(rt*Math.PI/180) + cumColumnWidth;
// }
// }
// // x -= wordGroup.textHeight / Math.sin(rt*Math.PI/180)*isRotateDown;
// // x -= size.textHeight*2;
// //textH_all/Math.sin(rt*Math.PI/180) - textH_all/Math.tan(rt*Math.PI/180);
// let leftOffset = 0;
// left = x + leftOffset;
// if(horizonAlign == "0"){
// //+ space_width*textH_all_ColumnHeight.length
// left = x + cellWidth / 2 + leftOffset - textW_all/2;
// }
// else if(horizonAlign == "2"){
// left = x + cellWidth + leftOffset - textW_all;
// }
// //( textH_all/2 - rh/2 )
// let topOffset = 0;
top = y + cellHeight - topOffset - rh - (supportBoundBox?wordGroup.desc:0);
if(verticalAlign == "0"){
top = y + cellHeight/2 - topOffset - rh/2 + wordGroup.asc/2;
}
else if(verticalAlign == "1"){
top = y - topOffset + wordGroup.asc;
}
// top = y + cellHeight - topOffset - textH_all + wordGroup.asc +wordGroup.desc +(splitLen>1?(wordGroup.textHeight/1.5):0);
// if(verticalAlign == "0"){
// top = y + cellHeight/2 - topOffset - textH_all/2 + wordGroup.asc+(splitLen>1?(wordGroup.textHeight/3):0);
// }
// else if(verticalAlign == "1"){
// top = y - topOffset + wordGroup.asc;
// }
cumColumnWidth += wordGroup.textWidth;
if(c==0 && i==0 && isRotateUp=="1"){
textContent.textLeftAll = left;
textContent.textTopAll = top-wordGroup.asc;
}
else if(c==0 && i==(splitLen-1) && isRotateUp=="0"){
textContent.textLeftAll = left;
textContent.textTopAll = top+wordGroup.desc;
}
console.log("plainWrap" ,left , top);
// cumColumnWidth += wordGroup.textWidth;
// if(c==0 && i==0 && isRotateUp=="1"){
// textContent.textLeftAll = left;
// textContent.textTopAll = top-wordGroup.asc;
// }
// else if(c==0 && i==(splitLen-1) && isRotateUp=="0"){
// textContent.textLeftAll = left;
// textContent.textTopAll = top+wordGroup.desc;
// }
// console.log("plainWrap" ,left , top);
}
else{//plain
left = space_width + cumColumnWidth;
@ -706,9 +869,9 @@ function getCellTextInfo(cell , ctx, option){
left = cellWidth + cumColumnWidth - size.width;
}
top = (cellHeight - space_height) + cumWordHeight - textH_all - wordGroup.desc + wordGroup.height*2/1.5-1;
top = (cellHeight - space_height) + cumWordHeight - textH_all + wordGroup.asc+wordGroup.height/1.5-wordGroup.desc-1;
if(verticalAlign == "0"){
top = cellHeight / 2 + cumWordHeight - textH_all/2 + wordGroup.height/2 + wordGroup.height/3+1;
top = cellHeight / 2 + cumWordHeight - textH_all/2 + wordGroup.asc+wordGroup.height/3-wordGroup.desc;
}
else if(verticalAlign == "1"){
top = space_height + cumWordHeight+ wordGroup.asc;
@ -733,22 +896,59 @@ function getCellTextInfo(cell , ctx, option){
textContent.type = "plainWrap";
if(rt!=0){
// textContent.textWidthAll = rw;
// textContent.textHeightAll = rh;
let leftCenter = (textW_all + textH_all/Math.tan(rt*Math.PI/180))/2;
let topCenter = textH_all/2;
// let leftCenter = 0;
// let topCenter = 0;
if(isRotateUp=="1"){
textContent.textLeftAll += leftCenter;
textContent.textTopAll += topCenter;
// let leftCenter = (textW_all + textH_all/Math.tan(rt*Math.PI/180))/2;
// let topCenter = textH_all/2;
// if(isRotateUp=="1"){
// textContent.textLeftAll += leftCenter;
// textContent.textTopAll += topCenter;
// }
// else {
// textContent.textLeftAll += leftCenter;
// textContent.textTopAll -= topCenter;
// }
if(horizonAlign == "0"){//center
if(verticalAlign == "0"){//mid
textContent.textLeftAll = cellWidth/2;
textContent.textTopAll = cellHeight/2;
}
else if(verticalAlign == "1"){//top
textContent.textLeftAll = cellWidth/2;
textContent.textTopAll = rh/2;
}
else if(verticalAlign == "2"){//bottom
textContent.textLeftAll = cellWidth/2;
textContent.textTopAll = cellHeight - rh/2;
}
}
else {
textContent.textLeftAll += leftCenter;
textContent.textTopAll -= topCenter;
else if(horizonAlign == "1"){//left
if(verticalAlign == "0"){//mid
textContent.textLeftAll = 0;
textContent.textTopAll = cellHeight/2;
}
else if(verticalAlign == "1"){//top
textContent.textLeftAll = 0;
textContent.textTopAll = 0;
}
else if(verticalAlign == "2"){//bottom
textContent.textLeftAll = 0;
textContent.textTopAll = cellHeight;
}
}
else if(horizonAlign == "2"){//right
if(verticalAlign == "0"){//mid
textContent.textLeftAll = cellWidth - rw/2;
textContent.textTopAll = cellHeight/2;
}
else if(verticalAlign == "1"){//top
textContent.textLeftAll = cellWidth;
textContent.textTopAll = 0;
}
else if(verticalAlign == "2"){//bottom
textContent.textLeftAll = cellWidth;
textContent.textTopAll = cellHeight;
}
}
}
@ -786,8 +986,9 @@ function getCellTextInfo(cell , ctx, option){
}
textContent.textWidthAll = textWidthAll;
console.log(textContent.textWidthAll , textContent.textHeightAll);
// console.log(textContent.textWidthAll , textContent.textHeightAll);
if(isMode=="onlyWidth"){
// console.log("plain", textContent,cell, option);
return textContent;
}
@ -822,7 +1023,10 @@ function getCellTextInfo(cell , ctx, option){
textContent.textLeftAll = left;
textContent.textTopAll = top;
console.log("plain",left,top);
textContent.asc = measureText.actualBoundingBoxAscent;
textContent.desc = measureText.actualBoundingBoxDescent;
// console.log("plain",left,top);
}
}

40
src/index.html

@ -37,45 +37,7 @@
allowEdit:true,
forceCalculation:false,
plugins: ['chart'],
data: [{"name":"Sheet1","config":{"columnlen":{"0":241},"rowlen":{"0":81}},"index":"1","status":"1","order":"0","luckysheet_select_save":[{"row":[0,0],"column":[4,4],"sheetIndex":1}],"zoomRatio":1,"showGridLines":"1","defaultColWidth":72,"defaultRowHeight":18,"celldata":[
{"r":0,"c":0,
"v":{
"ct":{
"fa":"General",
"t":"inlineStr",
"sharedStrings":[
{
"ff":"等线", //font family
"fc":"#fff000",//font color
"fs":12,//font size
"cl":1,//strike
"un":0,//underline
"bl":0,//blod
"it":1,//italic
v:"我在\r\n"
},
{
"ff":"等线", //font family
"fc":"#ff0000",//font color
"fs":14,//font size
"cl":"1",//strike
"un":"0",//underline
"bl":"1",//blod
"it":"0",//italic
v:"马路边"
},
]
},
"fs":11,
"ff":"等线",
"vt":0,
"tb":2,
"v":"",
"qp":1,
}
},
{"r":17,"c":2,"v":{"v":"Luckysheet","ct":{"fa":"General","t":"g"},"bg":null,"bl":0,"it":0,"ff":0,"fs":"11","fc":"rgb(51, 51, 51)","ht":1,"vt":1,"m":"Luckysheet"}}
],"calcChain":[]}]
data: [sheetCell,sheetFormula,sheetConditionFormat,sheetSparkline,sheetTable,sheetComment,sheetPivotTableData,sheetPivotTable,sheetChart]
})
})

Loading…
Cancel
Save