From a0ebe6793ede085fa160a94046ff642810dd826a Mon Sep 17 00:00:00 2001 From: wilckerson Date: Sun, 19 May 2024 23:40:33 -0700 Subject: [PATCH] Adding click and play note for lattice Fix --- src/components/GridLattice.vue | 23 ++++++ src/components/JustIntonationLattice.vue | 26 ++++++- src/views/LatticeView.vue | 89 ++++++++++++++++++++++++ 3 files changed, 137 insertions(+), 1 deletion(-) diff --git a/src/components/GridLattice.vue b/src/components/GridLattice.vue index 30ec36e9..b569264f 100644 --- a/src/components/GridLattice.vue +++ b/src/components/GridLattice.vue @@ -12,7 +12,16 @@ const props = defineProps<{ labels: string[] colors: string[] heldNotes: Set + baseMidiNote:number + onTouchStart:TouchEventCallback + onTouchEnd:TouchEventCallback + onMouseDown:MouseEventCallback + onMouseUp:MouseEventCallback + onMouseEnter:MouseEventCallback + onMouseLeave:MouseEventCallback }>() +type TouchEventCallback = (event: TouchEvent, index: number) => void +type MouseEventCallback = (event: MouseEvent, index: number) => void const svgElement = ref(null) @@ -127,6 +136,13 @@ watch(() => store.modulus, computeExtent) :fill="colors[v.indices[0]] ?? 'none'" :stroke="colors[v.indices[0]] ?? 'none'" :stroke-width="store.size * 0.1" + @touchstart="onTouchStart($event, props.baseMidiNote + v.indices[0] + 1)" + @touchend="onTouchEnd($event, props.baseMidiNote + v.indices[0] + 1)" + @touchcancel="onTouchEnd($event, props.baseMidiNote + v.indices[0] + 1)" + @mousedown="onMouseDown($event, props.baseMidiNote + v.indices[0] + 1)" + @mouseup="onMouseUp($event, props.baseMidiNote + v.indices[0] + 1)" + @mouseenter="onMouseEnter($event, props.baseMidiNote + v.indices[0] + 1)" + @mouseleave="onMouseLeave($event, props.baseMidiNote + v.indices[0] + 1)" />