Fixed some render bugs
This commit is contained in:
parent
ca67d409d5
commit
8aed4c81b9
|
|
@ -66,6 +66,7 @@ export class Editor {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.hide();
|
this.hide();
|
||||||
|
this.root.renderSelection()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ export class Sheet {
|
||||||
this.root.data[row][column].render(this.root);
|
this.root.data[row][column].render(this.root);
|
||||||
}
|
}
|
||||||
|
|
||||||
getSelectionRange() {
|
private getSelectionRange() {
|
||||||
const { selectedCell, selectedRange } = this.root.selection
|
const { selectedCell, selectedRange } = this.root.selection
|
||||||
|
|
||||||
if (!selectedCell && !selectedRange) return;
|
if (!selectedCell && !selectedRange) return;
|
||||||
|
|
@ -85,7 +85,7 @@ export class Sheet {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
renderSelectionRange(x: number, y: number, width: number, height: number) {
|
private renderSelectionRange(x: number, y: number, width: number, height: number) {
|
||||||
|
|
||||||
this.ctx.save()
|
this.ctx.save()
|
||||||
this.ctx.strokeStyle = '#47d1ff'
|
this.ctx.strokeStyle = '#47d1ff'
|
||||||
|
|
@ -97,6 +97,13 @@ export class Sheet {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
renderSelection() {
|
||||||
|
const box = this.getSelectionRange()
|
||||||
|
if (!box) return;
|
||||||
|
const {height, width, x, y} = box
|
||||||
|
this.renderSelectionRange(x, y, width, height)
|
||||||
|
}
|
||||||
|
|
||||||
renderSheet() {
|
renderSheet() {
|
||||||
const firstRowIdx = this.root.viewport.firstRow;
|
const firstRowIdx = this.root.viewport.firstRow;
|
||||||
const lastColIdx = this.root.viewport.lastCol + 3;
|
const lastColIdx = this.root.viewport.lastCol + 3;
|
||||||
|
|
@ -112,10 +119,7 @@ export class Sheet {
|
||||||
this.renderCell({ column: col, row });
|
this.renderCell({ column: col, row });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.renderSelection()
|
||||||
|
|
||||||
const box = this.getSelectionRange()
|
|
||||||
if (!box) return;
|
|
||||||
const {height, width, x, y} = box
|
|
||||||
this.renderSelectionRange(x, y, width, height)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -315,6 +315,10 @@ export default class Spreadsheet {
|
||||||
this.sheet.renderSheet();
|
this.sheet.renderSheet();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
renderSelection() {
|
||||||
|
this.sheet.renderSelection();
|
||||||
|
}
|
||||||
|
|
||||||
renderColumnsBar() {
|
renderColumnsBar() {
|
||||||
this.columnsBar.renderBar();
|
this.columnsBar.renderBar();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ export class Clipboard {
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error("Cannot read clipboard. ", err);
|
console.error("Cannot read clipboard. ", err);
|
||||||
}
|
}
|
||||||
|
root.renderSheet()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue