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
chore(render): update (#2853)
Univer5da723d6c2a5
diff --git a/packages/engine-render/src/canvas.ts b/packages/engine-render/src/canvas.tsindex 4c51825416..f6e1bd5ea1 100644--- a/packages/engine-render/src/canvas.ts+++ b/packages/engine-render/src/canvas.ts@@ -130,18 +130,20 @@ export class Canvas {// this.setWidth(width || 0);// this.setHeight(height || 0);this._pixelRatio = pixelRatioParam || getDevicePixelRatio();- const canvsElement = this.getCanvasEle();+ const canvasElement = this.getCanvasEle();- if (canvsElement && width !== undefined) {- canvsElement.width = width * this._pixelRatio;- this._width = canvsElement.width / this._pixelRatio;- canvsElement.style.width = `${this._width}px`;+ if (canvasElement && width !== undefined) {+ // canvasElement.width does not allow decimals, so alignment is required. If not done, it will cause the canvas rendering to appear blurry.+ canvasElement.width = width * this._pixelRatio;+ this._width = canvasElement.width / this._pixelRatio;+ canvasElement.style.width = `${this._width}px`;}- if (canvsElement && height !== undefined) {- canvsElement.height = height * this._pixelRatio;- this._height = canvsElement.height / this._pixelRatio;- canvsElement.style.height = `${this._height}px`;+ if (canvasElement && height !== undefined) {+ // canvasElement.width does not allow decimals, so alignment is required. If not done, it will cause the canvas rendering to appear blurry.+ canvasElement.height = height * this._pixelRatio;+ this._height = canvasElement.height / this._pixelRatio;+ canvasElement.style.height = `${this._height}px`;}this.getContext()?.setTransform(this._pixelRatio, 0, 0, this._pixelRatio, 0, 0);