Fixed bugs in Chrome browser
Fixed on load data config listeners reassigning
This commit is contained in:
parent
cddfc134f8
commit
c26c166295
|
|
@ -103,10 +103,10 @@ export class Sheet {
|
|||
height: number,
|
||||
) {
|
||||
this.ctx.save();
|
||||
this.ctx.strokeStyle = "#47d1ff";
|
||||
this.ctx.strokeStyle = "#7da8ff";
|
||||
this.ctx.lineWidth = 3;
|
||||
this.ctx.strokeRect(x, y, width, height);
|
||||
this.ctx.fillStyle = "#7da8ff50";
|
||||
this.ctx.fillStyle = "#7da8ff35";
|
||||
this.ctx.fillRect(x, y, width, height);
|
||||
this.ctx.restore();
|
||||
}
|
||||
|
|
@ -124,6 +124,7 @@ export class Sheet {
|
|||
const lastRowIdx = this.root.viewport.lastRow + 3;
|
||||
const firstColIdx = this.root.viewport.firstCol;
|
||||
|
||||
|
||||
for (let row = firstRowIdx; row <= lastRowIdx; row++) {
|
||||
for (let col = firstColIdx; col <= lastColIdx; col++) {
|
||||
if (!this.root.config.columns[col] || !this.root.config.rows[row])
|
||||
|
|
|
|||
10
src/main.ts
10
src/main.ts
|
|
@ -331,7 +331,6 @@ export default class Spreadsheet {
|
|||
public loadData(data: Cell[][] | SerializableCell[][]): Spreadsheet {
|
||||
const rowsLength = data.length;
|
||||
const colsLength = data[0] ? data[0].length : 0;
|
||||
console.log("!!FORMATTED DATA", rowsLength, colsLength, data[0])
|
||||
this.data = [];
|
||||
|
||||
const formattedData: Cell[][] = [];
|
||||
|
|
@ -353,12 +352,17 @@ export default class Spreadsheet {
|
|||
formattedData.push(innerRow);
|
||||
}
|
||||
|
||||
const config = this.makeConfigFromData(formattedData, this.config.view);
|
||||
config.onCellChange = this.config.onCellChange
|
||||
config.onCellClick = this.config.onCellClick
|
||||
config.onCopy = this.config.onCopy
|
||||
config.onSelectonChange = this.config.onSelectonChange
|
||||
|
||||
|
||||
this.data = formattedData;
|
||||
|
||||
this.selection.selectedCell = null;
|
||||
this.selection.selectedRange = null;
|
||||
this.config = this.makeConfigFromData(formattedData, this.config.view);
|
||||
this.config = config
|
||||
this.cache = this.getInitialCache();
|
||||
this.scroller.updateScrollerSize();
|
||||
this.viewport = new Viewport(
|
||||
|
|
|
|||
|
|
@ -44,21 +44,21 @@ export class Cache {
|
|||
public getRowByYCoord(y: number): number {
|
||||
let rowIdx = 0;
|
||||
for (let i = 0; i < this.rows.length; i++) {
|
||||
if (y <= this.rows[i].yPos) {
|
||||
//* Intersection detect
|
||||
rowIdx = i;
|
||||
rowIdx = i
|
||||
if (y <= this.rows[i].yPos) { //* Intersection detect
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return rowIdx;
|
||||
}
|
||||
|
||||
public getColumnByXCoord(x: number): number {
|
||||
let colIdx = 0;
|
||||
for (let i = 0; i < this.columns.length; i++) {
|
||||
if (x <= this.columns[i].xPos) {
|
||||
//* Intersection detect
|
||||
colIdx = i;
|
||||
colIdx = i
|
||||
if (x <= this.columns[i].xPos) { //* Intersection detect
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue