Skip to content

[Bug] SVG Widgets Fail to Restore Original Size (Missing () on isMaximized) #6553

@karthik-dev56

Description

@karthik-dev56

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions