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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Mar 4 14:34:42 UTC 2019


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

New commits:
commit a1e3eb599dca0095f5598fe2bfcd0c5d4d5073c0
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sun Feb 3 21:33:52 2019 -0500
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Mon Mar 4 15:34:24 2019 +0100

    leaflet: render child windows in HiDPI
    
    Aparently we were not setting the dimensions
    of the child canvas correctly.
    
    This also fixed the issue with horizontal scrollbar
    showing for some child windows (those on the far right)
    and reduces flickering when poping up child windows.
    
    Change-Id: Ie6f2caa25ed2e43e5a3d98ec7148859c727a4916
    Reviewed-on: https://gerrit.libreoffice.org/67994
    Reviewed-by: Andras Timar <andras.timar at collabora.com>
    Tested-by: Andras Timar <andras.timar at collabora.com>

diff --git a/loleaflet/src/control/Control.LokDialog.js b/loleaflet/src/control/Control.LokDialog.js
index 3f5ddbf58..cc4205560 100644
--- a/loleaflet/src/control/Control.LokDialog.js
+++ b/loleaflet/src/control/Control.LokDialog.js
@@ -585,9 +585,9 @@ L.Control.LokDialog = L.Control.extend({
 
 	// Binary dialog msg recvd from core
 	_onDialogPaint: function (e) {
-		var parent = this._getParentId(e.id);
-		if (parent) {
-			this._paintDialogChild(parent, e.width, e.height, e.rectangle, e.img);
+		var parentId = this._getParentId(e.id);
+		if (parentId) {
+			this._paintDialogChild(parentId, e.img);
 		} else {
 			this._paintDialog(e.id, e.rectangle, e.img);
 		}
@@ -595,18 +595,24 @@ L.Control.LokDialog = L.Control.extend({
 
 	// Dialog Child Methods
 
-	_paintDialogChild: function(parentId, width, height, rectangle, imgData) {
+	_paintDialogChild: function(parentId, imgData) {
 		var strId = this._toStrId(parentId);
 		var canvas = L.DomUtil.get(strId + '-floating');
 		if (!canvas)
 			return; // no floating window to paint to
 
-		this._setCanvasWidthHeight(canvas, width, height);
+		// 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
+		// the image is rendred with the HiDPI scale.
+		this._setCanvasWidthHeight(canvas, this._dialogs[parentId].childwidth,
+										   this._dialogs[parentId].childheight);
 
 		var ctx = canvas.getContext('2d');
 		var img = new Image();
 		img.onload = function() {
 			ctx.drawImage(img, 0, 0);
+			$(canvas).show();
 		};
 		img.src = imgData;
 	},
@@ -628,6 +634,7 @@ L.Control.LokDialog = L.Control.extend({
 		var strId = this._toStrId(parentId);
 		var dialogContainer = L.DomUtil.get(strId);
 		var floatingCanvas = L.DomUtil.create('canvas', 'lokdialogchild-canvas', dialogContainer);
+		$(floatingCanvas).hide(); // Hide to avoid flickering while we set the dimensions.
 		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