Compare commits

...
3 changed files with 25 additions and 8 deletions
+4
View File
@@ -3,6 +3,10 @@ on:
pull_request: pull_request:
branches: branches:
- master - master
permissions:
pull-requests: read
jobs: jobs:
size: size:
runs-on: ubuntu-latest runs-on: ubuntu-latest
+19 -4
View File
@@ -37,10 +37,25 @@ const StaticCanvas = (props: StaticCanvasProps) => {
canvas.classList.add("excalidraw__canvas", "static"); canvas.classList.add("excalidraw__canvas", "static");
} }
canvas.style.width = `${props.appState.width}px`; const widthString = `${props.appState.width}px`;
canvas.style.height = `${props.appState.height}px`; const heightString = `${props.appState.height}px`;
canvas.width = props.appState.width * props.scale; if (canvas.style.width !== widthString) {
canvas.height = props.appState.height * props.scale; canvas.style.width = widthString;
}
if (canvas.style.height !== heightString) {
canvas.style.height = heightString;
}
const scaledWidth = props.appState.width * props.scale;
const scaledHeight = props.appState.height * props.scale;
// setting width/height resets the canvas even if dimensions not changed,
// which would cause flicker when we skip frame (due to throttling)
if (canvas.width !== scaledWidth) {
canvas.width = scaledWidth;
}
if (canvas.height !== scaledHeight) {
canvas.height = scaledHeight;
}
renderStaticScene( renderStaticScene(
{ {
+2 -4
View File
@@ -934,10 +934,8 @@ const _renderStaticScene = ({
strokeGrid( strokeGrid(
context, context,
appState.gridSize, appState.gridSize,
-Math.ceil(appState.zoom.value / appState.gridSize) * appState.gridSize + appState.scrollX,
(appState.scrollX % appState.gridSize), appState.scrollY,
-Math.ceil(appState.zoom.value / appState.gridSize) * appState.gridSize +
(appState.scrollY % appState.gridSize),
appState.zoom, appState.zoom,
normalizedWidth / appState.zoom.value, normalizedWidth / appState.zoom.value,
normalizedHeight / appState.zoom.value, normalizedHeight / appState.zoom.value,