Skip to content

Conversation

lixinde
Copy link
Contributor

@lixinde lixinde commented Apr 10, 2025

Issue

When moving objects in the hierarchy panel to become children of other objects, the selection box in the viewport didn't update to reflect the object's new world transformation, causing a visual discrepancy between the actual object position and its selection highlight.

threejs-editor-selectionBoxIssue.mp4

Solution

Added appropriate signal dispatch in the MoveObjectCommand's execute() and undo() methods to ensure the selection box properly updates when objects are reparented. This ensures the selection box correctly reflects the object's new world transformation after hierarchy changes.

The fix properly leverages the existing signal system to update the selection box geometry without requiring changes to the Viewport.js implementation, which already handles the selectionBox updates when receiving objectChanged signals.

Testing

Verified that when dragging objects in the hierarchy panel to become children of other objects, the selection box now properly updates to match the object's new position in the scene.

threejs-editor-fixed.mp4

@lixinde lixinde changed the title Editor: Dispatch objectChanged signal on object movement Editor: Fix selection box update when reparenting objects in hierarchy Apr 10, 2025
@Mugen87
Copy link
Collaborator

Mugen87 commented Apr 10, 2025

For testing: https://rawcdn.githack.com/lixinde/three.js/editor-fix/editor/index.html

Your PR indeed fixes the issue 👍 .

Do you mind reverting the screenshot update? Sometimes this particular example fails and a simple rerun of the CI solves the issue.

@Mugen87 Mugen87 added this to the r176 milestone Apr 10, 2025
@lixinde
Copy link
Contributor Author

lixinde commented Apr 11, 2025

For testing: https://rawcdn.githack.com/lixinde/three.js/editor-fix/editor/index.html

Your PR indeed fixes the issue 👍 .

Do you mind reverting the screenshot update? Sometimes this particular example fails and a simple rerun of the CI solves the issue.

I've reverted the screenshot update. Thanks for confirming the fix works properly!

@lixinde
Copy link
Contributor Author

lixinde commented Apr 11, 2025

I found and fixed another related bug while working on this PR. I'm attaching a video that demonstrates the issue. The additional fix addresses this problem while maintaining the original fix's functionality.

20250411-103319.mp4

For testing: https://rawcdn.githack.com/lixinde/three.js/editor-fix/editor/index.html

@Mugen87 Mugen87 merged commit 3152a8b into mrdoob:dev Apr 11, 2025
11 checks passed
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.

2 participants