Skip to content

Commit

Permalink
Enable an otherwise nonexistant pan mode in the UI. (fixes #2)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
erinzm committed Aug 18, 2015
1 parent 40bbb03 commit cc58565
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/replicatorg/app/ui/modeling/Tool.java
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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;
Expand All @@ -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);
Expand Down

0 comments on commit cc58565

Please sign in to comment.