[][src]Static p5_sys::global::mouseReleased

pub static mouseReleased: MouseReleasedInternalType

The mouseReleased() function is called every time a mouse button is released. If no mouseReleased() function is defined, the touchEnded() function will be called instead if it is defined.

Browsers may have different default behaviors attached to various mouse events. To prevent any default behavior for this event, add "return false" to the end of the method.

Examples

// Click within the image to change
// the value of the rectangle
// after the mouse has been clicked

let value = 0;
function draw() {
  fill(value);
  rect(25, 25, 50, 50);
}
function mouseReleased() {
  if (value === 0) {
    value = 255;
  } else {
    value = 0;
  }
}
function mouseReleased() {
  ellipse(mouseX, mouseY, 5, 5);
  // prevent default
  return false;
}
// returns a MouseEvent object
// as a callback argument
function mouseReleased(event) {
  console.log(event);
}

Parameters

event? optional MouseEvent callback argument.