-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from villares/patch-2
Reassign Drag Handlers example
- Loading branch information
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} |