Skip to content

paint-boolean-ops: fix toolbar and Redux initialization timing - #9164

Open
griffpatch wants to merge 4 commits into
ScratchAddons:masterfrom
griffpatch:codex/fix-open-close-shape
Open

paint-boolean-ops: fix toolbar and Redux initialization timing#9164
griffpatch wants to merge 4 commits into
ScratchAddons:masterfrom
griffpatch:codex/fix-open-close-shape

Conversation

@griffpatch

@griffpatch griffpatch commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Blocked by #9180. Please merge #9180 first. This PR currently includes the same Redux changes so the paint fix can use them. Once #9180 is merged, I will update this branch so only the paint changes remain.

The Open/Close button belongs to Scratch Paint's Reshape toolbar, but it was being updated along with the separate fixed toolbar and More menu.

On a narrow editor, this meant the button did not appear until More was opened. It could also stay behind after switching to Select or Text.

The button now follows the Reshape toolbar directly. It is removed when Reshape is no longer active and added again if React replaces that toolbar.

While checking this, I found that Open/Close was disabled for paths selected inside a Group or CompoundPath, even though Scratch can open and close those paths. The selection check now includes them. Releasing a compound path also keeps its children in the same parent.

Disabled Boolean operations in More now use the same disabled styling as Scratch's own items.

Follow-up after review

After the original review, I checked this alongside the Redux initialization issue in #7933.

Open/Close needs the current paint mode when the addon starts, so it now waits for Redux before checking that mode. This uses the Redux initialization change in #9180.

Waiting for Redux revealed that Scratch can create the fixed toolbar row before adding its button groups. The toolbar helper now refreshes the native classes when those groups appear, so the Boolean buttons stay on one row.

Fixes #9159

@griffpatch
griffpatch marked this pull request as ready for review August 13, 2026 10:18
@DNin01 DNin01 added this to the v1.46.0 milestone Aug 13, 2026

@mxmou mxmou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good; the only things I'm not sure about are a comment and a function name.

Comment thread addons/paint-boolean-ops/userscript.js Outdated
Comment thread addons/paint-boolean-ops/userscript.js Outdated
@griffpatch

Copy link
Copy Markdown
Contributor Author

Thanks @mxmou, both points make sense. I've updated the comment to explain why the Reshape sub-toolbar is watched separately, and renamed the helper to showOpenCloseButton. No behavior changes. Lint and syntax checks pass.

Comment thread addons/paint-boolean-ops/userscript.js
@griffpatch griffpatch changed the title paint-boolean-ops: fix toolbar state handling paint-boolean-ops: fix toolbar and Redux initialization timing Sep 2, 2026
@griffpatch

Copy link
Copy Markdown
Contributor Author

I have added a small follow-up for #9180.

Open/Close now waits until the current paint mode is available. The toolbar helper also refreshes its native classes if Scratch adds the button groups after the toolbar row, which stops the Boolean buttons stacking onto separate rows.

@pufferfish101007

Copy link
Copy Markdown
Contributor

I'm happy with the fixes for paint-boolean-ops but I'm not confident enough with internals to approve the changes to redux.initialize.

If the changes here entirely subsume the changes in #9180 (which it looks like they do?) then I think it should either be marked as blocking so that it is merged first, or closed in favour of this.

@pufferfish101007 pufferfish101007 added status: needs review PR needs 1 more approval scope: addon api Related to the addon.* JS APIs or other ways for addons to provide features scope: addon Related to one or multiple addons labels Sep 9, 2026
@griffpatch

Copy link
Copy Markdown
Contributor Author

Thanks @pufferfish101007, yes, #9164 currently includes the same Redux changes as #9180. I'd prefer to keep the shared API fix separate for review, so I've marked this PR as blocked by #9180 in the description. Once that is reviewed and merged, I'll update this branch so only the paint changes remain.

@pufferfish101007 pufferfish101007 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approving with the expectation of #9180 being merged first

@pufferfish101007 pufferfish101007 added status: pending A PR is still not ready to merge, or an issue is being worked on/on consideration and removed status: needs review PR needs 1 more approval labels Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: addon api Related to the addon.* JS APIs or other ways for addons to provide features scope: addon Related to one or multiple addons status: pending A PR is still not ready to merge, or an issue is being worked on/on consideration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Open/Close Shape button doesn't appear until More menu is opened

4 participants