No events when drag target is removed from the scenegraph while dragging
sebastian.rheinnecker at yworks.com
Fri Aug 16 09:12:52 PDT 2013
well, the behavior we are looking for is being able to proceed with a
drag after the thing on which the drag started changed (got removed /
replaced). It doesn't sound very convenient for me that a thing that is
not in the scene graph anymore can still the mouse capture, which means
that no component of the whole application receives any mouse events at
all. I think that it is not an uncommon scenario for an application to
change things when a drag is detected.
A new DragEvent that starts where the old has ended because the target
became invalid sounds promising to me, but any solution is appreciated.
Should I file an issue in the JavaFX jira for it?
Am 16.08.2013 17:38, schrieb Richard Bair:
> The existing behavior does sound consistent at least. When a drag starts, the node "captures" the mouse and doesn't let go until the event concludes. This is the same as if the node had remained in the scene graph. Since the node is no longer in the scene graph, there is no hierarchy to bubble / filter / capture events in.
> What other options are there which would also work? We could send a mouse drag ended, mouse release, etc to the node which has been removed from the scene graph and then start a new drag event at the current location. I'm guessing this is the behavior you were looking for?
> On Aug 16, 2013, at 7:53 AM, Sebastian Rheinnecker <sebastian.rheinnecker at yworks.com> wrote:
>> we're not sure if we are doing something wrong but in our testing we noticed a behavior of javafx event processing that is unfortunate.
>> I attached a SSCCE that shows the issue. In the application, an ellipse shape is following the mouse, and when you click and drag, a listener that is called upon MouseEvent.DRAG_DETECTED removes the drag target from the scene graph (in this case, the ellipse) and immediately places a newly created ellipse in the same place.
>> The issue is: as soon as the ellipse (the drag target) is removed from the scene graph, no events are fired anymore for the entire drag operation *at all*. The sample application binds listeners to the scene, the stage and to the window but no mouse events are received until the user releases the mouse button. This happens in JavaFX 2.x as well as JavaFX 8.
>> We'd like to know if this is the intented behavior or a bug and if there is a way to receive the missing mouse events somehow.
>> Thanks in advance and kind regards,
>> Sebastian Rheinnecker
>> Sebastian Rheinnecker
>> phone: +49 7071 9709050
>> fax: +49 7071 9709051
>> yWorks GmbH
>> Vor dem Kreuzberg 28
>> 72070 Tuebingen
>> Managing Directors: Sebastian Müller, Michael Pfahler
>> Commercial Registry: Stuttgart, Germany, HRB 382340
phone: +49 7071 9709050
fax: +49 7071 9709051
Vor dem Kreuzberg 28
Managing Directors: Sebastian Müller, Michael Pfahler
Commercial Registry: Stuttgart, Germany, HRB 382340
More information about the openjfx-dev