Skip to content

Commit

Permalink
仕掛かり
Browse files Browse the repository at this point in the history
  • Loading branch information
Romot authored and Romot committed Apr 25, 2024
1 parent fad9bfb commit 3954356
Show file tree
Hide file tree
Showing 5 changed files with 347 additions and 67 deletions.
2 changes: 2 additions & 0 deletions src/components/Sing/ScoreSequencer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
:width="gridCellWidth"
:height="gridCellHeight"
:class="`sequencer-grid-cell sequencer-grid-cell-${keyInfo.color}`"
stroke-width="1"
stroke="rgba(0, 0, 0, 0.1)"
/>
<template v-for="(keyInfo, index) in keyInfos" :key="index">
<line
Expand Down
12 changes: 6 additions & 6 deletions src/components/Sing/SequencerNote.vue
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,8 @@ const onLyricInput = (event: Event) => {
&.selected {
.note-bar {
background: var(--md-ref-palette-primary80);
border-color: var(--md-ref-palette-primary70);
outline: 2px solid var(--md-ref-palette-primary70);
border-color: var(--md-ref-palette-primary90);
outline: 2px solid var(--md-ref-palette-primary90);
z-index: 1;
}
}
Expand All @@ -288,7 +288,7 @@ const onLyricInput = (event: Event) => {
.note-bar {
background: var(--md-ref-palette-primary80);
border-color: var(--md-ref-palette-primary70);
outline: 2px solid var(--md-ref-palette-primary70);
outline: 2px solid var(--md-ref-palette-primary90);
}
.note-lyric {
Expand Down Expand Up @@ -336,7 +336,7 @@ const onLyricInput = (event: Event) => {
position: absolute;
width: calc(100% + 1px);
height: 100%;
background-color: var(--md-source);
background-color: var(--md-ref-palette-primary70);
border-radius: 4px;
cursor: move;
}
Expand All @@ -351,7 +351,7 @@ const onLyricInput = (event: Event) => {
z-index: 11;
&:hover {
background-color: var(--md-ref-palette-primary70);
background-color: var(--md-ref-palette-primary90);
}
}
Expand All @@ -365,7 +365,7 @@ const onLyricInput = (event: Event) => {
z-index: 11;
&:hover {
background-color: var(--md-ref-palette-primary70);
background-color: var(--md-ref-palette-primary90);
}
}
Expand Down
127 changes: 66 additions & 61 deletions src/components/Sing/ToolBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,34 +27,37 @@
label="テンポ"
hide-bottom-space
class="sing-tempo"
@update:model-value="setBpmInputBuffer"
@change="setTempo"
>
<template #prepend>
<QIcon name="music_note" size="xs" class="sing-tempo-icon" />
</template>
</QInput>
<div class="sing-beats">
<QInput
type="number"
:model-value="beatsInputBuffer"
label="拍子"
hide-bottom-space
class="sing-time-signature"
@update:model-value="setBeatsInputBuffer"
@change="setTimeSignature"
/>
<div class="sing-beats-separator">/</div>
<QInput
type="number"
:model-value="beatTypeInputBuffer"
label=""
hide-bottom-space
class="sing-time-signature"
@update:model-value="setBeatTypeInputBuffer"
@change="setTimeSignature"
/>
</div>
/>
<QField label="拍子" hide-bottom-space dense>
<div class="sing-beats">
<QSelect
:model-value="timeSignatures[0].beats"
:options="beatsOptions"
hide-bottom-space
hide-dropdown-icon
dense
options-dense
transition-show="none"
transition-hide="none"
class="sing-time-signature"
@update:model-value="setBeats"
/>
<div class="sing-beats-separator">/</div>
<QSelect
:model-value="timeSignatures[0].beatType"
:options="beatTypeOptions"
hide-bottom-space
hide-dropdown-icon
dense
options-dense
transition-show="none"
transition-hide="none"
class="sing-time-signature"
@update:model-value="setBeatType"
/>
</div>
</QField>
</div>
<!-- player -->
<div class="sing-player">
Expand Down Expand Up @@ -115,6 +118,7 @@
color="primary"
text-color="display-on-primary"
hide-bottom-space
hide-dropdown-icon
options-dense
label="スナップ"
transition-show="none"
Expand Down Expand Up @@ -195,10 +199,21 @@ const keyRangeAdjustment = computed(
const volumeRangeAdjustment = computed(
() => store.getters.SELECTED_TRACK.volumeRangeAdjustment,
);
const beatsOptions = computed(() => {
return Array.from({ length: 32 }, (_, i) => ({
label: (i + 1).toString(),
value: i + 1,
}));
});
const beatTypeOptions = computed(() => {
return [2, 4, 8, 16, 32].map((beatType) => ({
label: beatType.toString(),
value: beatType,
}));
});
const bpmInputBuffer = ref(120);
const beatsInputBuffer = ref(4);
const beatTypeInputBuffer = ref(4);
const keyRangeAdjustmentInputBuffer = ref(0);
const volumeRangeAdjustmentInputBuffer = ref(0);
Expand All @@ -210,15 +225,6 @@ watch(
{ deep: true, immediate: true },
);
watch(
timeSignatures,
() => {
beatsInputBuffer.value = timeSignatures.value[0].beats;
beatTypeInputBuffer.value = timeSignatures.value[0].beatType;
},
{ deep: true, immediate: true },
);
watch(
keyRangeAdjustment,
() => {
Expand All @@ -243,22 +249,6 @@ const setBpmInputBuffer = (bpmStr: string | number | null) => {
bpmInputBuffer.value = bpmValue;
};
const setBeatsInputBuffer = (beatsStr: string | number | null) => {
const beatsValue = Number(beatsStr);
if (!isValidBeats(beatsValue)) {
return;
}
beatsInputBuffer.value = beatsValue;
};
const setBeatTypeInputBuffer = (beatTypeStr: string | number | null) => {
const beatTypeValue = Number(beatTypeStr);
if (!isValidBeatType(beatTypeValue)) {
return;
}
beatTypeInputBuffer.value = beatTypeValue;
};
const setKeyRangeAdjustmentInputBuffer = (
KeyRangeAdjustmentStr: string | number | null,
) => {
Expand Down Expand Up @@ -289,14 +279,28 @@ const setTempo = () => {
});
};
const setTimeSignature = () => {
const beats = beatsInputBuffer.value;
const beatType = beatTypeInputBuffer.value;
const setBeats = (beats: { label: string; value: number }) => {
if (!isValidBeats(beats.value)) {
return;
}
store.dispatch("COMMAND_SET_TIME_SIGNATURE", {
timeSignature: {
measureNumber: 1,
beats: beats.value,
beatType: timeSignatures.value[0].beatType,
},
});
};
const setBeatType = (beatType: { label: string; value: number }) => {
if (!isValidBeatType(beatType.value)) {
return;
}
store.dispatch("COMMAND_SET_TIME_SIGNATURE", {
timeSignature: {
measureNumber: 1,
beats,
beatType,
beats: timeSignatures.value[0].beats,
beatType: beatType.value,
},
});
};
Expand Down Expand Up @@ -482,7 +486,7 @@ onUnmounted(() => {
.sing-beats {
align-items: center;
display: flex;
margin-left: 8px;
//margin-left: 8px;
position: relative;
}
Expand All @@ -491,6 +495,7 @@ onUnmounted(() => {
position: relative;
width: 32px;
}
.sing-beats-separator {
color: rgba(colors.$display-rgb, 0.6);
position: relative;
Expand Down Expand Up @@ -551,6 +556,6 @@ onUnmounted(() => {
}
.sing-snap {
min-width: 120px;
min-width: 80px;
}
</style>
1 change: 1 addition & 0 deletions src/styles/_index.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@use './variables' as vars;
@use './tokens' as tokens;
@use './colors' as colors;
@import "./fonts";

Expand Down
Loading

0 comments on commit 3954356

Please sign in to comment.