loleaflet/src/layer/tile/CalcTileLayer.js    |    5 ++---
 loleaflet/src/layer/tile/ImpressTileLayer.js |    7 +++----
 loleaflet/src/layer/tile/WriterTileLayer.js  |    6 +++---
 3 files changed, 8 insertions(+), 10 deletions(-)

New commits:
commit d4e364255d39979524c5e1ec426730e2d51e4b28
Author:     Henry Castro <hcas...@collabora.com>
AuthorDate: Fri Nov 1 16:54:05 2019 -0400
Commit:     Henry Castro <hcas...@collabora.com>
CommitDate: Mon Nov 4 22:23:08 2019 +0100

    loleaflet: initialize mobile toolbars before adding the layer
    
    Occurs that the 'permission' event, it is fired before the mobile
    toolbar are created.
    
    Change-Id: Ib96082b249a3d4e509d996f7382fd00c870de6f0
    Reviewed-on: https://gerrit.libreoffice.org/81920
    Reviewed-by: Henry Castro <hcas...@collabora.com>
    Tested-by: Henry Castro <hcas...@collabora.com>

diff --git a/loleaflet/src/layer/tile/CalcTileLayer.js 
b/loleaflet/src/layer/tile/CalcTileLayer.js
index 5fb97350a..76149cf82 100644
--- a/loleaflet/src/layer/tile/CalcTileLayer.js
+++ b/loleaflet/src/layer/tile/CalcTileLayer.js
@@ -51,7 +51,7 @@ L.CalcTileLayer = L.TileLayer.extend({
                map.on('AnnotationReply', this._onAnnotationReply, this);
                map.on('AnnotationSave', this._onAnnotationSave, this);
                if (L.Browser.mobile) {
-                       map.on('doclayerinit', this.onMobileInit, this);
+                       this.onMobileInit(map);
                }
        },
 
@@ -70,8 +70,7 @@ L.CalcTileLayer = L.TileLayer.extend({
                this._annotations = {};
        },
 
-       onMobileInit: function () {
-               var map = this._map;
+       onMobileInit: function (map) {
                var toolItems = [
                        {type: 'button',  id: 'showsearchbar',  img: 'search', 
hint: _('Show the search bar')},
                        {type: 'break'},
diff --git a/loleaflet/src/layer/tile/ImpressTileLayer.js 
b/loleaflet/src/layer/tile/ImpressTileLayer.js
index 350084c1d..ce3f727ec 100644
--- a/loleaflet/src/layer/tile/ImpressTileLayer.js
+++ b/loleaflet/src/layer/tile/ImpressTileLayer.js
@@ -48,7 +48,7 @@ L.ImpressTileLayer = L.TileLayer.extend({
                map.on('AnnotationScrollDown', this.onAnnotationScrollDown, 
this);
                map.on('resize', this.onResize, this);
                if (window.mode.isMobile()) {
-                       map.on('doclayerinit', this.onMobileInit, this);
+                       this.onMobileInit(map);
                        L.Control.MobileWizard.mergeOptions({maxHeight: '55%'});
                        var mobileWizard = L.DomUtil.get('mobile-wizard');
                        var mobileWizardContent = 
L.DomUtil.get('mobile-wizard-content');
@@ -110,8 +110,7 @@ L.ImpressTileLayer = L.TileLayer.extend({
                this._isSlidePaneVisible = !(visible === 'none');
        },
 
-       onMobileInit: function () {
-               var map = this._map;
+       onMobileInit: function (map) {
                var toolItems = [
                        {type: 'button',  id: 'showsearchbar',  img: 'search', 
hint: _('Show the search bar')},
                        {type: 'break'},
@@ -280,7 +279,7 @@ L.ImpressTileLayer = L.TileLayer.extend({
                        }
                });
 
-               this._map.on('updatepermission', window.onUpdatePermission);
+               map.on('updatepermission', window.onUpdatePermission);
        },
 
        onAdd: function (map) {
diff --git a/loleaflet/src/layer/tile/WriterTileLayer.js 
b/loleaflet/src/layer/tile/WriterTileLayer.js
index 5758ce9fc..91869aa1b 100644
--- a/loleaflet/src/layer/tile/WriterTileLayer.js
+++ b/loleaflet/src/layer/tile/WriterTileLayer.js
@@ -40,18 +40,18 @@ L.WriterTileLayer = L.TileLayer.extend({
 
        beforeAdd: function (map) {
                if (L.Browser.mobile) {
-                       map.on('doclayerinit', this.onMobileInit, this);
+                       this.onMobileInit(map);
                }
        },
 
        onAdd: function (map) {
+
                L.TileLayer.prototype.onAdd.call(this, map);
                this._annotations = L.annotationManager(map);
                map.on('updatemaxbounds', this._onUpdateMaxBounds, this);
        },
 
-       onMobileInit: function () {
-               var map = this._map;
+       onMobileInit: function (map) {
                var toolItems = [
                        {type: 'button',  id: 'showsearchbar',  img: 'search', 
hint: _('Show the search bar')},
                        {type: 'break'},
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to