mirror of
https://github.com/zen-browser/components.git
synced 2025-07-08 01:10:12 +02:00
Make gZenCompactModeManager._getCrossedEdge work with any element.
This commit is contained in:
parent
9ac29437d8
commit
3cb4bb194f
1 changed files with 2 additions and 2 deletions
|
@ -220,8 +220,8 @@ var gZenCompactModeManager = {
|
|||
|
||||
_getCrossedEdge(posX, posY, element = document.documentElement, maxDistance = 10) {
|
||||
const targetBox = element.getBoundingClientRect();
|
||||
posX = Math.max(0, Math.min(posX, targetBox["right"]));
|
||||
posY = Math.max(0, Math.min(posY, targetBox["bottom"]));
|
||||
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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue