Sprites that detach themselves when pressed should be dragged independently

Steps to reproduce:

  1. Create two sprites. Call the first sprite "Part", and the second "Anchor".
  2. Set "Part"'s anchor to "Anchor".
  3. Construct this script in the "Part", which I expect would detach the part from its anchor when pressed or dragged.
    pressed dragging bug
  4. Try to drag the part.

Example project:


When you press down on the part, it detaches from the anchor as expected. But when you begin dragging, you start dragging the anchor, while the part doesn't even move!

I believe the correct behaviour here is for the drag to be initiated on the part itself, rather than the anchor.

This behaviour would be very useful for a variety of use cases - GUIs where you can drag icons and items out of windows, games where you can assemble and disassemble physical machines, and even a "Snap!-in-Snap!" kind of thing where you can drag blocks into and out of other blocks.


I'm imagining that when a sprite is anchored then all mouse events are being directed towards the anchor and not the part

So, since we are in the middle of a mouse-pressed event, all mouse movements are going to apply to the anchor

Might be easy to correct but my guess is not (just a guess mind - not looked at code)

I have come up with a workaround but it might suffer from edge cases as well of course :slight_smile: