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

Method _handleGesture

systemvm/agent/noVNC/core/rfb.js:1476–1641  ·  view source on GitHub ↗
(ev)

Source from the content-addressed store, hash-verified

1474 }
1475
1476 _handleGesture(ev) {
1477 let magnitude;
1478
1479 let pos = clientToElement(ev.detail.clientX, ev.detail.clientY,
1480 this._canvas);
1481 switch (ev.type) {
1482 case 'gesturestart':
1483 switch (ev.detail.type) {
1484 case 'onetap':
1485 this._handleTapEvent(ev, 0x1);
1486 break;
1487 case 'twotap':
1488 this._handleTapEvent(ev, 0x4);
1489 break;
1490 case 'threetap':
1491 this._handleTapEvent(ev, 0x2);
1492 break;
1493 case 'drag':
1494 if (this.dragViewport) {
1495 this._viewportHasMoved = false;
1496 this._viewportDragging = true;
1497 this._viewportDragPos = {'x': pos.x, 'y': pos.y};
1498 } else {
1499 this._fakeMouseMove(ev, pos.x, pos.y);
1500 this._handleMouseButton(pos.x, pos.y, 0x1);
1501 }
1502 break;
1503 case 'longpress':
1504 if (this.dragViewport) {
1505 // If dragViewport is true, we need to wait to see
1506 // if we have dragged outside the threshold before
1507 // sending any events to the server.
1508 this._viewportHasMoved = false;
1509 this._viewportDragPos = {'x': pos.x, 'y': pos.y};
1510 } else {
1511 this._fakeMouseMove(ev, pos.x, pos.y);
1512 this._handleMouseButton(pos.x, pos.y, 0x4);
1513 }
1514 break;
1515 case 'twodrag':
1516 this._gestureLastMagnitudeX = ev.detail.magnitudeX;
1517 this._gestureLastMagnitudeY = ev.detail.magnitudeY;
1518 this._fakeMouseMove(ev, pos.x, pos.y);
1519 break;
1520 case 'pinch':
1521 this._gestureLastMagnitudeX = Math.hypot(ev.detail.magnitudeX,
1522 ev.detail.magnitudeY);
1523 this._fakeMouseMove(ev, pos.x, pos.y);
1524 break;
1525 }
1526 break;
1527
1528 case 'gesturemove':
1529 switch (ev.detail.type) {
1530 case 'onetap':
1531 case 'twotap':
1532 case 'threetap':
1533 break;

Callers

nothing calls this directly

Calls 6

_handleTapEventMethod · 0.95
_fakeMouseMoveMethod · 0.95
_handleMouseButtonMethod · 0.95
_handleKeyEventMethod · 0.95
clientToElementFunction · 0.90
viewportChangePosMethod · 0.80

Tested by

no test coverage detected