diff --git a/src/jsMain/kotlin/nl/astraeus/vst/ui/components/KeyboardComponent.kt b/src/jsMain/kotlin/nl/astraeus/vst/ui/components/KeyboardComponent.kt index a1eea60..d4e7cb8 100644 --- a/src/jsMain/kotlin/nl/astraeus/vst/ui/components/KeyboardComponent.kt +++ b/src/jsMain/kotlin/nl/astraeus/vst/ui/components/KeyboardComponent.kt @@ -43,10 +43,9 @@ class KeyboardComponent( // Key dimensions private val keyboardWidth = 210 private val keyboardHeight = 100 - private val whiteKeyWidth = 30 - private val whiteKeyHeight = 100 - private val blackKeyWidth = 20 - private val blackKeyHeight = 60 + private val whiteKeyWidth = keyboardWidth / 7 + private val blackKeyWidth = whiteKeyWidth * 3 / 2 + private val blackKeyHeight = keyboardHeight * 60 / 100 // Calculate positions for black keys private val blackKeyPositions = listOf( @@ -58,13 +57,11 @@ class KeyboardComponent( ) fun noteDown(midiNote: Int) { - println("noteDown $midiNote") pressedNotes.add(midiNote) onNoteDown(midiNote) } fun noteUp(midiNote: Int) { - println("noteUp $midiNote") pressedNotes.remove(midiNote) onNoteUp(midiNote) } @@ -182,12 +179,11 @@ class KeyboardComponent( // Draw white keys for (i in 0 until 7) { - val midiNote = whiteKeys[i] + (octave - 4) * 12 rect( i * whiteKeyWidth, 0, whiteKeyWidth, - whiteKeyHeight, + keyboardHeight, 0, WhiteKeyCls.name ) @@ -195,7 +191,6 @@ class KeyboardComponent( // Draw black keys for (i in 0 until 5) { - val midiNote = blackKeys[i] + (octave - 4) * 12 rect( blackKeyPositions[i], 0,