Skip to content

Commit

Permalink
Merge pull request #5 from Hiroshiba/hiho-counter-pr-372811ca
Browse files Browse the repository at this point in the history
VOICEVOX#2472 の変更提案プルリクエスト
  • Loading branch information
sigprogramming authored Jan 22, 2025
2 parents 7662a2f + 8e05527 commit 2342a8b
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 9 deletions.
16 changes: 16 additions & 0 deletions src/components/Sing/SequencerGrid/Container.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,19 @@
:sequencerZoomY
:sequencerSnapType
:numMeasures
:gridCellWidth
:gridCellHeight
:gridWidth
:gridHeight
:offsetX="props.offsetX"
:offsetY="props.offsetY"
/>
</template>

<script setup lang="ts">
import { computed } from "vue";
import { inject } from "vue";
import { gridInfoInjectionKey } from "../ScoreSequencer.vue";
import Presentation from "./Presentation.vue";
import { useStore } from "@/store";
Expand All @@ -25,6 +31,16 @@ const props = defineProps<{
offsetY: number;
}>();
const injectedValue = inject(gridInfoInjectionKey);
if (injectedValue == undefined) {
throw new Error("injectedValue is undefined.");
}
const gridCellWidth = injectedValue.gridCellWidth;
const gridCellHeight = injectedValue.gridCellHeight;
const gridWidth = injectedValue.gridWidth;
const gridHeight = injectedValue.gridHeight;
const store = useStore();
const tpqn = computed(() => store.state.tpqn);
Expand Down
14 changes: 5 additions & 9 deletions src/components/Sing/SequencerGrid/Presentation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,7 @@
</template>

<script setup lang="ts">
import { computed, toRef, inject } from "vue";
import { gridInfoInjectionKey } from "../ScoreSequencer.vue";
import { computed, toRef } from "vue";
import { keyInfos, tickToBaseX } from "@/sing/viewHelper";
import { TimeSignature } from "@/store/type";
import { useSequencerGrid } from "@/composables/useSequencerGridPattern";
Expand All @@ -124,17 +123,14 @@ const props = defineProps<{
sequencerZoomY: number;
sequencerSnapType: number;
numMeasures: number;
gridCellWidth: number;
gridCellHeight: number;
gridWidth: number;
gridHeight: number;
offsetX: number;
offsetY: number;
}>();
const injectedValue = inject(gridInfoInjectionKey);
if (injectedValue == undefined) {
throw new Error("injectedValue is undefined.");
}
const { gridCellWidth, gridCellHeight, gridWidth, gridHeight } = injectedValue;
const beatWidth = (timeSignature: TimeSignature) => {
const beatType = timeSignature.beatType;
const wholeNoteDuration = props.tpqn * 4;
Expand Down
4 changes: 4 additions & 0 deletions src/components/Sing/SequencerGrid/index.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ const meta: Meta<typeof Presentation> = {
tpqn: 480,
sequencerSnapType: 16,
numMeasures: 32,
gridCellWidth: 7.5,
gridCellHeight: 22.5,
gridWidth: 3840,
gridHeight: 2880,
offsetX: 0,
offsetY: 0,
},
Expand Down

0 comments on commit 2342a8b

Please sign in to comment.