diff --git a/src/components/device/DeviceBar.vue b/src/components/device/DeviceBar.vue index c698f49..f39c51b 100644 --- a/src/components/device/DeviceBar.vue +++ b/src/components/device/DeviceBar.vue @@ -5,16 +5,17 @@ const model = defineModel({ type: Number, default: 60 }) const bar = ref(null) -const width = ref(160) -const count = ref(40) -const percent = ref(60) -const gap_width = ref(2) - -const rect_width = computed(() => { - return (width.value - ((count.value + 1) * gap_width.value)) / (count.value) +const props = defineProps({ + width: { type: Number, default: 160 }, + count: { type: Number, default: 40 }, + gapWidth: { type: Number, default: 2 }, }) -const current_pos = computed(() => { - return Math.round((percent.value / 100) * (count.value - 1)) + +const rectWidth = computed(() => { + return (props.width - ((props.count + 1) * props.gapWidth)) / props.count +}) +const currentPosition = computed(() => { + return Math.round((model.value / 100) * (props.count - 1)) }) function onMouseDown() { @@ -24,8 +25,7 @@ function onMouseDown() { function onMouseMove(e) { const rect = bar.value.getBoundingClientRect() - percent.value = Math.max(0, Math.min(Math.round((e.clientX - rect.left - 9) / (width.value - 6) * 100), 100)) - model.value = percent.value + model.value = Math.max(0, Math.min(Math.round((e.clientX - rect.left - 9) / (props.width - 6) * 100), 100)) } function onMouseUp() { @@ -41,12 +41,12 @@ function onMouseUp() { - +
midi-logo -

101

+

{{ value }}

HIGH PASS
- + KORG MINILOGUE HIGH PASS FILTER 0-127 @@ -35,6 +35,9 @@ import LogoMidi from '@/assets/logos/logoMidi.svg' import DeviceBar from '@/components/device/DeviceBar.vue' import { useStore } from '@/store' import ScrambleText from '@/components/effects/ScrambleText.vue' +import { ref } from 'vue' + +const value = ref(69) const store = useStore() \ No newline at end of file