From 7c7c95ded3100fb38489713ff9534c7cce4b532b Mon Sep 17 00:00:00 2001 From: Lumi Pakkanen Date: Tue, 2 May 2023 21:34:21 +0300 Subject: [PATCH] Attach default interval options to parsed scale lines ref #378 --- src/App.vue | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/App.vue b/src/App.vue index c441d41b..da89e4e3 100644 --- a/src/App.vue +++ b/src/App.vue @@ -32,7 +32,12 @@ import { } from "./keyboard-mapping"; import { VirtualSynth } from "./virtual-synth"; import { Synth } from "@/synth"; -import { Interval, parseLine, Scale } from "scale-workshop-core"; +import { + Interval, + parseLine, + Scale, + type IntervalOptions, +} from "scale-workshop-core"; // === Root props and audio === const rootProps = defineProps<{ @@ -166,14 +171,18 @@ function updateFromScaleLines(lines: string[]) { } scaleLines.value = lines; const intervals: Interval[] = []; + const options: IntervalOptions = { + centsFractionDigits: centsFractionDigits.value, + decimalFractionDigits: decimalFractionDigits.value, + }; lines.forEach((line) => { try { - const interval = parseLine(line, DEFAULT_NUMBER_OF_COMPONENTS); + const interval = parseLine(line, DEFAULT_NUMBER_OF_COMPONENTS, options); intervals.push(interval); } catch {} }); if (!intervals.length) { - intervals.push(parseLine("1/1", DEFAULT_NUMBER_OF_COMPONENTS)); + intervals.push(parseLine("1/1", DEFAULT_NUMBER_OF_COMPONENTS, options)); } const surrogate = Scale.fromIntervalArray(intervals);