[Libreoffice-commits] online.git: loleaflet/src

gokaysatir (via logerrit) logerrit at kemper.freedesktop.org
Tue Aug 18 17:53:00 UTC 2020


 loleaflet/src/control/Control.LokDialog.js |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

New commits:
commit 46e996c76f8f03b4ff8c55f15a3375a1d76fae48
Author:     gokaysatir <gokaysatir at collabora.com>
AuthorDate: Thu Aug 13 20:37:32 2020 +0300
Commit:     Henry Castro <hcastro at collabora.com>
CommitDate: Tue Aug 18 19:52:41 2020 +0200

    loleaflet: Make sure lokchild window is not rendered off screen.
    
    Change-Id: Ib1d8c045750aeb653d8b1d1e962711e5da1705fe
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/100683
    Tested-by: Jenkins
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Henry Castro <hcastro at collabora.com>

diff --git a/loleaflet/src/control/Control.LokDialog.js b/loleaflet/src/control/Control.LokDialog.js
index 40e422e02..e9440b15f 100644
--- a/loleaflet/src/control/Control.LokDialog.js
+++ b/loleaflet/src/control/Control.LokDialog.js
@@ -1562,6 +1562,14 @@ L.Control.LokDialog = L.Control.extend({
 			var newLeft = window.innerWidth - width - 20;
 			L.DomUtil.setStyle(canvas, 'left', newLeft + 'px');
 		}
+		// Also, make sure child is not trimmed on bottom.
+		var top = parseInt(canvas.style.top);
+		var height = this._dialogs[parentId].childheight;
+		var bottomPos = top + height;
+		if (bottomPos > window.innerHeight) {
+			var newTop = top - height - 20;
+			L.DomUtil.setStyle(canvas, 'top', newTop + 'px');
+		}
 
 		// The image is rendered per the HiDPI scale we used
 		// while requesting rendering the image. Here we
@@ -1674,7 +1682,7 @@ L.Control.LokDialog = L.Control.extend({
 		var grandParentID = dialogContainer.parentNode.id;
 		if (grandParentID.includes('sidebar-panel'))
 		{
-			// This is a sidebar.
+			// floatingCanvas is a child window of a sidebar.
 			L.DomUtil.setStyle(floatingCanvas, 'left', (containerLeft + left) + 'px');
 			L.DomUtil.setStyle(floatingCanvas, 'top', (containerTop + top) + 'px');
 		}


More information about the Libreoffice-commits mailing list