Autoscrolling problem


We have a problem i our application which seems to be present in some of your examples as well.

When dragging an icon to the edge of the drawing area the area is automatically resized. However, if the icon is dragged outside the window the resizing stops. If the mouse button is released when outside the window, the icon snaps back to its original position.

The same problem also exists when doing a rubberband area selection, drag the box to the edge of the area and the area will be scrolled, but if you go to far, the scrolling stops.

This behaviour can also be seen in the Flower example.

Is there any way to get the scrolling to continue when dragging outside the window?


That’s actually intentional, because dragging a node beyond the JGoView should be construed as a drag-and-drop to another window.
I suppose the behavior could be different for rubber-band selection, but it isn’t.

Aha, I see. That makes sense.

Is there any way to change that? We only have one open draw area at a time, so drag and drop isn’t something we need.

Thanks again.

Well, to turn off the ability to drag something from a JGoView, call JGoView.setDragEnabled(false).
Autoscrolling is part of Java drag-and-drop, so you don’t get that if you disable drag-and-drop. I suppose you could implement a Swing Timer that would call JGoView.autoscroll. Override JGoView.doMouseMove to consider starting or stopping autoscrolling.
(Our SWT implementation had to implement this, although like the Swing implementation, autoscrolling is limited to the region just inside the JGoView.)

Ok, thanks for your help. I’ll see if I can get anything to work.