ADD: Update LEDRing on angle update
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed } from 'vue'
|
import { ref, computed, watch } from 'vue'
|
||||||
|
|
||||||
const model = defineModel({ type: Number, default: 60 })
|
const model = defineModel({ type: Number, default: 60 })
|
||||||
|
|
||||||
@@ -8,7 +8,8 @@ const bar = ref(null)
|
|||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
width: { type: Number, default: 160 },
|
width: { type: Number, default: 160 },
|
||||||
count: { type: Number, default: 40 },
|
count: { type: Number, default: 40 },
|
||||||
gapWidth: { type: Number, default: 2 }
|
gapWidth: { type: Number, default: 2 },
|
||||||
|
value: { type: Number, default: 0 }
|
||||||
})
|
})
|
||||||
|
|
||||||
const rectWidth = computed(() => {
|
const rectWidth = computed(() => {
|
||||||
@@ -35,6 +36,10 @@ function onMouseUp() {
|
|||||||
window.removeEventListener('mousemove', onMouseMove)
|
window.removeEventListener('mousemove', onMouseMove)
|
||||||
window.removeEventListener('mouseup', onMouseUp)
|
window.removeEventListener('mouseup', onMouseUp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
watch(props.value, (value) => {
|
||||||
|
model.value = value
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|||||||
@@ -48,9 +48,9 @@
|
|||||||
class="absolute flex flex-col items-center pb-2 text-center mix-blend-screen"
|
class="absolute flex flex-col items-center pb-2 text-center mix-blend-screen"
|
||||||
>
|
>
|
||||||
<img :src="LogoMidi" alt="midi-logo" class="h-4 opacity-50" />
|
<img :src="LogoMidi" alt="midi-logo" class="h-4 opacity-50" />
|
||||||
<h2 class="font-pixellg text-5xl">{{ parseInt(value) }}</h2>
|
<h2 class="font-pixellg text-5xl">{{ parseInt(barValue - store.turns * 100) }}</h2>
|
||||||
<div class="font-pixelsm text-md">HIGH PASS</div>
|
<div class="font-pixelsm text-md">HIGH PASS</div>
|
||||||
<DeviceBar v-model="barValue" :count="30" :width="120" />
|
<DeviceBar :value="barValue" :count="30" :width="120" />
|
||||||
<span class="font-pixelsm w-36 text-[7pt] uppercase text-muted-foreground">
|
<span class="font-pixelsm w-36 text-[7pt] uppercase text-muted-foreground">
|
||||||
KORG MINILOGUE HIGH PASS FILTER 0-127
|
KORG MINILOGUE HIGH PASS FILTER 0-127
|
||||||
</span>
|
</span>
|
||||||
@@ -98,17 +98,14 @@ import LogoMidi from '@renderer/assets/logos/logoMidi.svg'
|
|||||||
import DeviceBar from '@renderer/components/device/DeviceBar.vue'
|
import DeviceBar from '@renderer/components/device/DeviceBar.vue'
|
||||||
import { useStore } from '@renderer/store'
|
import { useStore } from '@renderer/store'
|
||||||
import ScrambleText from '@renderer/components/common/ScrambleText.vue'
|
import ScrambleText from '@renderer/components/common/ScrambleText.vue'
|
||||||
import { computed, onMounted, ref } from 'vue'
|
import { computed, ref } from 'vue'
|
||||||
import DeviceLEDRing from '@renderer/components/device/DeviceLEDRing.vue'
|
import DeviceLEDRing from '@renderer/components/device/DeviceLEDRing.vue'
|
||||||
import gsap from 'gsap'
|
|
||||||
import DeviceKeys from '@renderer/components/device/DeviceKeys.vue'
|
import DeviceKeys from '@renderer/components/device/DeviceKeys.vue'
|
||||||
|
|
||||||
const value = ref(69)
|
|
||||||
|
|
||||||
const barValue = computed(() => (value.value / 127) * 100)
|
|
||||||
|
|
||||||
const store = useStore()
|
const store = useStore()
|
||||||
|
|
||||||
|
const barValue = computed(() => 100 - (store.angle / Math.PI / 2) * 100)
|
||||||
|
|
||||||
const previewDeviceImages = {
|
const previewDeviceImages = {
|
||||||
nanoOne: RenderNanoOne,
|
nanoOne: RenderNanoOne,
|
||||||
nanoZero: RenderNanoZero
|
nanoZero: RenderNanoZero
|
||||||
@@ -118,13 +115,6 @@ const previewDeviceImage = computed(
|
|||||||
() => previewDeviceImages[store.previewDeviceModel || 'nanoOne']
|
() => previewDeviceImages[store.previewDeviceModel || 'nanoOne']
|
||||||
)
|
)
|
||||||
|
|
||||||
const targetValue = ref(69)
|
|
||||||
const animateValue = () => {
|
|
||||||
targetValue.value = Math.floor(Math.random() * 127)
|
|
||||||
gsap.to(value, { duration: 1, value: targetValue.value, ease: 'power2.inOut' })
|
|
||||||
setTimeout(animateValue, 1500 + Math.random() * 2000)
|
|
||||||
}
|
|
||||||
|
|
||||||
const offlineText = ref('NO DEVICE CONNECTED')
|
const offlineText = ref('NO DEVICE CONNECTED')
|
||||||
const offlineTexts = [
|
const offlineTexts = [
|
||||||
'AWAITING CONNECTION',
|
'AWAITING CONNECTION',
|
||||||
@@ -152,10 +142,6 @@ const nextOfflineText = () => {
|
|||||||
}, 3500)
|
}, 3500)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
animateValue()
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.fade-enter-active,
|
.fade-enter-active,
|
||||||
|
|||||||
@@ -24,16 +24,17 @@ export const useMessageHandlers = function (store) {
|
|||||||
// TODO remove
|
// TODO remove
|
||||||
console.log('Device present, idle since: ', message.idle)
|
console.log('Device present, idle since: ', message.idle)
|
||||||
}
|
}
|
||||||
|
// Moved these two up from handle_event_message
|
||||||
|
// Event messages don't include the event key atm, so handle_event_message was never called
|
||||||
|
if (message.hasOwnProperty('ks')) {
|
||||||
|
store.update_keystates(message.ks)
|
||||||
|
}
|
||||||
|
if (message.hasOwnProperty('a')) {
|
||||||
|
store.update_knob_position(message.t, message.a, message.v)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
handle_event_message: (event) => {
|
handle_event_message: (event) => {},
|
||||||
if (event.ks) {
|
|
||||||
store.update_keystates(event.ks)
|
|
||||||
}
|
|
||||||
if (event.hasOwnProperty('a')) {
|
|
||||||
store.update_knob_position(event.t, event.a, event.v)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
handle_profile_message: (profile) => {
|
handle_profile_message: (profile) => {
|
||||||
// TODO update profile
|
// TODO update profile
|
||||||
|
|||||||
Reference in New Issue
Block a user