Merge pull request #27 from BrhmDev/fix/sidebar-on-right-not-alwyas-saying-open-on-mouse-overshoot

Fix rightside sidebar not always staying open when overshooting mouse.
This commit is contained in:
mauro 🤙 2024-09-23 18:02:03 +02:00 committed by GitHub
commit 9e29485e54
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -219,9 +219,9 @@ var gZenCompactModeManager = {
},
_getCrossedEdge(posX, posY, element = document.documentElement, maxDistance = 10) {
posX = Math.max(0, posX);
posY = Math.max(0, posY);
const targetBox = element.getBoundingClientRect();
posX = Math.max(targetBox.left, Math.min(posX, targetBox.right));
posY = Math.max(targetBox.top, Math.min(posY, targetBox.bottom));
return ["top", "bottom", "left", "right"].find((edge, i) => {
const distance = Math.abs((i < 2 ? posY : posX) - targetBox[edge]);
return distance <= maxDistance;