Skip to content

Commit

Permalink
Add cursor styling resolves Lartu#14
Browse files Browse the repository at this point in the history
  • Loading branch information
ArztKlein committed Jun 27, 2022
1 parent 9250b62 commit b316a0f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion library/p5.clickable.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@ var cl_clickables = [];
//each draw cycle.
p5.prototype.runGUI = function () {
for (i = 0; i < cl_clickables.length; ++i) {
if (cl_lastHovered != cl_clickables[i])
if (cl_lastHovered != cl_clickables[i]){
cursor("initial"); // Reset the cursor as it is no longer hovering the clickable.
cl_clickables[i].onOutside();
}
}
if (cl_lastHovered != null) {
if (cl_lastClicked != cl_lastHovered) {
cursor(cl_lastHovered.hoverCursorStyle);
cl_lastHovered.onHover();
}
}
Expand Down Expand Up @@ -69,6 +72,7 @@ function Clickable(x,y) {
this.textSize = 12; //Size for the text shown
this.textFont = "sans-serif"; //Font for the text shown
this.textScaled = false; //Scale the text with the size of the clickable
this.hoverCursorStyle = "pointer" //The cursor style when clickable is hovered

// image options
this.image = null; // image object from p5loadimage()
Expand Down

0 comments on commit b316a0f

Please sign in to comment.