mirror of
https://github.com/umap-project/umap.git
synced 2025-04-29 03:42:37 +02:00
feat(sync): Sync only when the edition of a feature is over.
It's less spectacular than sending the position as it changes, but takes less bandwidth and seems good enough.
This commit is contained in:
parent
ce0f3c9d3e
commit
e4bcb53c6f
2 changed files with 2 additions and 6 deletions
|
@ -1261,16 +1261,11 @@ U.Editable = L.Editable.extend({
|
|||
this.on('editable:drawing:cancel', (e) => {
|
||||
console.log('editable:drawing:cancel')
|
||||
if (e.layer instanceof U.Marker) e.layer.del()
|
||||
else {
|
||||
// the user might just exit with escape
|
||||
e.layer.onCommit()
|
||||
}
|
||||
})
|
||||
this.on('editable:drawing:commit', function (e) {
|
||||
console.log('editable:drawing:commit')
|
||||
e.layer.isDirty = true
|
||||
if (this.map.editedFeature !== e.layer) e.layer.edit(e)
|
||||
e.layer.onCommit()
|
||||
})
|
||||
this.on('editable:editing', (e) => {
|
||||
console.log('editable:editing')
|
||||
|
|
|
@ -652,6 +652,7 @@ U.Marker = L.Marker.extend({
|
|||
},
|
||||
this
|
||||
)
|
||||
this.on('editable:drawing:end', this.onCommit)
|
||||
if (!this.isReadOnly()) this.on('mouseover', this._enableDragging)
|
||||
this.on('mouseout', this._onMouseOut)
|
||||
this._popupHandlersAdded = true // prevent Leaflet from binding event on bindPopup
|
||||
|
@ -933,6 +934,7 @@ U.PathMixin = {
|
|||
|
||||
addInteractions: function () {
|
||||
U.FeatureMixin.addInteractions.call(this)
|
||||
this.on('editable:disable', this.onCommit)
|
||||
this.on('mouseover', this._onMouseOver)
|
||||
this.on('edit', this.makeDirty)
|
||||
this.on('drag editable:drag', this._onDrag)
|
||||
|
@ -942,7 +944,6 @@ U.PathMixin = {
|
|||
|
||||
_onDrag: function () {
|
||||
if (this._tooltip) this._tooltip.setLatLng(this.getCenter())
|
||||
this.syncUpdatedProperties(['latlng'])
|
||||
},
|
||||
|
||||
transferShape: function (at, to) {
|
||||
|
|
Loading…
Reference in a new issue