fix: default piano roll window's Y position

This commit is contained in:
Xiaohan-Tian
2026-05-08 16:46:29 -07:00
parent bd067cae64
commit 37da0f6885
+2 -4
View File
@@ -114,11 +114,9 @@ const PianoRoll: React.FC<PianoRollProps> = ({
const calculateInitialPosition = () => { const calculateInitialPosition = () => {
// Dynamically get heights from CSS computed styles // Dynamically get heights from CSS computed styles
const statusBarElement = document.querySelector('.status-bar'); 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 // Get actual heights from DOM elements, or use fallback values if elements don't exist yet
const statusBarHeight = statusBarElement ? statusBarElement.clientHeight : 30; const statusBarHeight = statusBarElement ? statusBarElement.clientHeight : 30;
const trackControlHeight = trackControlElement ? trackControlElement.clientHeight : 30;
const pianoRollHeight = PIANO_ROLL_CONSTANTS.PIANO_ROLL_HEIGHT; const pianoRollHeight = PIANO_ROLL_CONSTANTS.PIANO_ROLL_HEIGHT;
// Compute left offset when instrument selection panel is open // Compute left offset when instrument selection panel is open
@@ -127,12 +125,12 @@ const PianoRoll: React.FC<PianoRollProps> = ({
const instrumentPanelWidth = parseInt(instrumentPanelWidthStr, 10) || 300; const instrumentPanelWidth = parseInt(instrumentPanelWidthStr, 10) || 300;
if (DEBUG_MODE.PIANO_ROLL) { 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 { return {
x: showInstrumentSelection ? instrumentPanelWidth : 0, x: showInstrumentSelection ? instrumentPanelWidth : 0,
y: window.innerHeight - statusBarHeight - trackControlHeight - pianoRollHeight y: window.innerHeight - statusBarHeight - pianoRollHeight
}; };
}; };