mirror of
https://github.com/umap-project/umap.git
synced 2025-04-29 11:52:38 +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) => {
|
this.on('editable:drawing:cancel', (e) => {
|
||||||
console.log('editable:drawing:cancel')
|
console.log('editable:drawing:cancel')
|
||||||
if (e.layer instanceof U.Marker) e.layer.del()
|
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) {
|
this.on('editable:drawing:commit', function (e) {
|
||||||
console.log('editable:drawing:commit')
|
console.log('editable:drawing:commit')
|
||||||
e.layer.isDirty = true
|
e.layer.isDirty = true
|
||||||
if (this.map.editedFeature !== e.layer) e.layer.edit(e)
|
if (this.map.editedFeature !== e.layer) e.layer.edit(e)
|
||||||
e.layer.onCommit()
|
|
||||||
})
|
})
|
||||||
this.on('editable:editing', (e) => {
|
this.on('editable:editing', (e) => {
|
||||||
console.log('editable:editing')
|
console.log('editable:editing')
|
||||||
|
|
|
@ -652,6 +652,7 @@ U.Marker = L.Marker.extend({
|
||||||
},
|
},
|
||||||
this
|
this
|
||||||
)
|
)
|
||||||
|
this.on('editable:drawing:end', this.onCommit)
|
||||||
if (!this.isReadOnly()) this.on('mouseover', this._enableDragging)
|
if (!this.isReadOnly()) this.on('mouseover', this._enableDragging)
|
||||||
this.on('mouseout', this._onMouseOut)
|
this.on('mouseout', this._onMouseOut)
|
||||||
this._popupHandlersAdded = true // prevent Leaflet from binding event on bindPopup
|
this._popupHandlersAdded = true // prevent Leaflet from binding event on bindPopup
|
||||||
|
@ -933,6 +934,7 @@ U.PathMixin = {
|
||||||
|
|
||||||
addInteractions: function () {
|
addInteractions: function () {
|
||||||
U.FeatureMixin.addInteractions.call(this)
|
U.FeatureMixin.addInteractions.call(this)
|
||||||
|
this.on('editable:disable', this.onCommit)
|
||||||
this.on('mouseover', this._onMouseOver)
|
this.on('mouseover', this._onMouseOver)
|
||||||
this.on('edit', this.makeDirty)
|
this.on('edit', this.makeDirty)
|
||||||
this.on('drag editable:drag', this._onDrag)
|
this.on('drag editable:drag', this._onDrag)
|
||||||
|
@ -942,7 +944,6 @@ U.PathMixin = {
|
||||||
|
|
||||||
_onDrag: function () {
|
_onDrag: function () {
|
||||||
if (this._tooltip) this._tooltip.setLatLng(this.getCenter())
|
if (this._tooltip) this._tooltip.setLatLng(this.getCenter())
|
||||||
this.syncUpdatedProperties(['latlng'])
|
|
||||||
},
|
},
|
||||||
|
|
||||||
transferShape: function (at, to) {
|
transferShape: function (at, to) {
|
||||||
|
|
Loading…
Reference in a new issue