MCPcopy Create free account
hub / github.com/NikLever/ThreeJS-PathEditor / positionMenu

Method positionMenu

menu.js:81–101  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

79 }
80
81 positionMenu(e) {
82 let clickCoords = this.getPosition(e);
83
84 let menuWidth = this.menu.offsetWidth + 4;
85 let menuHeight = this.menu.offsetHeight + 4;
86
87 let windowWidth = window.innerWidth;
88 let windowHeight = window.innerHeight;
89
90 if (windowWidth - clickCoords.x < menuWidth) {
91 this.menu.style.left = windowWidth - menuWidth + "px";
92 } else {
93 this.menu.style.left = clickCoords.x + "px";
94 }
95
96 if (windowHeight - clickCoords.y < menuHeight) {
97 this.menu.style.top = windowHeight - menuHeight + "px";
98 } else {
99 this.menu.style.top = clickCoords.y + "px";
100 }
101 }
102}

Callers 1

showMethod · 0.95

Calls 1

getPositionMethod · 0.95

Tested by

no test coverage detected