aboutsummaryrefslogtreecommitdiff
path: root/src/GraphEventHandler.java
diff options
context:
space:
mode:
authorJoshua Rahm <joshua.rahm@colorado.edu>2015-01-30 17:11:48 -0700
committerJoshua Rahm <joshua.rahm@colorado.edu>2015-01-30 17:11:48 -0700
commit1c5e38fe69ac8a6decbdd8abe93112f4e3369315 (patch)
tree926cef8cb76d46862ed2c4ec7028720611e47476 /src/GraphEventHandler.java
downloadModulus3D-1c5e38fe69ac8a6decbdd8abe93112f4e3369315.tar.gz
Modulus3D-1c5e38fe69ac8a6decbdd8abe93112f4e3369315.tar.bz2
Modulus3D-1c5e38fe69ac8a6decbdd8abe93112f4e3369315.zip
added source
Diffstat (limited to 'src/GraphEventHandler.java')
-rw-r--r--src/GraphEventHandler.java66
1 files changed, 66 insertions, 0 deletions
diff --git a/src/GraphEventHandler.java b/src/GraphEventHandler.java
new file mode 100644
index 0000000..ff56fb9
--- /dev/null
+++ b/src/GraphEventHandler.java
@@ -0,0 +1,66 @@
+/* */ import java.awt.Point;
+/* */ import java.awt.event.MouseEvent;
+/* */ import java.awt.event.MouseListener;
+/* */ import java.awt.event.MouseMotionListener;
+/* */ import java.awt.event.MouseWheelEvent;
+/* */ import java.awt.event.MouseWheelListener;
+/* */
+/* */ public class GraphEventHandler
+/* */ implements MouseListener, MouseMotionListener, MouseWheelListener
+/* */ {
+/* */ private Point lastClick;
+/* */ private Graph2D graph;
+/* */
+/* */ public GraphEventHandler(Graph2D target)
+/* */ {
+/* 19 */ this.graph = target;
+/* */ }
+/* */
+/* */ public void mouseClicked(MouseEvent e) {
+/* 23 */ this.lastClick = e.getPoint();
+/* */ }
+/* */
+/* */ public void mouseEntered(MouseEvent e)
+/* */ {
+/* */ }
+/* */
+/* */ public void mouseExited(MouseEvent e)
+/* */ {
+/* */ }
+/* */
+/* */ public void mousePressed(MouseEvent e)
+/* */ {
+/* 38 */ this.lastClick = e.getPoint();
+/* */ }
+/* */
+/* */ public void mouseReleased(MouseEvent e)
+/* */ {
+/* 44 */ this.lastClick = e.getPoint();
+/* */ }
+/* */
+/* */ public void mouseDragged(MouseEvent e)
+/* */ {
+/* 50 */ Point move = e.getPoint();
+/* */
+/* 52 */ double difx = (move.x - this.lastClick.x) * this.graph.getXRes();
+/* 53 */ double dify = (move.y - this.lastClick.y) * this.graph.getYRes();
+/* 54 */ this.graph.setWindowRange(this.graph.getWindowRange().getTranslatedInstance(difx, dify));
+/* 55 */ this.graph.recreate();
+/* 56 */ this.graph.repaint();
+/* 57 */ this.lastClick = e.getPoint();
+/* */ }
+/* */
+/* */ public void mouseMoved(MouseEvent e)
+/* */ {
+/* */ }
+/* */
+/* */ public void mouseWheelMoved(MouseWheelEvent e)
+/* */ {
+/* 67 */ this.graph.zoom(Math.min(Math.pow(1.2D, e.getWheelRotation()), 1.728D));
+/* */ }
+/* */ }
+
+/* Location: Modulus.jar
+ * Qualified Name: GraphEventHandler
+ * JD-Core Version: 0.6.2
+ */ \ No newline at end of file