Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.
TypeScript boardcollaborationdocdocxexceloffce365officepdfpptpptxpresentationsdksheetslidesspreadsheetuniverwordwordprocessorworkspacexlsx
fix(sheet): resize window viewport error (#984)
Univerc1642f1ff6a6
diff --git a/packages/engine-render/src/viewport.ts b/packages/engine-render/src/viewport.tsindex 707e6acaaf..2c664c1e89 100644--- a/packages/engine-render/src/viewport.ts+++ b/packages/engine-render/src/viewport.ts@@ -184,10 +184,6 @@ export class Viewport {this._isWheelPreventDefaultY = props?.isWheelPreventDefaultY || false;this._resizeCacheCanvasAndScrollBar();-- this._scene?.getParent().onTransformChangeObservable.add(() => {- this._resizeCacheCanvasAndScrollBar();- });}get scene() {@@ -771,13 +767,26 @@ export class Viewport {}private _resizeCacheCanvasAndScrollBar() {+ const actualScrollX = this.actualScrollX;++ const actualScrollY = this.actualScrollY;+const { width, height } = this._getViewPortSize();const contentWidth = (this._scene.width - this._paddingEndX) * this._scene.scaleX;const contentHeight = (this._scene.height - this._paddingEndY) * this._scene.scaleY;- this._scrollBar?.resize(width, height, contentWidth, contentHeight);+ if (this._scrollBar) {+ this._scrollBar.resize(width, height, contentWidth, contentHeight);++ const { x, y } = this.getBarScroll(actualScrollX, actualScrollY);++ this.scrollTo({+ x,+ y,+ });+ }this.makeDirty(true);}