loleaflet/src/control/Control.LokDialog.js |   14 ++++++++++++++
 loleaflet/src/control/Control.Scroll.js    |    3 +++
 2 files changed, 17 insertions(+)

New commits:
commit 9d6b4d6b0cea59cfd00230d0a35a427f3b589437
Author: Marco Cecchetti <marco.cecche...@collabora.com>
Date:   Sun Apr 8 13:02:38 2018 +0200

    calc: clicking outside a pop-up or a context menu doesn't close it
    
    Change-Id: I5fa43a702054f0cdc297251a4adaa2be953187a4
    Reviewed-on: https://gerrit.libreoffice.org/52618
    Reviewed-by: Jan Holesovsky <ke...@collabora.com>
    Tested-by: Jan Holesovsky <ke...@collabora.com>

diff --git a/loleaflet/src/control/Control.LokDialog.js 
b/loleaflet/src/control/Control.LokDialog.js
index 4f3e01d05..2c2c7bf72 100644
--- a/loleaflet/src/control/Control.LokDialog.js
+++ b/loleaflet/src/control/Control.LokDialog.js
@@ -12,6 +12,8 @@ L.Control.LokDialog = L.Control.extend({
                map.on('windowpaint', this._onDialogPaint, this);
                map.on('opendialog', this._openDialog, this);
                map.on('docloaded', this._docLoaded, this);
+               map.on('closepopup', this.onCloseCurrentPopUp, this);
+               L.DomEvent.on(document, 'mouseup', this.onCloseCurrentPopUp, 
this);
        },
 
        _dialogs: {},
@@ -228,6 +230,7 @@ L.Control.LokDialog = L.Control.extend({
        },
 
        _launchDialog: function(strDlgId, leftTwips, topTwips, width, height, 
title) {
+               this.onCloseCurrentPopUp();
                var dialogContainer = L.DomUtil.create('div', 'lokdialog', 
document.body);
                L.DomUtil.setStyle(dialogContainer, 'padding', '0px');
                L.DomUtil.setStyle(dialogContainer, 'margin', '0px');
@@ -290,6 +293,7 @@ L.Control.LokDialog = L.Control.extend({
                var dlgInput = this._createDialogInput(strDlgId);
 
                L.DomEvent.on(dialogCanvas, 'mousedown mouseup', function(e) {
+                       L.DomEvent.stopPropagation(e);
                        var buttons = 0;
                        buttons |= e.button === map['mouse'].JSButtons.left ? 
map['mouse'].LOButtons.left : 0;
                        buttons |= e.button === map['mouse'].JSButtons.middle ? 
map['mouse'].LOButtons.middle : 0;
@@ -318,6 +322,8 @@ L.Control.LokDialog = L.Control.extend({
                L.DomEvent.on(dlgInput, 'contextmenu', function() {
                        return false;
                });
+
+               this._currentId = this._toRawDlgId(strDlgId);
        },
 
        _postWindowCompositionEvent: function(winid, type, text) {
@@ -341,6 +347,14 @@ L.Control.LokDialog = L.Control.extend({
                $('#' + this._toDlgPrefix(dialogId)).remove();
                this._map.focus();
                delete this._dialogs[dialogId];
+               this._currentId = null;
+       },
+
+       onCloseCurrentPopUp: function() {
+               // for title-less dialog only (context menu, pop-up)
+               if (!this._currentId || !this._isOpen(this._currentId) || 
this._dialogs[this._currentId].title)
+                       return;
+               this._onDialogClose(this._currentId, true);
        },
 
        _paintDialog: function(dialogId, rectangle, imgData) {
diff --git a/loleaflet/src/control/Control.Scroll.js 
b/loleaflet/src/control/Control.Scroll.js
index b5e3b1efb..4973e109d 100644
--- a/loleaflet/src/control/Control.Scroll.js
+++ b/loleaflet/src/control/Control.Scroll.js
@@ -32,6 +32,9 @@ L.Control.Scroll = L.Control.extend({
                        scrollInertia: 0,
                        advanced:{autoExpandHorizontalScroll: true}, /* weird 
bug, it should be false */
                        callbacks:{
+                               onScrollStart: function() {
+                                       control._map.fire('closepopup');
+                               },
                                onScroll: function() {
                                        control._onScrollEnd(this);
                                        if (autoHideTimeout)
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to