refactor: simplify zoom by removing zoom.translation
(#4477)
This commit is contained in:
@ -227,10 +227,7 @@ export const renderScene = (
|
||||
}
|
||||
|
||||
// Apply zoom
|
||||
const zoomTranslationX = renderConfig.zoom.translation.x;
|
||||
const zoomTranslationY = renderConfig.zoom.translation.y;
|
||||
context.save();
|
||||
context.translate(zoomTranslationX, zoomTranslationY);
|
||||
context.scale(renderConfig.zoom.value, renderConfig.zoom.value);
|
||||
|
||||
// Grid
|
||||
@ -238,14 +235,10 @@ export const renderScene = (
|
||||
strokeGrid(
|
||||
context,
|
||||
appState.gridSize,
|
||||
-Math.ceil(
|
||||
zoomTranslationX / renderConfig.zoom.value / appState.gridSize,
|
||||
) *
|
||||
-Math.ceil(renderConfig.zoom.value / appState.gridSize) *
|
||||
appState.gridSize +
|
||||
(renderConfig.scrollX % appState.gridSize),
|
||||
-Math.ceil(
|
||||
zoomTranslationY / renderConfig.zoom.value / appState.gridSize,
|
||||
) *
|
||||
-Math.ceil(renderConfig.zoom.value / appState.gridSize) *
|
||||
appState.gridSize +
|
||||
(renderConfig.scrollY % appState.gridSize),
|
||||
normalizedCanvasWidth / renderConfig.zoom.value,
|
||||
|
Reference in New Issue
Block a user