MCPcopy Create free account
hub / github.com/apache/cloudstack / _handleTapEvent

Method _handleTapEvent

systemvm/agent/noVNC/core/rfb.js:1445–1474  ·  view source on GitHub ↗
(ev, bmask)

Source from the content-addressed store, hash-verified

1443 }
1444
1445 _handleTapEvent(ev, bmask) {
1446 let pos = clientToElement(ev.detail.clientX, ev.detail.clientY,
1447 this._canvas);
1448
1449 // If the user quickly taps multiple times we assume they meant to
1450 // hit the same spot, so slightly adjust coordinates
1451
1452 if ((this._gestureLastTapTime !== null) &&
1453 ((Date.now() - this._gestureLastTapTime) < DOUBLE_TAP_TIMEOUT) &&
1454 (this._gestureFirstDoubleTapEv.detail.type === ev.detail.type)) {
1455 let dx = this._gestureFirstDoubleTapEv.detail.clientX - ev.detail.clientX;
1456 let dy = this._gestureFirstDoubleTapEv.detail.clientY - ev.detail.clientY;
1457 let distance = Math.hypot(dx, dy);
1458
1459 if (distance < DOUBLE_TAP_THRESHOLD) {
1460 pos = clientToElement(this._gestureFirstDoubleTapEv.detail.clientX,
1461 this._gestureFirstDoubleTapEv.detail.clientY,
1462 this._canvas);
1463 } else {
1464 this._gestureFirstDoubleTapEv = ev;
1465 }
1466 } else {
1467 this._gestureFirstDoubleTapEv = ev;
1468 }
1469 this._gestureLastTapTime = Date.now();
1470
1471 this._fakeMouseMove(this._gestureFirstDoubleTapEv, pos.x, pos.y);
1472 this._handleMouseButton(pos.x, pos.y, bmask);
1473 this._handleMouseButton(pos.x, pos.y, 0x0);
1474 }
1475
1476 _handleGesture(ev) {
1477 let magnitude;

Callers 1

_handleGestureMethod · 0.95

Calls 4

_fakeMouseMoveMethod · 0.95
_handleMouseButtonMethod · 0.95
clientToElementFunction · 0.90
nowMethod · 0.80

Tested by

no test coverage detected