Skip to content

Fixing Z-Order when duplicating groups#66

Merged
jrupp merged 1 commit into
mainfrom
fix-z-order
Jul 2, 2026
Merged

Fixing Z-Order when duplicating groups#66
jrupp merged 1 commit into
mainfrom
fix-z-order

Conversation

@jrupp

@jrupp jrupp commented Jul 2, 2026

Copy link
Copy Markdown
Owner

Fixes https://bricklayouts.canny.io/feature-requests/p/duplicating-a-group-doesnt-retain-z-order

When a ComponentGroup is duplicated/cloned, the components in it were not maintaining z-order. They would end up in the reverse order.

@jrupp jrupp requested a review from Copilot July 2, 2026 22:48
@jrupp jrupp added bug Something isn't working javascript Pull requests that update javascript code labels Jul 2, 2026

Copilot AI 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.

Pull request overview

This PR fixes component z-order inversion that occurred when duplicating/cloning a ComponentGroup, ensuring duplicated groups preserve the original draw order within the LayoutLayer.

Changes:

  • Adjusted LayoutLayer.addChild() insertion logic to increment the insertion index per child so multi-add operations preserve order.
  • Added a regression test that duplicates a selected group and asserts the cloned components keep the same relative ordering.
  • Updated existing group-clone positioning assertions to check relative spacing instead of hard-coded offsets, and updated the documented spec count.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/model/layoutLayer.js Fixes child insertion order by incrementing the insertion index and updating it after adding a ComponentGroup.
spec/support/something.spec.mjs Adds a z-order regression test for group duplication and makes clone-position tests assert relative spacing.
CLAUDE.md Updates documented Jasmine spec count formatting/count.

@jrupp jrupp merged commit 817268c into main Jul 2, 2026
5 checks passed
@jrupp jrupp deleted the fix-z-order branch July 2, 2026 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working javascript Pull requests that update javascript code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants