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

Commit

Permalink
fix(hide row and column fix): add lines
Browse files Browse the repository at this point in the history
  • Loading branch information
DR-Univer committed Aug 30, 2020
1 parent f07e25d commit c430d66
Showing 1 changed file with 105 additions and 27 deletions.
132 changes: 105 additions & 27 deletions src/global/draw.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function luckysheetDrawgridRowTitle(scrollHeight, drawHeight, offsetTop) {

let end_r, start_r;
let bodrder05 = 0.5;//Default 0.5

let preEndR;
for (let r = dataset_row_st; r <= dataset_row_ed; r++) {
if (r == 0) {
start_r = -scrollHeight - 1;
Expand Down Expand Up @@ -123,19 +123,55 @@ function luckysheetDrawgridRowTitle(scrollHeight, drawHeight, offsetTop) {
luckysheetTableContent.closePath();

//行标题栏横线,horizen
luckysheetTableContent.beginPath();
luckysheetTableContent.moveTo(
-1,
(end_r + offsetTop - 2 + bodrder05)
);
luckysheetTableContent.lineTo(
(Store.rowHeaderWidth - 1) ,
(end_r + offsetTop - 2 + bodrder05)
);
// luckysheetTableContent.lineWidth = 1;
// luckysheetTableContent.strokeStyle = luckysheetdefaultstyle.strokeStyle;
luckysheetTableContent.closePath();
luckysheetTableContent.stroke();
if (Store.config["rowhidden"] != null && Store.config["rowhidden"][r] == null && Store.config["rowhidden"][r+1] != null) {
luckysheetTableContent.beginPath();
luckysheetTableContent.moveTo(
-1,
(end_r + offsetTop - 4 + bodrder05)
);
luckysheetTableContent.lineTo(
(Store.rowHeaderWidth - 1) ,
(end_r + offsetTop - 4 + bodrder05)
);
// luckysheetTableContent.lineWidth = 1;
// luckysheetTableContent.strokeStyle = luckysheetdefaultstyle.strokeStyle;
luckysheetTableContent.closePath();
luckysheetTableContent.stroke();
}
else if(Store.config["rowhidden"]==null || Store.config["rowhidden"][r] == null){
luckysheetTableContent.beginPath();
luckysheetTableContent.moveTo(
-1,
(end_r + offsetTop - 2 + bodrder05)
);
luckysheetTableContent.lineTo(
(Store.rowHeaderWidth - 1) ,
(end_r + offsetTop - 2 + bodrder05)
);

// luckysheetTableContent.lineWidth = 1;
// luckysheetTableContent.strokeStyle = luckysheetdefaultstyle.strokeStyle;
luckysheetTableContent.closePath();
luckysheetTableContent.stroke();

}

if (Store.config["rowhidden"] != null && Store.config["rowhidden"][r-1] != null && preEndR!=null) {
luckysheetTableContent.beginPath();
luckysheetTableContent.moveTo(
-1,
(preEndR + offsetTop + bodrder05)
);
luckysheetTableContent.lineTo(
(Store.rowHeaderWidth - 1) ,
(preEndR + offsetTop + bodrder05)
);
luckysheetTableContent.closePath();
luckysheetTableContent.stroke();
}

preEndR = end_r;

}

//行标题栏竖线
Expand Down Expand Up @@ -210,6 +246,7 @@ function luckysheetDrawgridColumnTitle(scrollWidth, drawWidth, offsetLeft) {

let end_c, start_c;
let bodrder05 = 0.5;//Default 0.5
let preEndC;
for (let c = dataset_col_st; c <= dataset_col_ed; c++) {
if (c == 0) {
start_c = -scrollWidth;
Expand Down Expand Up @@ -252,19 +289,54 @@ function luckysheetDrawgridColumnTitle(scrollWidth, drawWidth, offsetLeft) {
}

//列标题栏竖线 vertical
luckysheetTableContent.beginPath();
luckysheetTableContent.moveTo(
(end_c + offsetLeft - 2 + bodrder05) ,
0
);
luckysheetTableContent.lineTo(
(end_c + offsetLeft - 2 + bodrder05) ,
(Store.columeHeaderHeight - 2)
);
luckysheetTableContent.lineWidth = 1;
luckysheetTableContent.strokeStyle = luckysheetdefaultstyle.strokeStyle;
luckysheetTableContent.closePath();
luckysheetTableContent.stroke();
if (Store.config["colhidden"] != null && Store.config["colhidden"][c] == null && Store.config["colhidden"][c+1] != null) {
luckysheetTableContent.beginPath();
luckysheetTableContent.moveTo(
(end_c + offsetLeft - 4 + bodrder05) ,
0
);
luckysheetTableContent.lineTo(
(end_c + offsetLeft - 4 + bodrder05) ,
(Store.columeHeaderHeight - 2)
);
luckysheetTableContent.lineWidth = 1;
luckysheetTableContent.strokeStyle = luckysheetdefaultstyle.strokeStyle;
luckysheetTableContent.closePath();
luckysheetTableContent.stroke();
}
else if(Store.config["colhidden"]==null || Store.config["colhidden"][c] == null) {
luckysheetTableContent.beginPath();
luckysheetTableContent.moveTo(
(end_c + offsetLeft - 2 + bodrder05) ,
0
);
luckysheetTableContent.lineTo(
(end_c + offsetLeft - 2 + bodrder05) ,
(Store.columeHeaderHeight - 2)
);

luckysheetTableContent.lineWidth = 1;
luckysheetTableContent.strokeStyle = luckysheetdefaultstyle.strokeStyle;
luckysheetTableContent.closePath();
luckysheetTableContent.stroke();
}

if (Store.config["colhidden"] != null && Store.config["colhidden"][c-1] != null && preEndC!=null) {
luckysheetTableContent.beginPath();
luckysheetTableContent.moveTo(
(preEndC + offsetLeft + bodrder05) ,
0
);
luckysheetTableContent.lineTo(
(preEndC + offsetLeft + bodrder05) ,
(Store.columeHeaderHeight - 2)
);
// luckysheetTableContent.lineWidth = 1;
// luckysheetTableContent.strokeStyle = luckysheetdefaultstyle.strokeStyle;
luckysheetTableContent.closePath();
luckysheetTableContent.stroke();
}


//horizen
luckysheetTableContent.beginPath();
Expand All @@ -281,6 +353,8 @@ function luckysheetDrawgridColumnTitle(scrollWidth, drawWidth, offsetLeft) {
// luckysheetTableContent.strokeStyle = luckysheetdefaultstyle.strokeStyle;
luckysheetTableContent.stroke();
luckysheetTableContent.closePath();

preEndC = end_c;
}

//列标题栏横线
Expand Down Expand Up @@ -2086,6 +2160,10 @@ function getCellOverflowMap(canvas, col_st, col_ed, row_st, row_end){
for(let c = 0; c < data[r].length; c++){
let cell = data[r][c];

if (Store.config["colhidden"] != null && Store.config["colhidden"][c] != null) {
continue
}

if(cell != null && !isRealNull(cell.v) && cell.mc == null && cell.tb == '1'){
let fontset = luckysheetfontformat(cell);
canvas.font = fontset;
Expand Down

0 comments on commit c430d66

Please sign in to comment.