[Libreoffice-commits] online.git: 2 commits - loleaflet/src
Ashod Nakashian (via logerrit)
logerrit at kemper.freedesktop.org
Mon Dec 2 03:43:16 UTC 2019
loleaflet/src/control/Control.LokDialog.js | 43 ++++++++++++++++++++++++++---
1 file changed, 40 insertions(+), 3 deletions(-)
New commits:
commit 9e219313537f4bc8797fce27690fd860c485a91e
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sun Dec 1 16:56:34 2019 -0500
Commit: Ashod Nakashian <ashnakash at gmail.com>
CommitDate: Mon Dec 2 04:42:59 2019 +0100
leaflet: improved sidebar closing
Change-Id: I547ef3e65b746c4b37176969db8eb766fc037aa9
Reviewed-on: https://gerrit.libreoffice.org/84181
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 e91a075f4..3f4f5fe32 100644
--- a/loleaflet/src/control/Control.LokDialog.js
+++ b/loleaflet/src/control/Control.LokDialog.js
@@ -875,12 +875,16 @@ L.Control.LokDialog = L.Control.extend({
_onSidebarClose: function(dialogId) {
this._resizeSidebar(dialogId, 0);
- $('#' + this._currentDeck.strId).remove();
- this._map.focus();
delete this._dialogs[dialogId];
- this._currentDeck = null;
+ if (this._currentDeck) {
+ $('#' + this._currentDeck.strId).remove();
+ this._currentDeck = null;
+ }
$('#sidebar-dock-wrapper').css({display: ''});
+ this._map.fire('editorgotfocus');
+ this._map.focus();
+
},
_onCalcInputBarClose: function(dialogId) {
commit 0cc3319b30733210850f3be6761b183c00a6d6b9
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sun Dec 1 16:53:34 2019 -0500
Commit: Ashod Nakashian <ashnakash at gmail.com>
CommitDate: Mon Dec 2 04:42:49 2019 +0100
leaflet: properly handle sidebar id changes from Core
Change-Id: Ic8fceb097ce8d269bf957038d84bcb536cb3b250
Reviewed-on: https://gerrit.libreoffice.org/84180
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 70f1592f7..e91a075f4 100644
--- a/loleaflet/src/control/Control.LokDialog.js
+++ b/loleaflet/src/control/Control.LokDialog.js
@@ -612,6 +612,39 @@ L.Control.LokDialog = L.Control.extend({
var strId = this._toStrId(id);
if (this._currentDeck) {
+
+ var oldId = this._currentDeck.id;
+ if (oldId != id) {
+ // This is a new deck; update the HTML elements in-place.
+ var strOldId = this._toStrId(oldId);
+
+ var oldPanel = document.getElementById(strOldId);
+ if (oldPanel)
+ oldPanel.id = strOldId + '-offscreen';
+ var oldCanvas = document.getElementById(strOldId + '-canvas');
+ if (oldCanvas)
+ oldCanvas.id = strOldId + '-offscreen';
+
+ $('#' + this._currentDeck.strId).remove();
+ delete this._dialogs[oldId];
+ this._currentDeck = null;
+
+ this._createSidebar(id, strId, width, height);
+
+ var newCanvas = document.getElementById(strId + '-canvas');
+ if (oldCanvas && newCanvas)
+ {
+ this._setCanvasWidthHeight(newCanvas, oldCanvas.width, oldCanvas.height);
+ var ctx = newCanvas.getContext('2d');
+ ctx.drawImage(oldCanvas, 0, 0);
+ }
+
+ oldPanel.remove();
+
+ return;
+ }
+
+ // Update the existing sidebar.
this._currentDeck.width = width;
this._currentDeck.height = height;
More information about the Libreoffice-commits
mailing list