How to Automatically Scroll the View During Mouse Drag Gestures
Questions & AnswersSummary
AutoDragViewMode adds automatic scrolling capabilities to Graph2DView instances.
Description
Class AutoDragViewMode is a ViewMode implementation that automatically scrolls the current view when the cursor is moved outside of the view's bounds during a mouse drag gesture. In particular, this covers the following mouse gestures:
- moving selected graph elements
- creating an edge
- resizing nodes
- moving a label to another label position
AutoDragViewMode can be registered alongside any other view mode as shown in the following sample code snippet.
// Get the view instance.
Graph2DView view = getTheCurrentViewOfMyApplication();
// Create the view mode.
AutoDragViewMode advm = new AutoDragViewMode();
// Register it with the view.
view.addViewMode(advm);
Categories this article belongs to:
yFiles for Java > yFiles Viewer > Displaying and Editing Graphs > User Interaction
Applies to:
yFiles for Java 2: 2.5, 2.6, 2.7, 2.8, 2.9, 2.10, 2.11, 2.12, 2.13, 2.14, 2.15, 2.16, 2.17, 2.18
Keywords:
AutoDragViewMode - ViewMode - automatic - scroll - view - mode - mouse - drag - dragging - outside - Graph2DView - gesture