diff --git a/packages/s2-core/src/sheet-type/spread-sheet.ts b/packages/s2-core/src/sheet-type/spread-sheet.ts index cecf97dd5e..b1991c8938 100644 --- a/packages/s2-core/src/sheet-type/spread-sheet.ts +++ b/packages/s2-core/src/sheet-type/spread-sheet.ts @@ -98,7 +98,7 @@ export abstract class SpreadSheet extends EE { /** * 表格是否已销毁 */ - private destroyed = false; + public destroyed = false; protected abstract bindEvents(): void; diff --git a/packages/s2-core/src/ui/hd-adapter/index.ts b/packages/s2-core/src/ui/hd-adapter/index.ts index 438e438cff..9bb2dac7b1 100644 --- a/packages/s2-core/src/ui/hd-adapter/index.ts +++ b/packages/s2-core/src/ui/hd-adapter/index.ts @@ -21,8 +21,6 @@ export class HdAdapter { private zoomOffsetLeft: number | undefined; - private destroyed: boolean = false; - constructor(spreadsheet: SpreadSheet) { this.spreadsheet = spreadsheet; } @@ -33,7 +31,6 @@ export class HdAdapter { }; public destroy = () => { - this.destroyed = true; this.removeDevicePixelRatioListener(); this.removeDeviceZoomListener(); }; @@ -113,7 +110,7 @@ export class HdAdapter { private renderByDevicePixelRatio = async ( ratio = window.devicePixelRatio, ) => { - if (this.destroyed) { + if (this.spreadsheet.destroyed) { return; } @@ -137,7 +134,7 @@ export class HdAdapter { }; private renderByZoomScale = debounce(async (event: Event) => { - if (this.destroyed) { + if (this.spreadsheet.destroyed) { return; }