Description
When attempting to minimize SVG-based widgets (like the Custom Mode or Pitch/Drum Matrix) from their fullscreen mode, the widgets fail to scale down and permanently remain trapped at their maximized size.
This happens because the isMaximized function is being referenced as a property without the calling parentheses (). In JavaScript, simply referencing a function without calling it always evaluates to truthy. Therefore, the widget assumes it is always maximized and refuses to restore back to its original layout.
Affected Files
- js/widgets/modewidget.js (Line 248)
- js/widgets/pitchdrummatrix.js (Line 630)
Root Cause & Proof
In both widget components, the internal _scale() method is assigned as the onmaximize handler. Inside these methods, the scale calculation checks the state like this:
const scale = this.isMaximized ? windowHeight / widgetBody.offsetHeight : 1;
Because of the missing (), the ternary operator never returns 1 (the original scale). It always executes the calculation for the maximized view.
Reproduce Steps
Open the Mode Widget or Pitch Drum Matrix
Maximize → SVG scales up (happens to work because condition is always true)
Click maximize button again to restore → _restore() sets _maximized = false → onmaximize() fires → this.isMaximized is still a truthy function ref → SVG stays at a computed scale instead of restoring to original 400×400 size
Description
When attempting to minimize SVG-based widgets (like the Custom Mode or Pitch/Drum Matrix) from their fullscreen mode, the widgets fail to scale down and permanently remain trapped at their maximized size.
This happens because the
isMaximizedfunction is being referenced as a property without the calling parentheses(). In JavaScript, simply referencing a function without calling it always evaluates to truthy. Therefore, the widget assumes it is always maximized and refuses to restore back to its original layout.Affected Files
Root Cause & Proof
In both widget components, the internal
_scale()method is assigned as theonmaximizehandler. Inside these methods, the scale calculation checks the state like this:Because of the missing (), the ternary operator never returns 1 (the original scale). It always executes the calculation for the maximized view.
Reproduce Steps
Open the Mode Widget or Pitch Drum Matrix
Maximize → SVG scales up (happens to work because condition is always true)
Click maximize button again to restore → _restore() sets _maximized = false → onmaximize() fires → this.isMaximized is still a truthy function ref → SVG stays at a computed scale instead of restoring to original 400×400 size