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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Mar 5 01:30:14 UTC 2019


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

New commits:
commit 43161ba382a7c56fe589e4a1621798134f54d718
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sat Feb 9 20:20:03 2019 -0500
Commit:     Ashod Nakashian <ashnakash at gmail.com>
CommitDate: Tue Mar 5 02:29:56 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/68721
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.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