loleaflet/src/control/Control.LokDialog.js |   11 +++++++++++
 1 file changed, 11 insertions(+)

New commits:
commit 2ccb0c2b0a84242251f440c1f18bfba9dc1b7f84
Author:     Ashod Nakashian <ashod.nakash...@collabora.co.uk>
AuthorDate: Mon Apr 27 10:01:14 2020 -0400
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Sat May 2 22:59:26 2020 +0200

    leaflet: re-align child popups to avoid trimming
    
    When a child's origin is such that its width
    overflows its parent, we move it left such that
    it fits the parent and doesn't get trimmed.
    
    Change-Id: Ica8e0e9c8ce994aeb00704eb38ce3485db7cbd59
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92995
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Andras Timar <andras.ti...@collabora.com>

diff --git a/loleaflet/src/control/Control.LokDialog.js 
b/loleaflet/src/control/Control.LokDialog.js
index dd0a78113..9c92895b2 100644
--- a/loleaflet/src/control/Control.LokDialog.js
+++ b/loleaflet/src/control/Control.LokDialog.js
@@ -1513,6 +1513,17 @@ L.Control.LokDialog = L.Control.extend({
                if (!canvas)
                        return; // no floating window to paint to
 
+               // Make sure the child is not trimmed on the right.
+               var width = this._dialogs[parentId].childwidth;
+               var left = this._dialogs[parentId].childx;
+               var dialogContainer = L.DomUtil.get(strId).parentNode;
+               if (left + width > dialogContainer.clientWidth) {
+                       // Align the right of the child to the right of the 
parent.
+                       left -= Math.max(0, (left + width) - 
dialogContainer.clientWidth);
+                       this._dialogs[parentId].childx = left;
+                       L.DomUtil.setStyle(canvas, 'left', left + 'px');
+               }
+
                // The image is rendered per the HiDPI scale we used
                // while requesting rendering the image. Here we
                // set the canvas to have the actual size, while
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to