loleaflet/src/control/Control.LokDialog.js |   34 ++++++++++++++++-------------
 1 file changed, 19 insertions(+), 15 deletions(-)

New commits:
commit aa32811089838af9118e581d7cad395ccf2163b6
Author:     Ashod Nakashian <ashod.nakash...@collabora.co.uk>
AuthorDate: Sun Dec 1 16:49:01 2019 -0500
Commit:     Ashod Nakashian <ashnak...@gmail.com>
CommitDate: Mon Dec 2 04:33:36 2019 +0100

    leaflet: split sidebar launch into three stages
    
    We need to re-create the sidebar, so we need to
    reuse the create portion and separate it from the
    in-pace update logic. Similarly, the post-launch
    logic is common and re-usable, so we isolate it too.
    
    Change-Id: I5c72d19fd6e7f0f05c32b7bed186a562d19a8f24
    Reviewed-on: https://gerrit.libreoffice.org/84178
    Reviewed-by: Ashod Nakashian <ashnak...@gmail.com>
    Tested-by: Ashod Nakashian <ashnak...@gmail.com>

diff --git a/loleaflet/src/control/Control.LokDialog.js 
b/loleaflet/src/control/Control.LokDialog.js
index 0ee2e4ba2..451805101 100644
--- a/loleaflet/src/control/Control.LokDialog.js
+++ b/loleaflet/src/control/Control.LokDialog.js
@@ -635,10 +635,16 @@ L.Control.LokDialog = L.Control.extend({
                        else
                                $(panel).parent().hide();
 
-                       // Render window.
-                       this._sendPaintWindowRect(id);
-                       return;
+                       var panelContainer = document.getElementById(strId);
+                       var panelCanvas = document.getElementById(strId + 
'-canvas');
+                       this._postLaunch(id, panelContainer, panelCanvas);
+               } else {
+                       this._createSidebar(id, strId, width, height);
                }
+       },
+
+       _createSidebar: function(id, strId, width, height) {
+               // Create a new sidebar.
 
                var panelContainer = L.DomUtil.create('div', 'panel', 
L.DomUtil.get('sidebar-panel'));
                panelContainer.id = strId;
@@ -676,12 +682,13 @@ L.Control.LokDialog = L.Control.extend({
                this._currentDeck = this._dialogs[id];
 
                this._createDialogCursor(strId);
-               this._setupWindowEvents(id, panelCanvas/*, dlgInput*/);
 
-               L.DomEvent.on(panelContainer, 'resize', function() {
-                       // Don't resize the window as we handle overflowing 
with scrollbars.
-                       // this._map._socket.sendMessage('resizewindow ' + id + 
' size=' + panelContainer.width + ',' + panelContainer.height);
-               }, this);
+               this._postLaunch(id, panelContainer, panelCanvas);
+       },
+
+       _postLaunch: function(id, panelContainer, panelCanvas) {
+
+               this._setupWindowEvents(id, panelCanvas/*, dlgInput*/);
 
                L.DomEvent.on(panelContainer, 'mouseleave', function() {
                        // Move the mouse off-screen when we leave the sidebar
commit 9b973d09fc2aa0e338d9055bd965a9d566ded486
Author:     Ashod Nakashian <ashod.nakash...@collabora.co.uk>
AuthorDate: Sun Dec 1 16:38:46 2019 -0500
Commit:     Ashod Nakashian <ashnak...@gmail.com>
CommitDate: Mon Dec 2 04:33:26 2019 +0100

    leaflet: always setup #sidebar-dock-wrapper properties
    
    No reason to set these properties as soon as possible.
    
    Change-Id: Iee1f108c628f4e6ada640cde0c698246fe33729c
    Reviewed-on: https://gerrit.libreoffice.org/84177
    Reviewed-by: Ashod Nakashian <ashnak...@gmail.com>
    Tested-by: Ashod Nakashian <ashnak...@gmail.com>

diff --git a/loleaflet/src/control/Control.LokDialog.js 
b/loleaflet/src/control/Control.LokDialog.js
index 75b56bf5d..0ee2e4ba2 100644
--- a/loleaflet/src/control/Control.LokDialog.js
+++ b/loleaflet/src/control/Control.LokDialog.js
@@ -609,10 +609,14 @@ L.Control.LokDialog = L.Control.extend({
                        return;
 
                $('#sidebar-dock-wrapper').css('display', 'block');
+               if (window.mode.isTablet())
+                       $('#sidebar-dock-wrapper').addClass('tablet');
 
                var ratio = 1.0;
                if (width > window.screen.width) {
                        ratio = window.screen.width / width;
+                       if (ratio < 1.0)
+                               $('#sidebar-dock-wrapper').css('width', 
String(width * ratio) + 'px');
                }
 
                var strId = this._toStrId(id);
@@ -633,13 +637,6 @@ L.Control.LokDialog = L.Control.extend({
 
                        // Render window.
                        this._sendPaintWindowRect(id);
-
-                       if (window.mode.isTablet())
-                               $('#sidebar-dock-wrapper').addClass('tablet');
-
-                       if (ratio < 1.0) {
-                               $('#sidebar-dock-wrapper').css('width', 
String(width * ratio) + 'px');
-                       }
                        return;
                }
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to