Skip to content

Latest commit

 

History

History
19 lines (13 loc) · 513 Bytes

onClick.md

File metadata and controls

19 lines (13 loc) · 513 Bytes
ex.onClick(displayObject, callback)

Small convenience function to make a PIXI.DisplayObject "clickable". It sets interactive to true, changes mouse cursor to pointer and adds a listener for click and tap events.

Arguments

displayObject (Object): The display object to make clickable.

callback (Function): Will be called on click and tap. Gets the Pixi event as an argument.

Example

ex.onClick(new Sprite(), (event) => {
  console.log('Sprite was clicked')
})