fix(ui): background rendering

This commit is contained in:
psychedelicious 2024-07-04 13:20:25 +10:00
parent 7728ca6843
commit 662c5f4b77
3 changed files with 5 additions and 6 deletions

View File

@ -38,7 +38,7 @@ export class CanvasBackground {
this.layer = new Konva.Layer({ listening: false }); this.layer = new Konva.Layer({ listening: false });
} }
renderBackground() { render() {
this.layer.zIndex(0); this.layer.zIndex(0);
const scale = this.manager.stage.scaleX(); const scale = this.manager.stage.scaleX();
const gridSpacing = getGridSpacing(scale); const gridSpacing = getGridSpacing(scale);

View File

@ -464,7 +464,7 @@ export const setStageEventHandlers = (manager: KonvaNodeManager): (() => void) =
stage.scaleY(newScale); stage.scaleY(newScale);
stage.position(newPos); stage.position(newPos);
setStageAttrs({ ...newPos, width: stage.width(), height: stage.height(), scale: newScale }); setStageAttrs({ ...newPos, width: stage.width(), height: stage.height(), scale: newScale });
manager.preview.tool.render(); manager.background.render();
manager.preview.documentSizeOverlay.render(); manager.preview.documentSizeOverlay.render();
} }
} }
@ -480,7 +480,7 @@ export const setStageEventHandlers = (manager: KonvaNodeManager): (() => void) =
height: stage.height(), height: stage.height(),
scale: stage.scaleX(), scale: stage.scaleX(),
}); });
manager.preview.tool.render(); manager.background.render();
manager.preview.documentSizeOverlay.render(); manager.preview.documentSizeOverlay.render();
manager.preview.tool.render(); manager.preview.tool.render();
}); });
@ -521,8 +521,7 @@ export const setStageEventHandlers = (manager: KonvaNodeManager): (() => void) =
setLastCursorPos(null); setLastCursorPos(null);
setLastMouseDownPos(null); setLastMouseDownPos(null);
manager.preview.documentSizeOverlay.fitToStage(); manager.preview.documentSizeOverlay.fitToStage();
manager.preview.tool.render(); manager.background.render();
manager.preview.documentSizeOverlay.render(); manager.preview.documentSizeOverlay.render();
} }
manager.preview.tool.render(); manager.preview.tool.render();

View File

@ -199,7 +199,7 @@ export class KonvaNodeManager {
height: this.stage.height(), height: this.stage.height(),
scale: this.stage.scaleX(), scale: this.stage.scaleX(),
}); });
this.background.renderBackground(); this.background.render();
this.preview.documentSizeOverlay.render(); this.preview.documentSizeOverlay.render();
} }