Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editor: MoveObjectCommand should dispatch 'added' event #21812

Merged
merged 1 commit into from
May 11, 2021

Conversation

carstenschwede
Copy link
Contributor

@carstenschwede carstenschwede commented May 11, 2021

Changing the parent of an object by moving it in the scene hierarchy in the Editor works by calling parent.remove(child) and splicing in the child manually to respect the insertion point. Calling .add() instead would push the child at the end of the children array. However, without a call to .add() there is no dispatch for the added event and only a removed event is triggered.

This PR adds a dispatch for the added event so both events are triggered.

Changing the parent of an object by moving it in the scene hierarchy in the Editor works by calling `parent.remove(child)` and splicing in the child manually to respect the insertion point. Calling `.add()` instead would push the child at the end of the children array. However, without a call to `.add()` there is no dispatch for the `added` event and only a `removed` event is triggered.

This PR adds a dispatch for the `added` event so both events are triggered.
@carstenschwede carstenschwede changed the title Editor: MoveObjectCommand dispatches 'added' event Editor: MoveObjectCommand should dispatch 'added' event May 11, 2021
@mrdoob mrdoob added this to the r129 milestone May 11, 2021
@mrdoob mrdoob merged commit 02a82dd into mrdoob:dev May 11, 2021
@mrdoob
Copy link
Owner

mrdoob commented May 11, 2021

Thanks!

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