Skip to content

Layers: drop vector masks on groups, adjustment, fill and smart object layers (#20646) - #20731

Open
Higgs32584 wants to merge 2 commits into
storytold:mainfrom
Higgs32584:fix/20646-vector-mask-drop-targets
Open

Higgs32584 wants to merge 2 commits into
storytold:mainfrom
Higgs32584:fix/20646-vector-mask-drop-targets

Conversation

@Higgs32584

@Higgs32584 Higgs32584 commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

A vector mask dragged in the Layers panel now lands on groups, adjustment layers, fill layers and smart objects.

Fixes #20646.

What the user saw. Dragging a vector mask onto a group, adjustment layer, fill layer or smart object showed no drop highlight and did nothing, even though Layer › Vector Mask adds one to those layers.

Cause. vector_mask_drop_target (crates/engine-core/src/cmd/vector_cmds/vector_mask.rs) matched only Raster and Text content (plus Shape, whose path is replaced) and returned None for every other kind. layer.vectorMask.add refuses only shape layers.

Change. Every non-shape layer is now an EmptyMask / ExistingMask target. A shape layer with locked pixels still refuses, as before. The earlier checks are unchanged: same layer, Background, all-locks on either layer, frames. The Layers panel highlight, the drop action and the headless layer.vectorMask.moveTo all call this one function, so they change together. No UI code changed.

Test. vector_mask_drops_on_groups_adjustments_fills_and_smart_objects_like_add (vector_mask_move_tests.rs). For each of the four kinds it checks that the drop moves the mask onto the layer, leaves the source with no mask, and keeps the target's content. It then checks that a second drop on the now-masked layer needs replace. With the fix reverted it fails on the group ("the vector mask cannot be dropped on that layer").

an_unconfirmed_or_invalid_vector_mask_drop_refuses_without_history listed a drop onto a group as one that must be refused. That row asserted the behaviour this issue reports as a bug, so I removed it. The test's other refusal rows (unconfirmed replace, Background, self, a bad replace value) are unchanged.

Verification (local, Windows):

  • cargo test -p photocraft-engine-core --lib vector_mask: 31 passed.
  • The new test fails with the fix reverted, as described above.
  • cargo clippy -p photocraft-engine-core --all-targets -- -D warnings: clean.
  • rustfmt --check on both changed files: clean.

Not run locally (left to CI): the full workspace test suite, cargo xtask layers, cargo xtask wasm and the panic_hunt sweep. No command ids changed, so parity and panel-commands do not apply.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Vector masks can now be moved onto group, adjustment, fill, and smart-object layers without changing their content.
    • Layers that already have a vector mask can accept a replacement when the replace option is enabled. Other non-shape layers can also receive vector masks when they do not already have one.
  • Bug Fixes
    • Shape layers with pixel lock enabled are no longer accepted as vector mask targets.

…t layers (storytold#20646)

vector_mask_drop_target accepted only pixel and type layers (and shape
paths), while layer.vectorMask.add accepts any layer that is not a shape.
Every non-shape layer is now a drop target, with the same lock, frame and
Background checks as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The drop-target logic now accepts non-shape layers based on whether they already have a vector mask. Tests cover mask moves to groups, adjustment layers, fill layers, and smart objects, including replacement behavior.

Changes: Vector mask drop targets

Layer / File(s) Summary
Target classification and move coverage
crates/engine-core/src/cmd/vector_cmds/vector_mask.rs, crates/engine-core/src/cmd/vector_cmds/vector_mask_move_tests.rs
Non-shape layers are classified as ExistingMask or EmptyMask. Tests cover moves to group, adjustment, fill, and smart-object layers. They verify destination content remains unchanged and that replacing an existing mask requires replace: true.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Low

Suggested reviewers: yoriswind, aiongg

Merge Risk: Minimal · up to 734a7

Vector masks can now be dropped onto groups, adjustment layers, fill layers and smart objects, as issue #20646 requests. Shape-layer, frame and lock restrictions are unchanged, and a test covers the new targets. The change is small and has no remaining merge-blocking risk.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title says the PR lets vector masks be dropped on groups, adjustment, fill and smart object layers. The raw summary and objectives match this: non-shape layers now accept masks, shape layers with …
Linked Issues check Passed [#20646] asks that vector-mask drops reach groups, adjustment layers, smart objects and fill layers. At head, vector_mask_drop_target in crates/engine-core/src/cmd/vector_cmds/vector_mask.rs retur…
Out of Scope Changes check Passed The reviewed source change is limited to vector_mask_drop_target. It removes the refusal for non-shape layer kinds. It keeps the other checks unchanged: same layer, Background, all-locks on the sour…
Full details: Title check

Explanation

The title says the PR lets vector masks be dropped on groups, adjustment, fill and smart object layers. The raw summary and objectives match this: non-shape layers now accept masks, shape layers with locked pixels still refuse, and tests cover the four named layer types. The title names the main change. Its issue number (#20646) differs from the PR objectives' reference (#20731), which does not affect the title check. The title is 86 characters, slightly long but readable.

Full details: Linked Issues check

Explanation

[#20646] asks that vector-mask drops reach groups, adjustment layers, smart objects and fill layers. At head, vector_mask_drop_target in crates/engine-core/src/cmd/vector_cmds/vector_mask.rs returns EmptyMask for any non-shape layer without a mask and ExistingMask for one with a mask. The former _ =&gt; None refusal for these kinds is gone. Shape layers return ShapePath only when locks.pixels is unset, so the shape-layer rule the issue does not contest is kept. The Layers highlight, the drop action and layer.vectorMask.moveTo all call this function. The function is the same at head as in the prior review. The test file vector_mask_move_tests.rs could not be read at head in this review, so the test evidence (vector_mask_drops_on_groups_adjustments_fills_and_smart_objects_like_add) rests on the PR description and the change summary. That evidence supports the four-kind coverage, but it is not confirmed from source here.

Full details: Out of Scope Changes check

Explanation

The reviewed source change is limited to vector_mask_drop_target. It removes the refusal for non-shape layer kinds. It keeps the other checks unchanged: same layer, Background, all-locks on the source or target, frames, and shape layers with pixel locks. The test change, as described, removes one refusal row in an_unconfirmed_or_invalid_vector_mask_drop_refuses_without_history that asserted the behavior reported in #20646. The added test covers the same feature. No unrelated files are named in the PR, the summary, or the readable source. The test-file diff could not be read directly in this review, so this verdict relies on the PR description and summary for that file.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 166c771 and 734a71f.

Files selected for processing: 1

  • crates/engine-core/src/cmd/vector_cmds/vector_mask_move_tests.rs
Files skipped from review as they are similar to previous changes: 1

  • crates/engine-core/src/cmd/vector_cmds/vector_mask_move_tests.rs

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.

…orytold#20646)

clippy::type-complexity flagged the inline (&str, fn(&mut Session)) array type.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Vector-mask drops are refused on groups, adjustment layers, smart objects and fill layers, which the engine supports

1 participant