[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-4' - loleaflet/src

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Mar 14 13:38:01 UTC 2019


 loleaflet/src/control/Control.LokDialog.js |   17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

New commits:
commit 751b8af0af38f3ab4b610b71a27b609099367e3b
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sat Feb 9 20:20:03 2019 -0500
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Mar 14 14:37:42 2019 +0100

    leaflet: child windows are top-level now
    
    This allows for expanding context-menus
    since the child submenu is no longer bound
    by the main context-menu, which is the parent.
    
    Change-Id: I88a24c2f16e08f98648eb01f97c0fdaff509461f
    Reviewed-on: https://gerrit.libreoffice.org/68251
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/loleaflet/src/control/Control.LokDialog.js b/loleaflet/src/control/Control.LokDialog.js
index cc4205560..9b5774fc6 100644
--- a/loleaflet/src/control/Control.LokDialog.js
+++ b/loleaflet/src/control/Control.LokDialog.js
@@ -625,16 +625,25 @@ L.Control.LokDialog = L.Control.extend({
 	},
 
 	_removeDialogChild: function(id) {
-		if (typeof id === 'number')
-			id = this._toStrId(id);
-		$('#' + id + '-floating').remove();
+		$('#' + this._toStrId(id) + '-floating').remove();
 	},
 
 	_createDialogChild: function(childId, parentId, top, left) {
 		var strId = this._toStrId(parentId);
-		var dialogContainer = L.DomUtil.get(strId);
+		var dialogContainer = L.DomUtil.get(strId).parentNode;
 		var floatingCanvas = L.DomUtil.create('canvas', 'lokdialogchild-canvas', dialogContainer);
 		$(floatingCanvas).hide(); // Hide to avoid flickering while we set the dimensions.
+
+		// Since child windows are now top-level, their 'top' offset
+		// needs adjusting. If we are in a dialog, our top is from the
+		// dialog body, not the title bar, which is a separate div.
+		// This doesn't apply for context menus, which don't have titles.
+		var dialogTitle = $('.lokdialog_notitle');
+		if (dialogTitle != null && dialogTitle.length == 0) {
+			var dialogTitleBar = $('.ui-dialog-titlebar');
+			top += dialogTitleBar.height() * L.getDpiScaleFactor();
+		}
+
 		floatingCanvas.id = strId + '-floating';
 		L.DomUtil.setStyle(floatingCanvas, 'position', 'absolute');
 		L.DomUtil.setStyle(floatingCanvas, 'left', left + 'px'); // yes, it's necessary to append 'px'


More information about the Libreoffice-commits mailing list