Skip to content

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.

fix: render error after scale (#1015)

Ran Luocd7b740c4dac
diff --git a/packages/engine-render/src/components/docs/document.ts b/packages/engine-render/src/components/docs/document.ts
index a5c580b016..724795c4c8 100644
--- a/packages/engine-render/src/components/docs/document.ts
+++ b/packages/engine-render/src/components/docs/document.ts
@@ -234,20 +234,20 @@ export class Documents extends DocComponent {
} = renderConfig;
const horizontalOffsetNoAngle = this._horizontalHandler(
- actualWidth * scale,
- pagePaddingLeft * scale,
- pagePaddingRight * scale,
+ actualWidth,
+ pagePaddingLeft,
+ pagePaddingRight,
horizontalAlign
);
const verticalOffsetNoAngle = this._verticalHandler(
- actualHeight * scale,
- pagePaddingTop * scale,
- pagePaddingBottom * scale,
+ actualHeight,
+ pagePaddingTop,
+ pagePaddingBottom,
verticalAlign
);
- const alignOffsetNoAngle = Vector2.create(horizontalOffsetNoAngle / scale, verticalOffsetNoAngle / scale);
+ const alignOffsetNoAngle = Vector2.create(horizontalOffsetNoAngle, verticalOffsetNoAngle);
const centerAngle = degToRad(centerAngleDeg);
diff --git a/packages/sheets-ui/src/controllers/editor/start-edit.controller.ts b/packages/sheets-ui/src/controllers/editor/start-edit.controller.ts
index 8f62241f27..075a0dd282 100644
--- a/packages/sheets-ui/src/controllers/editor/start-edit.controller.ts
+++ b/packages/sheets-ui/src/controllers/editor/start-edit.controller.ts
@@ -382,20 +382,20 @@ export class StartEditController extends Disposable {
startY -= FIX_ONE_PIXEL_BLUR_OFFSET;
- physicHeight = editorHeight;
-
- this._addBackground(scene, editorWidth / scaleX, editorHeight / scaleY, fill);
+ // physicHeight = editorHeight;
this._addBackground(scene, editorWidth / scaleX, editorHeight / scaleY, fill);
const { scaleX: precisionScaleX, scaleY: precisionScaleY } = scene.getPrecisionScale();
scene.transformByState({
- width: editorWidth,
- height: editorHeight,
+ width: editorWidth / scaleX,
+ height: editorHeight / scaleY,
+ scaleX,
+ scaleY,
});
- documentComponent.resize(editorWidth, editorHeight);
+ documentComponent.resize(editorWidth / scaleX, editorHeight / scaleY);
/**
* resize canvas