Module: check_mk
Branch: master
Commit: a16a46ad23bc57fb2584861162822be9ef68e70e
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a16a46ad23bc57…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Mar 3 08:57:17 2016 +0100
#3230 FIX Slightly improved popup menu positioning when hitting right+left or bottom+top
border of screen/dashlet
---
.werks/3230 | 10 ++++++++++
ChangeLog | 1 +
web/htdocs/js/checkmk.js | 27 +++++++++++++++++++++------
3 files changed, 32 insertions(+), 6 deletions(-)
diff --git a/.werks/3230 b/.werks/3230
new file mode 100644
index 0000000..5de8c06
--- /dev/null
+++ b/.werks/3230
@@ -0,0 +1,10 @@
+Title: Slightly improved popup menu positioning when hitting right+left or bottom+top
border of screen/dashlet
+Level: 1
+Component: multisite
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.9i1
+Date: 1456991805
+
+
diff --git a/ChangeLog b/ChangeLog
index 47a09e7..f772c50 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -65,6 +65,7 @@
* 3181 FIX: Omit icon for downloading agent output on shadow hosts (cmcdump)...
* 3248 FIX: Avoid broken list of context filters and case of a BI error
* 3251 FIX: Fix sorting of entries in Views sidebar element
+ * 3230 FIX: Slightly improved popup menu positioning when hitting right+left or
bottom+top border of screen/dashlet
WATO:
* 3244 WATO BI Module: swap order of aggregation function and child node
selection...
diff --git a/web/htdocs/js/checkmk.js b/web/htdocs/js/checkmk.js
index ae2ac9f..7e301ce 100644
--- a/web/htdocs/js/checkmk.js
+++ b/web/htdocs/js/checkmk.js
@@ -2623,17 +2623,32 @@ function fix_popup_menu_position(event, menu) {
// Check whether or not the menu is out of the bottom border
// -> if so, move the menu up
if (rect.bottom > (window.innerHeight || document.documentElement.clientHeight))
{
- menu.style.top = 'auto';
- menu.style.bottom = '15px';
+ var height = rect.bottom - rect.top;
+ if (rect.top - height < 0) {
+ // would hit the top border too, then put the menu to the top border
+ // and hope that it fits within the screen
+ menu.style.top = '-' + (rect.top - 15) + 'px';
+ menu.style.bottom = 'auto';
+ } else {
+ menu.style.top = 'auto';
+ menu.style.bottom = '15px';
+ }
}
// Check whether or not the menu is out of right border and
// a move to the left would fix the issue
// -> if so, move the menu to the left
- if (rect.right > (window.innerWidth || document.documentElement.clientWidth)
- && rect.left - (rect.right - rect.left) >= 0) {
- menu.style.left = 'auto';
- menu.style.right = '15px';
+ if (rect.right > (window.innerWidth || document.documentElement.clientWidth)) {
+ var width = rect.right - rect.left;
+ if (rect.left - width < 0) {
+ // would hit the left border too, then put the menu to the left border
+ // and hope that it fits within the screen
+ menu.style.left = '-' + (rect.left - 15) + 'px';
+ menu.style.right = 'auto';
+ } else {
+ menu.style.left = 'auto';
+ menu.style.right = '15px';
+ }
}
}