Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(sheet): render viewport wrong size #1727

Draft
wants to merge 13 commits into
base: dev
Choose a base branch
from
Prev Previous commit
Next Next commit
fix: blurry when applyCache especially in windows 175%
  • Loading branch information
lumixraku committed May 24, 2024
commit a3111e4e042558cace922b1a96d292576f2a57b5
5 changes: 3 additions & 2 deletions packages/engine-render/src/components/sheets/spreadsheet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ export class Spreadsheet extends SheetComponent {
// support for browser native zoom
const sourceLeft = bufferEdgeSizeX * Math.min(1, window.devicePixelRatio);
const sourceTop = bufferEdgeSizeY * Math.min(1, window.devicePixelRatio);
this._applyCacheFreeze(mainCtx, cacheCanvas, sourceLeft, sourceTop, dw, dh, left, top, dw, dh);
this._applyCache(mainCtx, cacheCanvas, sourceLeft, sourceTop, dw, dh, left, top, dw, dh);
cacheCtx.restore();
}

Expand Down Expand Up @@ -436,7 +436,7 @@ export class Spreadsheet extends SheetComponent {
* @param dh
* @returns
*/
protected _applyCacheFreeze(
protected _applyCache(
ctx: UniverRenderingContext,
cacheCanvas: Canvas,
sx: number = 0,
Expand All @@ -459,6 +459,7 @@ export class Spreadsheet extends SheetComponent {
ctx.save();
ctx.setTransform(1, 0, 0, 1, 0, 0);
cacheCtx.setTransform(1, 0, 0, 1, 0, 0);
ctx.imageSmoothingEnabled = false;
ctx.drawImage(
cacheCanvas.getCanvasEle(),
sx * pixelRatio,
Expand Down