ScaleToise: display less notes if not large
This commit is contained in:
parent
fa4735f34c
commit
930871af2e
2 changed files with 11 additions and 7 deletions
|
@ -27,12 +27,16 @@ Item {
|
||||||
property int h_margin: Math.max(height / 8, main_note.border_d)
|
property int h_margin: Math.max(height / 8, main_note.border_d)
|
||||||
|
|
||||||
property int nb_notes: 12
|
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
|
/// 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 int first_note: Math.floor(position) % nb_notes
|
||||||
property double delta: position - Math.floor(position)
|
property double delta: position - Math.floor(position)
|
||||||
|
|
||||||
|
onFirst_noteChanged: console.log(first_note + " " + note + " " + nb_notes_displayed + " " + position)
|
||||||
|
|
||||||
function note_name(i) {
|
function note_name(i) {
|
||||||
return notes[notes_style][i];
|
return notes[notes_style][i];
|
||||||
}
|
}
|
||||||
|
@ -57,13 +61,13 @@ Item {
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.topMargin: h_margin
|
anchors.topMargin: h_margin
|
||||||
anchors.bottomMargin: h_margin
|
anchors.bottomMargin: h_margin
|
||||||
property double cellWidth: parent.width / nb_notes
|
property double cellWidth: parent.width / nb_notes_displayed
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
model: nb_notes + 1
|
model: nb_notes_displayed + 1
|
||||||
Rectangle {
|
Rectangle {
|
||||||
width: toise.cellWidth
|
width: toise.cellWidth
|
||||||
height: parent.height
|
height: toise.height
|
||||||
border.width: 1
|
border.width: 1
|
||||||
property int note: (index + nb_notes + first_note) % nb_notes
|
property int note: (index + nb_notes + first_note) % nb_notes
|
||||||
color: isAltered(note) ? colorAltered : colorNatural
|
color: isAltered(note) ? colorAltered : colorNatural
|
||||||
|
@ -83,7 +87,7 @@ Item {
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: main_note
|
id: main_note
|
||||||
y: 0
|
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
|
width: toise.cellWidth + border_d * 2
|
||||||
height: parent.height
|
height: parent.height
|
||||||
|
|
||||||
|
|
|
@ -33,11 +33,11 @@ Item {
|
||||||
theme: parent.theme
|
theme: parent.theme
|
||||||
|
|
||||||
anchors.top: meter.bottom
|
anchors.top: meter.bottom
|
||||||
anchors.topMargin: h_margin
|
anchors.topMargin: h_margin * 2
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
|
||||||
width: meter.width
|
width: meter.width
|
||||||
height: width / 10
|
height: Math.max(width / 10, theme.fontSizeLarge * 1.8)
|
||||||
|
|
||||||
note: tuner.note + toise.nb_notes * tuner.octave
|
note: tuner.note + toise.nb_notes * tuner.octave
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue