From dfee148580666100635646dabf771b4ed5891553 Mon Sep 17 00:00:00 2001 From: "Samuel M. Bednarz" Date: Sun, 4 Feb 2024 03:07:30 +0100 Subject: [PATCH] props --- packages/dye/composables/canvas.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/dye/composables/canvas.ts b/packages/dye/composables/canvas.ts index 37333cc..df4e83f 100644 --- a/packages/dye/composables/canvas.ts +++ b/packages/dye/composables/canvas.ts @@ -59,8 +59,12 @@ watch(pressed, (value: boolean) => { mousedown.value = value }) -export function outsideCanvas(props: { canvas: RefCanvas; updateCanvas: posFunc }) { - const { canvas, updateCanvas } = props +interface OCP { + canvas: RefCanvas + updateCanvas: posFunc +} + +export function outsideCanvas({ canvas, updateCanvas }: OCP) { const mouseOn = ref(false) function condition() { @@ -73,6 +77,7 @@ export function outsideCanvas(props: { canvas: RefCanvas; updateCanvas: posFunc const posPixel = computed(() => ({ x: x.value, y: y.value })) watch(posPixel, (pos) => { if (!condition() && canvas.value) return + console.log('outside', clampedPos(pos)) updateCanvas(clampedPos(pos)) })