MCPcopy Create free account
hub / github.com/melonjs/melonJS / clicked

Method clicked

packages/melonjs/src/renderable/ui/uibaseelement.ts:96–118  ·  view source on GitHub ↗

* function callback for the pointerdown event * @ignore

(event: Pointer)

Source from the content-addressed store, hash-verified

94 * @ignore
95 */
96 clicked(event: Pointer): boolean | void {
97 // Check if left mouse button is pressed
98 if (event.button === 0 && this.isClickable) {
99 this.isDirty = true;
100 this.released = false;
101 if (this.isHoldable) {
102 timer.clearTimer(this.holdTimeout);
103 this.holdTimeout = timer.setTimeout(
104 () => {
105 this.hold();
106 },
107 this.holdThreshold,
108 false,
109 );
110 this.released = false;
111 }
112 if (this.isDraggable) {
113 this.grabOffset!.set(event.gameX, event.gameY);
114 this.grabOffset!.sub(this.pos);
115 }
116 return this.onClick(event);
117 }
118 }
119
120 /**
121 * function called when the object is pressed (to be extended)

Callers 2

onActivateEventMethod · 0.95
ui.spec.jsFile · 0.45

Calls 6

holdMethod · 0.95
onClickMethod · 0.95
clearTimerMethod · 0.80
setTimeoutMethod · 0.80
setMethod · 0.45
subMethod · 0.45

Tested by

no test coverage detected