[Libreoffice-commits] online.git: Branch 'distro/collabora/co-4-2-0' - loleaflet/src
Marco Cecchetti (via logerrit)
logerrit at kemper.freedesktop.org
Thu Dec 12 10:32:09 UTC 2019
loleaflet/src/control/Control.LokDialog.js | 43 ++++++++++++++++-------------
1 file changed, 24 insertions(+), 19 deletions(-)
New commits:
commit a63c016215be2bdb87b3fb40be7f357eb883e2a5
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
AuthorDate: Thu Dec 12 10:55:28 2019 +0100
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Dec 12 11:31:50 2019 +0100
calc: tunneled formula bar: skip painting when width is wrong.
In the hope of minimizing flikering effects we skip to paint the
formula bar when the size is not the expected one, on the contrary we
send a resize request with the correct width to the lok core.
We also skip to adjust/resize the formula bar when a sidebar resize
not really change the sidebar width.
Change-Id: I11d343b2ba722f96d3cdba6a2dfb66d85a071c5f
Reviewed-on: https://gerrit.libreoffice.org/85031
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 997fb9aac..7ac61c241 100644
--- a/loleaflet/src/control/Control.LokDialog.js
+++ b/loleaflet/src/control/Control.LokDialog.js
@@ -945,7 +945,6 @@ L.Control.LokDialog = L.Control.extend({
},
_paintDialog: function(parentId, rectangle, imgData) {
-
var strId = this._toStrId(parentId);
var canvas = document.getElementById(strId + '-canvas');
if (!canvas)
@@ -967,6 +966,7 @@ L.Control.LokDialog = L.Control.extend({
// Sidebars find out their size and become visible on first paint.
if (that._isSidebar(parentId)) {
+ //console.log('_paintDialog: side-bar: width: ' + that._currentDeck.width);
that._resizeSidebar(strId, that._currentDeck.width);
// Update the underlying canvas.
@@ -974,38 +974,42 @@ L.Control.LokDialog = L.Control.extend({
that._setCanvasWidthHeight(panelCanvas, that._currentDeck.width, that._currentDeck.height);
}
+ // calc input bar find out their size on first paint call
var isCalcInputBar = that._isCalcInputBar(parentId);
- if (isCalcInputBar) {
- var canvas = L.DomUtil.get(that._calcInputBar.strId + '-canvas');
- that._setCanvasWidthHeight(canvas, that._calcInputBar.width, that._calcInputBar.height);
- }
-
- ctx.drawImage(img, x, y);
-
- // if dialog is hidden, show it
var container = L.DomUtil.get(strId);
- if (container)
- $(container).parent().show();
- if (parentId in that._dialogs) {
- // We might have closed the dialog by the time we render.
- that.focus(parentId);
- that._dialogs[parentId].isPainting = false;
- }
-
if (isCalcInputBar && container) {
+ //console.log('_paintDialog: calc input bar: width: ' + that._calcInputBar.width);
+ var canvas = L.DomUtil.get(that._calcInputBar.strId + '-canvas');
+ that._setCanvasWidthHeight(canvas, that._calcInputBar.width, that._calcInputBar.height);
+ $(container).parent().show(); // show or width is 0
var deckOffset = 0;
if (that._currentDeck) {
var sidebar = L.DomUtil.get(that._currentDeck.strId);
if (sidebar) {
- deckOffset = sidebar.width;
+ deckOffset = sidebar.clientWidth;
}
}
var correctWidth = container.clientWidth - deckOffset;
+ // resize the input bar to the correct size
+ // the input bar is rendered only if when the size is the expected one
if (that._calcInputBar.width !== correctWidth) {
console.log('_paintDialog: correct width: ' + correctWidth + ', _calcInputBar width: ' + that._calcInputBar.width);
+ that._dialogs[parentId].isPainting = false;
that._map._socket.sendMessage('resizewindow ' + parentId + ' size=' + correctWidth + ',' + that._calcInputBar.height);
+ return;
}
}
+
+ ctx.drawImage(img, x, y);
+
+ // if dialog is hidden, show it
+ if (container)
+ $(container).parent().show();
+ if (parentId in that._dialogs) {
+ // We might have closed the dialog by the time we render.
+ that.focus(parentId);
+ that._dialogs[parentId].isPainting = false;
+ }
};
img.src = imgData;
},
@@ -1049,7 +1053,8 @@ L.Control.LokDialog = L.Control.extend({
var deckOffset = 0;
var sidebar = L.DomUtil.get(strId);
if (sidebar) {
- deckOffset = width === 0 ? sidebar.width : -width;
+ if (sidebar.width !== width)
+ deckOffset = width === 0 ? sidebar.width : -width;
sidebar.width = width;
if (sidebar.style)
sidebar.style.width = width.toString() + 'px';
More information about the Libreoffice-commits
mailing list