eventPrependedFxn = function eventPrependedFxn(event) {
              this._pInst._setProperty('mouseIsPressed', true);
              this._pInst._setMouseButton(event);
              // Pass along the return-value of the callback:
              return fxn.call(this);
            }
The .<a href="#/p5.Element/mousePressed">mousePressed()</a> function is called
once after every time a mouse button is pressed over the element. Some mobile
browsers may also trigger this event on a touch screen, if the user performs
a quick tap. This can be used to attach element specific event listeners.

@method mousePressed
@param  {Function|Boolean} fxn function to be fired when mouse is
                               pressed over the element.
                               if `false` is passed instead, the previously
                               firing function will no longer fire.
@chainable
@example
<div class='norender'><code>
let cnv, d, g;
function setup() {
  cnv = createCanvas(100, 100);
  cnv.mousePressed(changeGray); // attach listener for
  // canvas click only
  d = 10;
  g = 100;
}

function draw() {
  background(g);
  ellipse(width / 2, height / 2, d, d);
}

// this function fires with any click anywhere
function mousePressed() {
  d = d + 10;
}

// this function fires only when cnv is clicked
function changeGray() {
  g = random(0, 255);
}
</code></div>

@alt
no display.