From 037cb0d9268d036f2ecfa6e67bd8c0c445a8ad06 Mon Sep 17 00:00:00 2001 From: JuliaSvinareva Date: Wed, 11 Jan 2023 17:05:24 +0300 Subject: [PATCH] [DE PE SSE] Fix menu position when left < 0 for RTL --- apps/common/main/lib/component/Menu.js | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/apps/common/main/lib/component/Menu.js b/apps/common/main/lib/component/Menu.js index 34ba6d863..570faff17 100644 --- a/apps/common/main/lib/component/Menu.js +++ b/apps/common/main/lib/component/Menu.js @@ -657,14 +657,19 @@ define([ var left = offset.left - posMenu[m[1]][0] + posParent[m[2]][0] + this.offset[0]; var top = offset.top - posMenu[m[1]][1] + posParent[m[2]][1] + this.offset[1]; - if (left + menuW > docW) + if (left + menuW > docW) { if (menuParent.is('li.dropdown-submenu')) { left = offset.left - menuW + 2; } else { left = docW - menuW; } - if (left < 0) - left = 0; + } else if (left < 0) { + if (menuParent.is('li.dropdown-submenu')) { + left = offset.left + parentW - 2; + } else { + left = 0; + } + } if (this.options.restoreHeightAndTop) { // can change top position, if top<0 - then change menu height var cg = Common.Utils.croppedGeometry(); @@ -1163,12 +1168,19 @@ define([ var left = offset.left - posMenu[m[1]][0] + posParent[m[2]][0] + this.offset[0]; var top = offset.top - posMenu[m[1]][1] + posParent[m[2]][1] + this.offset[1]; - if (left + menuW > docW) + if (left + menuW > docW) { if (menuParent.is('li.dropdown-submenu')) { left = offset.left - menuW + 2; } else { left = docW - menuW; } + } else if (left < 0) { + if (menuParent.is('li.dropdown-submenu')) { + left = offset.left + parentW - 2; + } else { + left = 0; + } + } if (this.options.restoreHeight) { if (typeof (this.options.restoreHeight) == "number") {