Skip to content

fix(canvas): locked layers cannot be reordered or displaced#1357

Open
Tet-9 wants to merge 1 commit into
e35dev:mainfrom
Tet-9:fix/locked-layer-reorder
Open

fix(canvas): locked layers cannot be reordered or displaced#1357
Tet-9 wants to merge 1 commit into
e35dev:mainfrom
Tet-9:fix/locked-layer-reorder

Conversation

@Tet-9

@Tet-9 Tet-9 commented Jun 26, 2026

Copy link
Copy Markdown

Closes #1248

What

Locked layers could still be moved via the ▲/▼ buttons, and unlocked layers could displace a locked neighbor by moving into its slot — exactly the "moved by accident" scenario the lock is meant to prevent.

Fix

Extracted a pure reorderLayers(list, index, delta) function that refuses the move when either the moved layer or the destination neighbor is locked. move() now delegates to it.

The ▲/▼ buttons are disabled when the layer is locked or when the adjacent neighbor in that direction is locked, so the UI reflects the constraint before the user tries to act.

Unlocked layers that have no locked neighbors are unaffected.

Testing

  • npm test passes (104 smoke tests)
  • Verified manually: locked background layer (index 4 in the sample) cannot be moved up, and the unlocked brand layer above it cannot be moved down into its slot

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.

Locking a canvas layer doesn't stop it being reordered or displaced, despite the lock's stated purpose

1 participant