TP-119: "only on" layer intersection toggle (union vs intersection) - #16
Open
meintsot wants to merge 7 commits into
Open
TP-119: "only on" layer intersection toggle (union vs intersection)#16meintsot wants to merge 7 commits into
meintsot wants to merge 7 commits into
Conversation
Add a union/intersection choice for multi-item "only on" filters, shared by brushes and Global Operations. Corrects the ticket premise (brushes do not currently do intersection; both paths use AnyOfFilter/union). Reuses the existing AllOfFilter, threads an onlyOnIntersection flag UI -> DefaultFilter -> OnlyOnTerrainOrLayerFilter.create(), and persists it in FilterPreset. Default stays union. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Plan with exact TDD steps across WPCore (model + persistence) and WPGUI (only-on popup "Match any/all" menu items). Spec UI revised from inline panel radios to popup menu items to avoid NetBeans GroupLayout surgery and match how multi-select was previously added. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…presets Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When 2+ "only on" filter items are selected, the user can now choose whether an operation applies where any item is present (union — the existing default) or only where all of them overlap (intersection). The choice appears as two radio menu items — "Match any of these (union)" / "Match all of these (intersection)" — in the shared "only on" popup, so it works for both brushes and Global Operations (the Fill dialog).
Note on the ticket premise: TP-119 says "brush mode already does the intersection." That is not accurate in the code — brushes and Global Operations share the same filter path and both currently do union (
AnyOfFilter) for multiple "only on" items. This PR adds the intersection option (reusing the existingAllOfFilter) rather than making one path match another.Changes
OnlyOnTerrainOrLayerFilter.create(dim, item, boolean intersection)— new overload; for a multi-item list returnsAllOfFilter(intersection / min-strength) whentrue, elseAnyOfFilter(union / max-strength). The 2-arg overload delegates withfalse.DefaultFilter— new 13-arg constructor carryingonlyOnIntersection(the existing 12-arg constructor is preserved and delegates withfalse, soCreateFilterOpand other callers are untouched), plus a field,isOnlyOnIntersection()getter, and Builder support.FilterPreset— persists the choice (onlyOnIntersectionfield + accessors + 10thcaptureFromparam).serialVersionUIDunchanged; presets saved before this change load asfalse(union).BrushOptions— adds the two mutually-exclusive radio menu items (shown only for 2+ items, default "any"), wires the flag throughgetFilter()/setFilter()and into preset save/load.AllOfFilter— Javadoc updated to note the new "only on" intersection usage.Test plan
OnlyOnIntersectionFilterTest6,DefaultFilterOnlyOnIntersectionTest4,FilterPresetTest3) — covers combiner semantics, create() type selection, DefaultFilter wiring, Builder, and a FilterPreset serialize/deserialize round-trip.mvn -DskipTests=true -pl WPGUI -am install→ BUILD SUCCESS.Known follow-ups (out of scope, non-blocking)
DefaultFilter.setDimension()does not propagate the dimension to the children of multi-itemAnyOfFilter/AllOfFilter(affects the already-shipped multi-select union path and "except on" too). Worth a separate ticket.onlyOnIntersectionis not reset if the "only on" list is shrunk back to a single item (inert —create()ignores the flag for single items).Design:
docs/superpowers/specs/2026-06-06-tp119-onlyon-layer-intersection-design.mdPlan:
docs/superpowers/plans/2026-06-06-tp119-onlyon-layer-intersection.md🤖 Generated with Claude Code