nakarte

Source code of https://map.sikmir.ru (fork)
git clone git://git.sikmir.ru/nakarte
Log | Files | Refs | LICENSE

commit 80d5c77c1d29dc4c6e747edbbdd40d6917ab7da1
parent b3d7d84838e2d8234dccb6b1f35a1bb273018c15
Author: Sergey Orlov <wladimirych@gmail.com>
Date:   Mon, 24 Aug 2020 10:14:38 +0200

context menu: fix off-screen position on small screens

Diffstat:
Msrc/lib/contextmenu/index.js | 6++++++
1 file changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/lib/contextmenu/index.js b/src/lib/contextmenu/index.js @@ -88,9 +88,15 @@ class Contextmenu { menu_height = this._container.offsetHeight; if (x + menu_width >= window_width) { x -= menu_width; + if (x < 0) { + x = 0; + } } if (y + menu_height >= window_height) { y -= menu_height; + if (y < 0) { + y = 0; + } } this._container.style.left = `${x}px`; this._container.style.top = `${y}px`;