RFR: 8333919: dragViewOffsetX/dragViewOffsetY are ignored for the dragView image [v2]

Andy Goryachev angorya at openjdk.org
Mon Aug 12 16:24:36 UTC 2024


On Mon, 12 Aug 2024 16:02:32 GMT, Jose Pereda <jpereda at openjdk.org> wrote:

>> Right, there is a built-in native animation from the offset point to the mouse cursor (in and out). 
>> 
>> When the drag event is cancelled, the image returns to the offset location with this animation. We still want that, so I wouldn't remove the animation (if we could), but of course, with the original position of the source, no far away from it, so it makes sense to clamp between the image bounds. 
>> 
>> And doing the same (clamping) for Windows would be a separate issue, indeed.
>
> By the way, this is how you can disable the cancel animation:
> 
> 
> diff --git a/modules/javafx.graphics/src/main/native-glass/mac/GlassDraggingSource.m b/modules/javafx.graphics/src/main/native-glass/mac/GlassDraggingSource.m
> index 50a79cabf6..373537f24e 100644
> --- a/modules/javafx.graphics/src/main/native-glass/mac/GlassDraggingSource.m
> +++ b/modules/javafx.graphics/src/main/native-glass/mac/GlassDraggingSource.m
> @@ -40,6 +40,7 @@
>  
>  - (NSDragOperation)draggingSession:(NSDraggingSession *)session sourceOperationMaskForDraggingContext:(NSDraggingContext)context
>  {
> +     session.animatesToStartingPositionsOnCancelOrFail = NO;
>      // The Command key masks out every operation other than NSDragOperationGeneric. We want
>      // internal Move events to get through this filtering so we copy the Move bit into the
>      // Generic bit and treat Generic as a synonym for Move.
> 
> 
> I'm still in favour of this native animation, as opposed to the Windows case that doesn't have it. This can be a separated issue as well (unifying the animation in all platforms).

I wanted to chime in, thought it might be unrelated:

In the context of a docking framework, it is impossible to disable the cancel animation.  We should have a way to disable it.  The use case is when the user drags and drops a tab/pane outside of the dockable windows.  In this case a new window should appear at the drop location, without the drag image animated back to the start position.

Another thing that is impossible is to control the drag image: sometimes one needs a scaled icon, sometimes one wants the full content.

These two issues basically prevent implementing a docking framework via DnD, one needs to use other solution, for example
https://github.com/andy-goryachev/FxDock

-------------

PR Review Comment: https://git.openjdk.org/jfx/pull/1532#discussion_r1714071087


More information about the openjfx-dev mailing list