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

Function dragControlbarHandle

systemvm/agent/noVNC/app/ui.js:659–691  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

657 },
658
659 dragControlbarHandle(e) {
660 if (!UI.controlbarGrabbed) return;
661
662 const ptr = getPointerEvent(e);
663
664 const anchor = document.getElementById('noVNC_control_bar_anchor');
665 if (ptr.clientX < (window.innerWidth * 0.1)) {
666 if (anchor.classList.contains("noVNC_right")) {
667 UI.toggleControlbarSide();
668 }
669 } else if (ptr.clientX > (window.innerWidth * 0.9)) {
670 if (!anchor.classList.contains("noVNC_right")) {
671 UI.toggleControlbarSide();
672 }
673 }
674
675 if (!UI.controlbarDrag) {
676 const dragDistance = Math.abs(ptr.clientY - UI.controlbarMouseDownClientY);
677
678 if (dragDistance < dragThreshold) return;
679
680 UI.controlbarDrag = true;
681 }
682
683 const eventY = ptr.clientY - UI.controlbarMouseDownOffsetY;
684
685 UI.moveControlbarHandle(eventY);
686
687 e.preventDefault();
688 e.stopPropagation();
689 UI.keepControlbar();
690 UI.activateControlbar();
691 },
692
693 // Move the handle but don't allow any position outside the bounds
694 moveControlbarHandle(viewportRelativeY) {

Callers

nothing calls this directly

Calls 2

getPointerEventFunction · 0.90
containsMethod · 0.45

Tested by

no test coverage detected