Skip to content

Commit

Permalink
Reassign Drag Handlers example
Browse files Browse the repository at this point in the history
  • Loading branch information
villares authored Jun 16, 2018
1 parent 9529f5d commit f38b322
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions examples/ReassignDragHandler/ReassignDragHandler.pde
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import peasy.*;

PeasyCam cam;

void setup() {
size(600, 600, P3D);

cam = new PeasyCam(this, 100);
cam.setMinimumDistance(100);
cam.setMaximumDistance(500);

// Reassign some drag handlers in order to free the left-click-mouse-drag for other uses
PeasyDragHandler orbitDH = cam.getRotateDragHandler(); // get the RotateDragHandler
cam.setCenterDragHandler(orbitDH); // set it to the Center/Wheel drag
PeasyDragHandler panDH = cam.getPanDragHandler(); // get the PanDragHandler
cam.setRightDragHandler(panDH); // set it to the right-button mouse drag
cam.setLeftDragHandler(null); // sets no left-drag Handler
}
void draw() {
background(0);
fill(255, 0, 0);
box(30);
pushMatrix();
translate(0, 0, 20);
fill(0, 0, 255);
box(5);
popMatrix();
}

0 comments on commit f38b322

Please sign in to comment.