forked from VOICEVOX/voicevox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSequencerGridSpacer.vue
54 lines (44 loc) · 1.46 KB
/
SequencerGridSpacer.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<template>
<div class="sequencer-grid-spacer"></div>
</template>
<script setup lang="ts">
import { computed, inject } from "vue";
import { getKeyBaseHeight, getNumKeys, tickToBaseX } from "@/sing/viewHelper";
import { useStore } from "@/store";
import { measureNumberToTick } from "@/sing/domain";
import { numMeasuresInjectionKey } from "@/components/Sing/ScoreSequencer.vue";
const injectedValue = inject(numMeasuresInjectionKey);
if (injectedValue == undefined) {
throw new Error("injectedValue is undefined.");
}
const { numMeasures } = injectedValue;
const store = useStore();
const tpqn = computed(() => store.state.tpqn);
const timeSignatures = computed(() => store.state.timeSignatures);
const zoomX = computed(() => store.state.sequencerZoomX);
const zoomY = computed(() => store.state.sequencerZoomY);
const endMeasureNumber = computed(() => numMeasures.value + 1);
const endTicks = computed(() => {
return measureNumberToTick(
endMeasureNumber.value,
timeSignatures.value,
tpqn.value,
);
});
const gridWidth = computed(() => {
return tickToBaseX(endTicks.value, tpqn.value) * zoomX.value;
});
const gridHeight = computed(() => {
return getKeyBaseHeight() * getNumKeys() * zoomY.value;
});
</script>
<style scoped lang="scss">
@use "@/styles/variables" as vars;
@use "@/styles/colors" as colors;
.sequencer-grid-spacer {
display: block;
width: v-bind("`${gridWidth}px`");
height: v-bind("`${gridHeight}px`");
pointer-events: none;
}
</style>