Skip to content

Commit

Permalink
Constrain track height setting
Browse files Browse the repository at this point in the history
  • Loading branch information
turner committed Jan 30, 2025
1 parent e6b354e commit 080a0bf
Showing 1 changed file with 26 additions and 24 deletions.
50 changes: 26 additions & 24 deletions js/ui/menuUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,38 +290,40 @@ function trackHeightMenuItem() {

const callback = () => {

const number = parseInt(this.browser.inputDialog.value, 10);
if (this.browser.inputDialog.value !== undefined) {

if (undefined !== number) {
const number = parseInt(this.browser.inputDialog.value, 10)

const tracks = [];
if (this.trackView.track.selected) {
tracks.push(...(this.trackView.browser.getSelectedTrackViews().map(({track}) => track)));
} else {
tracks.push(this);
}

for (const track of tracks) {
// Explicitly setting track height turns off autoHeight
track.trackView.autoHeight = false;
if (number > 0){

// If explicitly setting the height adjust min or max, if necessary
if (track.minHeight !== undefined && track.minHeight > number) {
track.minHeight = number;
}
if (track.maxHeight !== undefined && track.maxHeight < number) {
track.minHeight = number;
const tracks = [];
if (this.trackView.track.selected) {
tracks.push(...(this.trackView.browser.getSelectedTrackViews().map(({track}) => track)));
} else {
tracks.push(this);
}
track.trackView.setTrackHeight(number, true);

track.trackView.checkContentHeight();
track.trackView.repaintViews();
for (const track of tracks) {
// Explicitly setting track height turns off autoHeight
track.trackView.autoHeight = false;

} // for (tracks)
// If explicitly setting the height adjust min or max, if necessary
if (track.minHeight !== undefined && track.minHeight > number) {
track.minHeight = number;
}
if (track.maxHeight !== undefined && track.maxHeight < number) {
track.minHeight = number;
}
track.trackView.setTrackHeight(number, true);

} // if (undefined !== number)
track.trackView.checkContentHeight();
track.trackView.repaintViews();
} // for (tracks)

}; // callback
} // if ()

} // if ()
}

const config =
{
Expand Down

0 comments on commit 080a0bf

Please sign in to comment.