loleaflet/src/control/Control.Dialog.js |    8 ++++++++
 loleaflet/src/map/Map.js                |    1 +
 2 files changed, 9 insertions(+)

New commits:
commit 8f7ddbc495676d7594caf190dcfa35e0616055f9
Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk>
Date:   Sun Apr 24 16:56:18 2016 -0400

    loleaflet: close an existing dialog before showing a new one
    
    Change-Id: Ic930fc692c93ff01a7b74f26f0153fd8a75692cb
    Reviewed-on: https://gerrit.libreoffice.org/24353
    Reviewed-by: Ashod Nakashian <ashnak...@gmail.com>
    Tested-by: Ashod Nakashian <ashnak...@gmail.com>

diff --git a/loleaflet/src/control/Control.Dialog.js 
b/loleaflet/src/control/Control.Dialog.js
index 4907107..c377248 100644
--- a/loleaflet/src/control/Control.Dialog.js
+++ b/loleaflet/src/control/Control.Dialog.js
@@ -10,6 +10,11 @@ L.Control.Dialog = L.Control.extend({
        },
 
        _onError: function (e) {
+               if (vex.dialog_id > 0) {
+                       // Close other dialogs before presenting a new one.
+                       vex.close(vex.dialog_id);
+               }
+
                if (e.msg) {
                        vex.dialog.alert(e.msg);
                }
@@ -18,6 +23,9 @@ L.Control.Dialog = L.Control.extend({
                                                ' parsing the \'' + e.cmd + '\' 
command.';
                        vex.dialog.alert(msg);
                }
+
+               // Remember the current dialog ID to close it later.
+               vex.dialog_id = vex.globalID - 1;
        },
 
        _onPrint: function (e) {
diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index 5a8cd68..4abd285 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -705,6 +705,7 @@ L.Map = L.Evented.extend({
 
                        options = $.extend({}, vex.defaultOptions, {contentCSS: 
{"background":"rgba(0, 0, 0, 0)"}});
                        options.id = vex.globalID;
+                       vex.dialog_id = options.id;
                        vex.globalID += 1;
                        options.$vex = 
$('<div>').addClass(vex.baseClassNames.vex).addClass(options.className).css(options.css).data({
                          vex: options
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to