loleaflet/src/control/Control.LokDialog.js |   37 ++++++++++++++++++++++++++---
 loleaflet/src/map/Map.js                   |    7 +++--
 2 files changed, 38 insertions(+), 6 deletions(-)

New commits:
commit f1776b92670e3143ede418c0f2b46ec9819b68bd
Author:     Marco Cecchetti <marco.cecche...@collabora.com>
AuthorDate: Mon Dec 2 17:18:19 2019 +0100
Commit:     Marco Cecchetti <marco.cecche...@collabora.com>
CommitDate: Tue Dec 3 12:57:11 2019 +0100

    loleaflet: tunneled formula bar partially hidden by side-panel
    
    Change-Id: I5ae3422ae33035d0bb6ffb1f6c75d659b4789932
    Reviewed-on: https://gerrit.libreoffice.org/84332
    Reviewed-by: Marco Cecchetti <marco.cecche...@collabora.com>
    Tested-by: Marco Cecchetti <marco.cecche...@collabora.com>

diff --git a/loleaflet/src/control/Control.LokDialog.js 
b/loleaflet/src/control/Control.LokDialog.js
index 857a4407c..3614342c1 100644
--- a/loleaflet/src/control/Control.LokDialog.js
+++ b/loleaflet/src/control/Control.LokDialog.js
@@ -992,9 +992,19 @@ L.Control.LokDialog = L.Control.extend({
                                that._dialogs[parentId].isPainting = false;
                        }
 
-                       if (isCalcInputBar && container && 
that._calcInputBar.width !== container.clientWidth) {
-                               console.log('_paintDialog: container width: ' + 
container.clientWidth + ', _calcInputBar width: ' + that._calcInputBar.width);
-                               that._map._socket.sendMessage('resizewindow ' + 
parentId + ' size=' + container.clientWidth + ',' + that._calcInputBar.height);
+                       if (isCalcInputBar && container) {
+                               var deckOffset = 0;
+                               if (that._currentDeck) {
+                                       var sidebar = 
L.DomUtil.get(that._currentDeck.strId);
+                                       if (sidebar) {
+                                               deckOffset = sidebar.width;
+                                       }
+                               }
+                               var correctWidth = container.clientWidth - 
deckOffset;
+                               if (that._calcInputBar.width !== correctWidth) {
+                                       console.log('_paintDialog: correct 
width: ' + correctWidth + ', _calcInputBar width: ' + that._calcInputBar.width);
+                                       
that._map._socket.sendMessage('resizewindow ' + parentId + ' size=' + 
correctWidth + ',' + that._calcInputBar.height);
+                               }
                        }
                };
                img.src = imgData;
@@ -1040,8 +1050,10 @@ L.Control.LokDialog = L.Control.extend({
                        // Add extra space for scrollbar only when visible
                        width = width + 15;
                }
+               var deckOffset = 0;
                var sidebar = L.DomUtil.get(strId);
                if (sidebar) {
+                       deckOffset = width === 0 ? sidebar.width : -width;
                        sidebar.width = width;
                        if (sidebar.style)
                                sidebar.style.width = width.toString() + 'px';
@@ -1052,6 +1064,7 @@ L.Control.LokDialog = L.Control.extend({
                if (spreadsheetRowColumnFrame)
                        spreadsheetRowColumnFrame.style.right = 
width.toString() + 'px';
 
+               this._adjustCalcInputBar(deckOffset);
                // If we didn't have the focus, don't steal it form the editor.
                if ($('#' + this._currentDeck.strId + '-cursor').css('display') 
=== 'none') {
                        this._map.fire('editorgotfocus');
@@ -1059,6 +1072,24 @@ L.Control.LokDialog = L.Control.extend({
                }
        },
 
+       _adjustCalcInputBar: function(offset) {
+               if (this._calcInputBar && !this._calcInputBar.isPainting && 
offset !== 0) {
+                       var id = this._calcInputBar.id;
+                       var calcInputbar = L.DomUtil.get('calc-inputbar');
+                       if (calcInputbar) {
+                               var calcInputbarContainer = 
calcInputbar.children[0];
+                               if (calcInputbarContainer) {
+                                       var width = 
calcInputbarContainer.clientWidth + offset;
+                                       var height = 
calcInputbarContainer.clientHeight;
+                                       if (width !== 0 && height !== 0) {
+                                               
console.log('_adjustCalcInputBar: width: ' + width + ', height: ' + height);
+                                               
this._map._socket.sendMessage('resizewindow ' + id + ' size=' + width + ',' + 
height);
+                                       }
+                               }
+                       }
+               }
+       },
+
        _onDialogChildClose: function(dialogId) {
                $('#' + this._toStrId(dialogId) + '-floating').remove();
                if (!this._isSidebar(dialogId) && 
!this._isCalcInputBar(dialogId)) {
diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index b279c1d8a..ffde80719 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -1093,13 +1093,14 @@ L.Map = L.Evented.extend({
                L.Util.cancelAnimFrame(this._resizeRequest);
                this._resizeRequest = L.Util.requestAnimFrame(
                        function () { this.invalidateSize({debounceMoveend: 
true}); }, this, false, this._container);
+               var deckOffset = 0;
                var sidebarpanel = L.DomUtil.get('sidebar-panel');
                if (sidebarpanel) {
                        var sidebar = sidebarpanel.children[0];
                        if (sidebar) {
                                sidebar.height = this._container.clientHeight - 
10;
                                sidebar.style.height = sidebar.height + 'px';
-
+                               deckOffset = sidebar.width;
                                // Fire the resize event to propagate the size 
change to WSD.
                                // .trigger isn't working, so doing it manually.
                                var event;
@@ -1126,9 +1127,9 @@ L.Map = L.Evented.extend({
                        if (calcInputbar) {
                                var calcInputbarContainer = 
calcInputbar.children[0];
                                if (calcInputbarContainer) {
-                                       var width = 
calcInputbarContainer.clientWidth;
+                                       var width = 
calcInputbarContainer.clientWidth - deckOffset;
                                        var height = 
calcInputbarContainer.clientHeight;
-                                       if (width !== 0 && height !== 0) {
+                                       if (width > 0 && height > 0) {
                                                console.log('_onResize: 
container width: ' + width + ', container height: ' + height + ', _calcInputBar 
width: ' + this.dialog._calcInputBar.width);
                                                
this._socket.sendMessage('resizewindow ' + id + ' size=' + width + ',' + 
height);
                                        }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to