From 37da0f688501661c568965dec3c992b202c323dd Mon Sep 17 00:00:00 2001 From: Xiaohan-Tian <157918347+Xiaohan-Tian@users.noreply.github.com> Date: Fri, 8 May 2026 16:46:29 -0700 Subject: [PATCH] fix: default piano roll window's Y position --- src/components/piano-roll/PianoRoll.tsx | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/components/piano-roll/PianoRoll.tsx b/src/components/piano-roll/PianoRoll.tsx index 7fd5065..ebf625f 100644 --- a/src/components/piano-roll/PianoRoll.tsx +++ b/src/components/piano-roll/PianoRoll.tsx @@ -114,25 +114,23 @@ const PianoRoll: React.FC = ({ const calculateInitialPosition = () => { // Dynamically get heights from CSS computed styles const statusBarElement = document.querySelector('.status-bar'); - const trackControlElement = document.querySelector('.track-control'); - + // Get actual heights from DOM elements, or use fallback values if elements don't exist yet const statusBarHeight = statusBarElement ? statusBarElement.clientHeight : 30; - const trackControlHeight = trackControlElement ? trackControlElement.clientHeight : 30; const pianoRollHeight = PIANO_ROLL_CONSTANTS.PIANO_ROLL_HEIGHT; - + // Compute left offset when instrument selection panel is open const rootStyles = getComputedStyle(document.documentElement); const instrumentPanelWidthStr = rootStyles.getPropertyValue('--instrument-selection-width') || '300px'; const instrumentPanelWidth = parseInt(instrumentPanelWidthStr, 10) || 300; - + if (DEBUG_MODE.PIANO_ROLL) { - console.log(`Positioning piano roll with heights - statusBar: ${statusBarHeight}px, trackControl: ${trackControlHeight}px, pianoRoll: ${pianoRollHeight}px`); + console.log(`Positioning piano roll with heights - statusBar: ${statusBarHeight}px, pianoRoll: ${pianoRollHeight}px`); } - + return { x: showInstrumentSelection ? instrumentPanelWidth : 0, - y: window.innerHeight - statusBarHeight - trackControlHeight - pianoRollHeight + y: window.innerHeight - statusBarHeight - pianoRollHeight }; };