Skip to content
This repository has been archived by the owner on Mar 28, 2024. It is now read-only.

Commit

Permalink
fix(fix bug with inline string rotate wrap): add change to max, fix h…
Browse files Browse the repository at this point in the history
…eight error
  • Loading branch information
DR-Univer committed Oct 23, 2020
1 parent 2996ae9 commit 1988687
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
30 changes: 15 additions & 15 deletions src/global/draw.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function luckysheetDrawgridRowTitle(scrollHeight, drawHeight, offsetTop) {
luckysheetTableContent.save();
luckysheetTableContent.beginPath();
luckysheetTableContent.rect(0, offsetTop-1, Store.rowHeaderWidth -1, drawHeight-2);
luckysheetTableContent.clip();
// luckysheetTableContent.clip();

let end_r, start_r;
let bodrder05 = 0.5;//Default 0.5
Expand Down Expand Up @@ -242,7 +242,7 @@ function luckysheetDrawgridColumnTitle(scrollWidth, drawWidth, offsetLeft) {
luckysheetTableContent.save();
luckysheetTableContent.beginPath();
luckysheetTableContent.rect(offsetLeft-1, 0, drawWidth, Store.columeHeaderHeight -1);
luckysheetTableContent.clip();
// luckysheetTableContent.clip();

// console.log(offsetLeft, 0, drawWidth, Store.columeHeaderHeight -1);

Expand Down Expand Up @@ -1570,7 +1570,7 @@ let cellRender = function(r, c, start_r, start_c, end_r, end_c, value, luckyshee
luckysheetTableContent.save();
luckysheetTableContent.beginPath();
luckysheetTableContent.rect(pos_x , pos_y, cellWidth , cellHeight );
luckysheetTableContent.clip();
// luckysheetTableContent.clip();
luckysheetTableContent.scale(Store.zoomRatio,Store.zoomRatio);

// let horizonAlignPos = (pos_x + space_width) ; //默认为1,左对齐
Expand Down Expand Up @@ -2132,14 +2132,14 @@ function cellTextRender(textInfo, ctx, option){
}
// 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);
// }
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)
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();
Expand All @@ -2148,7 +2148,7 @@ function cellTextRender(textInfo, ctx, option){
ctx.translate(-(textInfo.textLeftAll+pos_x)/Store.zoomRatio, -(pos_y+textInfo.textTopAll)/Store.zoomRatio);
}

// ctx.fillStyle = "rgb(0,0,0)";
ctx.fillStyle = "rgb(0,0,0)";
for(let i=0;i<values.length;i++){
let word = values[i];
if(word.inline===true && word.style!=null){
Expand Down Expand Up @@ -2198,10 +2198,10 @@ function cellTextRender(textInfo, ctx, option){
}
}
}
// 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);
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();
}
Expand Down
4 changes: 2 additions & 2 deletions src/global/getRowlen.js
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ function getCellTextInfo(cell , ctx, option){
sc.measureText = getMeasureText(sc.v, ctx, sc.fontset);
}
textWidth += sc.measureText.width;
textHeight += sc.measureText.actualBoundingBoxAscent+sc.measureText.actualBoundingBoxDescent;
textHeight = Math.max(sc.measureText.actualBoundingBoxAscent+sc.measureText.actualBoundingBoxDescent);
// console.log(sc.v,sc.measureText.width,sc.measureText.actualBoundingBoxAscent,sc.measureText.actualBoundingBoxDescent);
}

Expand All @@ -740,7 +740,7 @@ function getCellTextInfo(cell , ctx, option){

if(rt!=0){//rotate
// console.log("all",anchor, i , str);
// console.log(height,space_height, cellHeight);
console.log(height,space_height, cellHeight, shareCells,(height+space_height)>cellHeight);
if((height+space_height)>cellHeight && text_all_split[splitIndex]!=null && tb=="2" && i!= inlineStringArr.length){
// console.log("cut",anchor, i , str);

Expand Down
6 changes: 3 additions & 3 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@
}
],
data:
[sheetCell,sheetFormula,sheetConditionFormat,sheetSparkline,sheetTable,sheetComment,sheetPivotTableData,sheetPivotTable,sheetChart,sheetPicture,sheetDataVerification]
/*[{"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":[
// [sheetCell,sheetFormula,sheetConditionFormat,sheetSparkline,sheetTable,sheetComment,sheetPivotTableData,sheetPivotTable,sheetChart,sheetPicture,sheetDataVerification]
[{"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":{
Expand Down Expand Up @@ -103,7 +103,7 @@
}
},
{"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":[]}]*/
],"calcChain":[]}]

/*
[{
Expand Down

0 comments on commit 1988687

Please sign in to comment.