MCPcopy
hub / github.com/KilledByAPixel/LittleJS / onMouseDown

Function onMouseDown

src/engineInput.js:413–430  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

411 k === 'KeyD' ? 'ArrowRight' : k : k;
412 }
413 function onMouseDown(e)
414 {
415 if (isTouchDevice && touchInputEnable) return;
416
417 // fix stalled audio requiring user interaction
418 if (soundEnable && !headlessMode && audioContext && !audioIsRunning())
419 audioContext.resume();
420
421 isUsingGamepad = false;
422 inputData[0][e.button] = 3;
423
424 const mousePosScreenLast = mousePosScreen;
425 mousePosScreen = mouseEventToScreen(vec2(e.x,e.y));
426 mouseDeltaScreen = mouseDeltaScreen.add(mousePosScreen.subtract(mousePosScreenLast));
427
428 if (inputPreventDefault && e.cancelable && document.hasFocus())
429 e.preventDefault();
430 }
431 function onMouseUp(e)
432 {
433 if (isTouchDevice && touchInputEnable) return;

Callers

nothing calls this directly

Calls 6

audioIsRunningFunction · 0.85
mouseEventToScreenFunction · 0.85
vec2Function · 0.85
resumeMethod · 0.45
addMethod · 0.45
subtractMethod · 0.45

Tested by

no test coverage detected