diff --git a/qml/ScaleToise.qml b/qml/ScaleToise.qml index 5b88925..fab7327 100644 --- a/qml/ScaleToise.qml +++ b/qml/ScaleToise.qml @@ -27,12 +27,16 @@ Item { property int h_margin: Math.max(height / 8, main_note.border_d) property int nb_notes: 12 + property int nb_notes_displayed: Math.min(nb_notes, width / theme.fontSizeLarge * 0.8) + /// current note is on the middle - property double position: note + (nb_notes + 1) / 2 + property double position: note - (nb_notes_displayed - 1) / 2 property int first_note: Math.floor(position) % nb_notes property double delta: position - Math.floor(position) + onFirst_noteChanged: console.log(first_note + " " + note + " " + nb_notes_displayed + " " + position) + function note_name(i) { return notes[notes_style][i]; } @@ -57,13 +61,13 @@ Item { anchors.right: parent.right anchors.topMargin: h_margin anchors.bottomMargin: h_margin - property double cellWidth: parent.width / nb_notes + property double cellWidth: parent.width / nb_notes_displayed Repeater { - model: nb_notes + 1 + model: nb_notes_displayed + 1 Rectangle { width: toise.cellWidth - height: parent.height + height: toise.height border.width: 1 property int note: (index + nb_notes + first_note) % nb_notes color: isAltered(note) ? colorAltered : colorNatural @@ -83,7 +87,7 @@ Item { Rectangle { id: main_note y: 0 - x: toise.cellWidth * 5.5 - border_d + x: toise.cellWidth * (parent.nb_notes_displayed - 1) / 2 - border_d width: toise.cellWidth + border_d * 2 height: parent.height diff --git a/qml/TunerScreen.qml b/qml/TunerScreen.qml index 066b236..6878a5a 100644 --- a/qml/TunerScreen.qml +++ b/qml/TunerScreen.qml @@ -33,11 +33,11 @@ Item { theme: parent.theme anchors.top: meter.bottom - anchors.topMargin: h_margin + anchors.topMargin: h_margin * 2 anchors.horizontalCenter: parent.horizontalCenter width: meter.width - height: width / 10 + height: Math.max(width / 10, theme.fontSizeLarge * 1.8) note: tuner.note + toise.nb_notes * tuner.octave }