summaryrefslogtreecommitdiff
path: root/source/com/c2kernel/graph/controller/AutoScrollController.java
diff options
context:
space:
mode:
authorAndrew Branson <andrew@andrewbranson.net>2011-06-21 15:46:02 +0200
committerAndrew Branson <andrew@andrewbranson.net>2011-06-21 15:46:02 +0200
commit254ee6f47eebfc00462c10756a92066e82cc1a96 (patch)
tree8273ff95c704e6faa3f92b4711253427b9ba0481 /source/com/c2kernel/graph/controller/AutoScrollController.java
Initial commit2.2
Diffstat (limited to 'source/com/c2kernel/graph/controller/AutoScrollController.java')
-rwxr-xr-xsource/com/c2kernel/graph/controller/AutoScrollController.java39
1 files changed, 39 insertions, 0 deletions
diff --git a/source/com/c2kernel/graph/controller/AutoScrollController.java b/source/com/c2kernel/graph/controller/AutoScrollController.java
new file mode 100755
index 0000000..d1e0d8d
--- /dev/null
+++ b/source/com/c2kernel/graph/controller/AutoScrollController.java
@@ -0,0 +1,39 @@
+package com.c2kernel.graph.controller;
+
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseMotionListener;
+
+import com.c2kernel.graph.view.GraphPanel;
+
+
+public class AutoScrollController implements MouseMotionListener
+{
+ private GraphPanel mGraphPanel = null;
+
+
+ public void setGraphPanel(GraphPanel graphPanel)
+ {
+ mGraphPanel = graphPanel;
+ mGraphPanel.addMouseMotionListener(this);
+ }
+
+
+ public void mouseDragged(MouseEvent me)
+ {
+ Point mousePoint = null;
+
+
+ if(mGraphPanel != null)
+ {
+ mousePoint = me.getPoint();
+ mGraphPanel.scrollRectToVisible(new Rectangle(mousePoint.x, mousePoint.y, 1, 1));
+ }
+ }
+
+
+ public void mouseMoved(MouseEvent me)
+ {
+ }
+}