feat(sync): Only sync when on edit mode

The is done to save server resources, for accessed maps which
aren't currently being edited.
This commit is contained in:
Alexis Métaireau 2024-05-07 12:29:16 +02:00
parent 346391b311
commit f964bfff0f
No known key found for this signature in database
GPG key ID: 1C21B876828E5FF2

View file

@ -245,8 +245,6 @@ U.Map = L.Map.extend({
this.initContextMenu()
this.on('click contextmenu.show', this.closeInplaceToolbar)
this.sync = new U.SyncEngine(this)
this.initSyncEngine()
},
initSyncEngine: async function () {
@ -1599,6 +1597,7 @@ U.Map = L.Map.extend({
this.editEnabled = true
this.drop.enable()
this.fire('edit:enabled')
this.initSyncEngine()
},
disableEdit: function () {
@ -1610,6 +1609,7 @@ U.Map = L.Map.extend({
this.fire('edit:disabled')
this.editPanel.close()
this.fullPanel.close()
this.sync.stop()
},
hasEditMode: function () {