Community
Participate
Working Groups
A GMF client application would like to have autoscrolling support in the tools when dragging the mouse pointer outside the viewport. We would like to add this support in GMF. To do this, we need access to the autoexpose helper in the TargetingTool and the ability to change the criteria for when a scroll will occur in the ViewportAutoexposeHelper. I am attaching patch with the changes. Alex has already reviewed the code.
Created attachment 55918 [details] Suggested fix.
FYI- This request has been made many times. I don't see any real issues with the code changes (patch), but there *is* a problem with the behavior you're trying to acheive: 1) Auto-Scrolling when outside the viewport is not the correct platform behavior. PowerPoint does not do this. Word doesn't do it. Window File Explorer doesn't do it. No one does this because of 2): 2) Scrolling outside the viewport is impossible during a DND drop. If the mouse is not over the Canvas, then some other target control is receiving the DND events, therefore the canvas can not be scrolled. This means you're creating two gestures for the user to invoke auto-scrolling. 3) The behavior is not cross-platform. It can not be supported on GTK. I agree the current behavior is not perfect. But, one way to make it "better", or more like MS Office, File Explorer, not to mention the native SWT widgets during DND (Tree, Table, List, etc.), would be to change the cursor to a NOT sign when outside the canvas. The user would immediately bring the mouse back inside and find the current trigger area.
There is one other motivation to stick with platform convention. If bug 106605 is ever fixed in SWT, then GEF will be able to drag from inside a diagram to some other control, like another editor, etc. In that case when the mouse leaves the canvas, it should start looking for external drop targets, rather than.
Yes, there is a chance in the future we may want to support dropping between editors or something like that, so I see how this would limit that. I have modified the GMF code so that it scrolls when the user is near the border and the cursor changes to the disabled icon when outside the viewport. However, it is still a bit hard for a user to discover this. I am going to try to come up with another icon to use as the cursor when near the edge that will show that if you stay near the edge scrolling will occur.
You might have to extend the autoexposehelper API to allow cursor contribution.
Created attachment 56293 [details] Add getAutoexposeHelper() method. I would like to implement this in GMF in the way Randy suggests. When the user drags a shape to the 'critical zone' near the edge of the viewport, the cursor changes to show that something can happen here (i.e. scrolling). When the user drags a shape outside the viewport, the cursor changes to the disabled icon. I am implementing this in the DragEditpartTracker in which case I need to be able to know if there is an autoexpose helper that will do the auto-scrolling. Therefore, I am requesting that a getter for the autoexpose helper be available.
javadoc should read: * Returns <code>null</code> or the current autoexpose helper. + * @return null or a helper
Created attachment 56331 [details] Updated with new comments
Anthony, can you commit this when you get a chance?
Committed patch to HEAD and R32_Maintenance. Also updated the copyright to indicate change in 2007.