Skip to content

Commit 9567631

Browse files
committed
fix(front): fix placing a pixel when moving the canvas with space
Closes #1
1 parent 11dd3cd commit 9567631

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

frontend/src/components/Canvas.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const canvasStore = useCanvasStore();
1717
const authStore = useAccountStore();
1818
const api = useApi();
1919
const { initializeCanvas, drawCanvas } = useCanvas();
20-
useCanvasControls(canvasContainer);
20+
const { isSpacedPressed } = useCanvasControls(canvasContainer);
2121
const { connectToGateway, place } = useCanvasGateway();
2222
2323
function onWindowResize() {
@@ -43,6 +43,7 @@ watch(
4343
4444
function handleClick(event: PointerEvent): void {
4545
if (!authStore.connected) return;
46+
if (isSpacedPressed.value) return;
4647
4748
const canvas = event.target as HTMLCanvasElement;
4849
const rect = canvas.getBoundingClientRect();

frontend/src/composables/useCanvasControls.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,6 @@ export function useCanvasControls(container: Ref<HTMLDivElement | null>) {
9191
controls.removeEventListener('mouseleave', handleMouseUp);
9292
controls.removeEventListener('wheel', handleWheel);
9393
});
94+
95+
return { isSpacedPressed };
9496
}

0 commit comments

Comments
 (0)