From da484bb7ed86d8a5929a2c6582200333abb25b3d Mon Sep 17 00:00:00 2001 From: linwrui Date: Fri, 8 Nov 2024 14:50:56 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20spreadsheet.destroyed=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=20public?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/s2-core/src/sheet-type/spread-sheet.ts | 2 +- packages/s2-core/src/ui/hd-adapter/index.ts | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) 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; }