Grip / selectable
import compose.grips.*; GripDispatcher dispatch; CircleGrip myGrip; void setup() { dispatch = new GripDispatcher(this); myGrip = new CircleGrip(50, 50, 40); myGrip.selectable = true; } void draw() { dispatch.update(); // Checks for hover dispatch.draw(); // Calls all the draw methods }class CircleGrip extends Grip { float x, y, diameter; CircleGrip(float x, float y, float diameter) { this.x = x; this.y = y; this.diameter = diameter; } boolean isHovering() { return dist(mouseX, mouseY, x, y) < diameter/2; } void draw() { if (this.isTheActive()) { fill(0, 255, 0); } else { fill(255); } ellipse(x, y, diameter, diameter); } }- Description
By default, Grip objects are not selectable. Meaning that when the mouseRelease() event fires, the Grip will no longer be active, and isTheActive() will return false. If selectable is true, this Grip will retain active status until the user clicks elsewhere.
- Syntax
myGrip.selectable = true; myGrip.selectable = false;- Parameters
- None
- Returns
- None
- Usage
- Web & Applications
- Related
No Comments
You must be logged in to post a comment.