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

161 -> 162 DragControls breaks for multiple groups #28681

Closed
jedleslie opened this issue Jun 17, 2024 · 3 comments
Closed

161 -> 162 DragControls breaks for multiple groups #28681

jedleslie opened this issue Jun 17, 2024 · 3 comments
Labels
Milestone

Comments

@jedleslie
Copy link

jedleslie commented Jun 17, 2024

Description

I think this is related to the issue solved by PR #27791.

When enabling DragControls after 162, the Drag Controls onDrag handlers do not return the drag object inside the e.object. The drag object is one passed into the DragControls ctor, but when the events fire they are returning the parent object of that drag object.

Reproduction steps

  1. Create a scene and add 2 group objects to the root of the scene
  2. Enable just one of them in the DragControls ctor
  3. View the onDrag event from the DragControls and see that it passses the object's parent as the "item being dragged" in the event.

Code

// code goes here

Live example

Screenshots

No response

Version

0.162

Device

Desktop

Browser

Chrome

OS

MacOS

@Mugen87
Copy link
Collaborator

Mugen87 commented Jun 17, 2024

Can you please demonstrate with a fiddle what's going wrong: https://jsfiddle.net/narenjcs/8ret1b9z/13/

It's currently not clear to me if this is a bug or if it is just the expected behavior.

@Mugen87 Mugen87 added the Addons label Jun 17, 2024
@Mugen87
Copy link
Collaborator

Mugen87 commented Jun 29, 2024

I've created a fiddle by myself: https://jsfiddle.net/3cbrz8k4/3/

What we see is the expected behavior when enabling on transformGroup.

Objects organized in groups usually are logically connected so it makes sense when transformGroup is set to true, the entire group is affected. I understand there is the use case if just a single object of the hierarchy is added to the controls and transformGroup is set to true. In this case, users might expect the controls do not affect the hierarchy. But I'm unsure if this is right considering that enabling transformGroup should transform groups. That's the hole point of the property.

Nevertheless, we could basically check if the detected group is part of the objects array maintained by DragControls but that would potentially break other use cases which rely on the current behavior. As long as no other devs report the issue, let's keep the current default.

@Mugen87 Mugen87 closed this as not planned Won't fix, can't repro, duplicate, stale Jun 29, 2024
@Mugen87 Mugen87 added this to the r167 milestone Jun 29, 2024
@Mugen87
Copy link
Collaborator

Mugen87 commented Jun 29, 2024

Nevertheless, we could basically check if the detected group is part of the objects array maintained by DragControls

Here is a custom version of DragControls that implements the suggested fix: https://jsfiddle.net/3bc8Lov7/

There is now a new helper function inObjects() that checks whether a found group belongs to the object hierarchies managed by DragControls.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants