mirror of
https://github.com/umap-project/umap.git
synced 2025-04-28 19:42:36 +02:00
chore: remove unused isDirty flags
This commit is contained in:
parent
626b669d89
commit
6c8046456a
4 changed files with 2 additions and 34 deletions
|
@ -22,7 +22,6 @@ class Feature {
|
||||||
constructor(umap, datalayer, geojson = {}, id = null) {
|
constructor(umap, datalayer, geojson = {}, id = null) {
|
||||||
this._umap = umap
|
this._umap = umap
|
||||||
this.sync = umap.syncEngine.proxy(this)
|
this.sync = umap.syncEngine.proxy(this)
|
||||||
this._isDirty = false
|
|
||||||
this._ui = null
|
this._ui = null
|
||||||
|
|
||||||
// DataLayer the feature belongs to
|
// DataLayer the feature belongs to
|
||||||
|
@ -54,17 +53,6 @@ class Feature {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
set isDirty(status) {
|
|
||||||
this._isDirty = status
|
|
||||||
if (this.datalayer) {
|
|
||||||
this.datalayer.isDirty = status
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
get isDirty() {
|
|
||||||
return this._isDirty
|
|
||||||
}
|
|
||||||
|
|
||||||
get ui() {
|
get ui() {
|
||||||
if (!this._ui) this.makeUI()
|
if (!this._ui) this.makeUI()
|
||||||
return this._ui
|
return this._ui
|
||||||
|
@ -367,7 +355,6 @@ class Feature {
|
||||||
}
|
}
|
||||||
|
|
||||||
del(sync) {
|
del(sync) {
|
||||||
this.isDirty = true
|
|
||||||
this._umap._leafletMap.closePopup()
|
this._umap._leafletMap.closePopup()
|
||||||
if (this.datalayer) {
|
if (this.datalayer) {
|
||||||
this.datalayer.removeFeature(this, sync)
|
this.datalayer.removeFeature(this, sync)
|
||||||
|
@ -412,13 +399,11 @@ class Feature {
|
||||||
|
|
||||||
changeDataLayer(datalayer) {
|
changeDataLayer(datalayer) {
|
||||||
if (this.datalayer) {
|
if (this.datalayer) {
|
||||||
this.datalayer.isDirty = true
|
|
||||||
this.datalayer.removeFeature(this)
|
this.datalayer.removeFeature(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
datalayer.addFeature(this)
|
datalayer.addFeature(this)
|
||||||
this.sync.upsert(this.toGeoJSON())
|
this.sync.upsert(this.toGeoJSON())
|
||||||
datalayer.isDirty = true
|
|
||||||
this.redraw()
|
this.redraw()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -485,7 +470,6 @@ class Feature {
|
||||||
|
|
||||||
deleteProperty(property) {
|
deleteProperty(property) {
|
||||||
delete this.properties[property]
|
delete this.properties[property]
|
||||||
this.isDirty = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
renameProperty(from, to) {
|
renameProperty(from, to) {
|
||||||
|
@ -578,7 +562,6 @@ class Feature {
|
||||||
delete geojson.id
|
delete geojson.id
|
||||||
delete geojson.properties.id
|
delete geojson.properties.id
|
||||||
const feature = this.datalayer.makeFeature(geojson)
|
const feature = this.datalayer.makeFeature(geojson)
|
||||||
feature.isDirty = true
|
|
||||||
feature.edit()
|
feature.edit()
|
||||||
return feature
|
return feature
|
||||||
}
|
}
|
||||||
|
@ -1053,7 +1036,6 @@ export class LineString extends Path {
|
||||||
this.pullGeometry()
|
this.pullGeometry()
|
||||||
if (!this.ui.editEnabled()) this.edit()
|
if (!this.ui.editEnabled()) this.edit()
|
||||||
this.ui.editor.reset()
|
this.ui.editor.reset()
|
||||||
this.isDirty = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
isMulti() {
|
isMulti() {
|
||||||
|
|
|
@ -109,7 +109,6 @@ const PointMixin = {
|
||||||
addInteractions() {
|
addInteractions() {
|
||||||
FeatureMixin.addInteractions.call(this)
|
FeatureMixin.addInteractions.call(this)
|
||||||
this.on('dragend', (event) => {
|
this.on('dragend', (event) => {
|
||||||
this.isDirty = true
|
|
||||||
this.feature.edit(event)
|
this.feature.edit(event)
|
||||||
})
|
})
|
||||||
if (!this.feature.isReadOnly()) this.on('mouseover', this._enableDragging)
|
if (!this.feature.isReadOnly()) this.on('mouseover', this._enableDragging)
|
||||||
|
|
|
@ -640,7 +640,6 @@ export default class Umap {
|
||||||
|
|
||||||
createDirtyDataLayer(options) {
|
createDirtyDataLayer(options) {
|
||||||
const datalayer = this.createDataLayer(options, true)
|
const datalayer = this.createDataLayer(options, true)
|
||||||
datalayer.isDirty = true
|
|
||||||
return datalayer
|
return datalayer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1218,12 +1217,8 @@ export default class Umap {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!this.permissions.isDirty) {
|
|
||||||
// Do not override local changes to permissions,
|
|
||||||
// but update in case some other editors changed them in the meantime.
|
|
||||||
this.permissions.setProperties(data.permissions)
|
this.permissions.setProperties(data.permissions)
|
||||||
this.permissions.commit()
|
this.permissions.commit()
|
||||||
}
|
|
||||||
this._leafletMap.once('saved', () => {
|
this._leafletMap.once('saved', () => {
|
||||||
Alert.success(data.info || translate('Map has been saved!'))
|
Alert.success(data.info || translate('Map has been saved!'))
|
||||||
})
|
})
|
||||||
|
|
|
@ -159,7 +159,6 @@ U.Search = L.PhotonSearch.extend({
|
||||||
event.stopPropagation()
|
event.stopPropagation()
|
||||||
const datalayer = this.map._umap.defaultEditDataLayer()
|
const datalayer = this.map._umap.defaultEditDataLayer()
|
||||||
const marker = datalayer.makeFeature(feature)
|
const marker = datalayer.makeFeature(feature)
|
||||||
marker.isDirty = true
|
|
||||||
marker.edit()
|
marker.edit()
|
||||||
})
|
})
|
||||||
geom.addEventListener('mousedown', async (event) => {
|
geom.addEventListener('mousedown', async (event) => {
|
||||||
|
@ -300,14 +299,8 @@ U.Editable = L.Editable.extend({
|
||||||
if (event.layer instanceof U.LeafletMarker) event.layer.feature.del()
|
if (event.layer instanceof U.LeafletMarker) event.layer.feature.del()
|
||||||
})
|
})
|
||||||
this.on('editable:drawing:commit', function (event) {
|
this.on('editable:drawing:commit', function (event) {
|
||||||
event.layer.feature.isDirty = true
|
|
||||||
if (this._umap.editedFeature !== event.layer) event.layer.feature.edit(event)
|
if (this._umap.editedFeature !== event.layer) event.layer.feature.edit(event)
|
||||||
})
|
})
|
||||||
this.on('editable:editing', (event) => {
|
|
||||||
const feature = event.layer.feature
|
|
||||||
feature.isDirty = true
|
|
||||||
// feature.pullGeometry(false)
|
|
||||||
})
|
|
||||||
this.on('editable:vertex:ctrlclick', (event) => {
|
this.on('editable:vertex:ctrlclick', (event) => {
|
||||||
const index = event.vertex.getIndex()
|
const index = event.vertex.getIndex()
|
||||||
if (
|
if (
|
||||||
|
@ -361,7 +354,6 @@ U.Editable = L.Editable.extend({
|
||||||
// Overrided from Leaflet.Editable
|
// Overrided from Leaflet.Editable
|
||||||
const datalayer = this._umap.defaultEditDataLayer()
|
const datalayer = this._umap.defaultEditDataLayer()
|
||||||
datalayer.addFeature(layer.feature)
|
datalayer.addFeature(layer.feature)
|
||||||
layer.isDirty = true
|
|
||||||
return layer
|
return layer
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue