From cc5856574bfe5adf1223403f5b6f2b1cc0825218 Mon Sep 17 00:00:00 2001 From: Liam Marshall Date: Mon, 17 Aug 2015 20:13:27 -0500 Subject: [PATCH] Enable an otherwise nonexistant pan mode in the UI. (fixes #2) Thanks to @ryancnelson for the tip. (makerbot/ReplicatorG#284) The logic was setting ROTATE_VIEW for *everything* unconditionally, this changes it such that: * on a mac, when shift is held down and a mouse1 drag happens, it sets TRANSLATE_VIEW * on a !mac, when a button3 drag happens, it sets TRANSLATE_VIEW. --- src/replicatorg/app/ui/modeling/Tool.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/replicatorg/app/ui/modeling/Tool.java b/src/replicatorg/app/ui/modeling/Tool.java index aec55bf4..86ad9d5c 100644 --- a/src/replicatorg/app/ui/modeling/Tool.java +++ b/src/replicatorg/app/ui/modeling/Tool.java @@ -36,7 +36,7 @@ public AxisControl(String title, JPanel parent, double initial) { if (Tool.this instanceof ChangeListener) { spinner.addChangeListener((ChangeListener)Tool.this); } - } + } } public JButton createToolButton(String text, String iconPath) { @@ -58,20 +58,20 @@ public CoordinateControl(JPanel parent, Point3d coordinate) { axes[1] = new AxisControl("Y",parent, coordinate.y); axes[2] = new AxisControl("Z",parent, coordinate.z); } - + public void update() { axes[0].model.setValue(new Double(coordinate.x)); axes[1].model.setValue(new Double(coordinate.y)); axes[2].model.setValue(new Double(coordinate.z)); } } - + abstract String getTitle(); abstract String getButtonName(); abstract Icon getButtonIcon(); abstract String getInstructions(); abstract JPanel getControls(); - + final protected ToolPanel parent; public Tool(ToolPanel parent) { this.parent = parent; @@ -83,13 +83,13 @@ public Tool(ToolPanel parent) { public void mouseDragged(MouseEvent e) { if (startPoint == null) return; Point p = e.getPoint(); - DragMode mode = DragMode.ROTATE_VIEW; + DragMode mode = DragMode.ROTATE_VIEW; if (Base.isMacOS()) { if (button == MouseEvent.BUTTON1 && !e.isShiftDown()) { mode = DragMode.ROTATE_VIEW; } - else if (button == MouseEvent.BUTTON1 && e.isShiftDown()) { mode = DragMode.ROTATE_VIEW; } + else if (button == MouseEvent.BUTTON1 && e.isShiftDown()) { mode = DragMode.TRANSLATE_VIEW; } } else { if (button == MouseEvent.BUTTON1) { mode = DragMode.ROTATE_VIEW; } - else if (button == MouseEvent.BUTTON3) { mode = DragMode.ROTATE_VIEW; } + else if (button == MouseEvent.BUTTON3) { mode = DragMode.TRANSLATE_VIEW; } } double xd = (double)(p.x - startPoint.x); double yd = (double)(p.y - startPoint.y);