Skip to content

Commit

Permalink
props
Browse files Browse the repository at this point in the history
  • Loading branch information
CarelessCourage committed Feb 4, 2024
1 parent 89a47d6 commit dfee148
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/dye/composables/canvas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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))
})

Expand Down

0 comments on commit dfee148

Please sign in to comment.