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

Commit

Permalink
fix(underline and cancelline): add and fix
Browse files Browse the repository at this point in the history
  • Loading branch information
DR-Univer committed Sep 14, 2020
1 parent bf83138 commit d3f23ff
Show file tree
Hide file tree
Showing 4 changed files with 786 additions and 705 deletions.
2 changes: 1 addition & 1 deletion src/controllers/menuButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -3314,7 +3314,7 @@ const menuButton = {
},
checkstatusByCell:function(cell, a){
let foucsStatus =cell;
let tf = {"bl":1, "it":1 , "ff":1, "cl":1};
let tf = {"bl":1, "it":1 , "ff":1, "cl":1, "un":1};

if(a in tf){
if(foucsStatus == null){
Expand Down
37 changes: 37 additions & 0 deletions src/global/draw.js
Original file line number Diff line number Diff line change
Expand Up @@ -2054,6 +2054,43 @@ function cellTextRender(textInfo, ctx, option){
let word = values[i];
ctx.font = word.style;
ctx.fillText(word.content, (pos_x + word.left)/Store.zoomRatio, (pos_y+word.top)/Store.zoomRatio);

if(word.cancelLine!=null){
let c = word.cancelLine;
ctx.beginPath();
ctx.moveTo(
(pos_x +c.startX)/Store.zoomRatio ,
(pos_y+c.startY)/Store.zoomRatio
);
ctx.lineTo(
(pos_x +c.endX)/Store.zoomRatio,
(pos_y+c.endY)/Store.zoomRatio
);
ctx.lineWidth = 1;
ctx.strokeStyle = ctx.fillStyle;
ctx.stroke();
ctx.closePath();
}

if(word.underLine!=null){
let underLines = word.underLine;
for(let a=0;a<underLines.length;a++){
let item = underLines[a];
ctx.beginPath();
ctx.moveTo(
(pos_x +item.startX)/Store.zoomRatio ,
(pos_y+item.startY)/Store.zoomRatio
);
ctx.lineTo(
(pos_x +item.endX)/Store.zoomRatio,
(pos_y+ item.endY)/Store.zoomRatio
);
ctx.lineWidth = 1;
ctx.strokeStyle = ctx.fillStyle;
ctx.stroke();
ctx.closePath();
}
}
}
// 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)
Expand Down
Loading

0 comments on commit d3f23ff

Please sign in to comment.