forked from MapComplete/MapComplete
Hide 'add new element' when an element is selected
This commit is contained in:
parent
6f59b09c11
commit
768e709312
2 changed files with 14 additions and 3 deletions
|
@ -18,6 +18,7 @@ export class LastClickFeatureSource implements FeatureSource {
|
|||
private readonly hasNoteLayer: boolean
|
||||
public static readonly newPointElementId = "new_point_dialog"
|
||||
public readonly features: Store<Feature[]>
|
||||
private readonly _features: UIEventSource<Feature[]>
|
||||
private _usermode: UIEventSource<string>
|
||||
private _enabledAddMorePoints: UIEventSource<boolean>
|
||||
constructor(
|
||||
|
@ -53,9 +54,13 @@ export class LastClickFeatureSource implements FeatureSource {
|
|||
)
|
||||
)
|
||||
|
||||
this.features = clickSource.mapD(({ lon, lat, mode }) => [
|
||||
this.createFeature(lon, lat, mode),
|
||||
])
|
||||
this._features = new UIEventSource<Feature[]>([])
|
||||
this.features = this._features
|
||||
clickSource.addCallbackAndRunD(({ lon, lat, mode }) => {
|
||||
this._features.setData([
|
||||
this.createFeature(lon, lat, mode)
|
||||
])
|
||||
})
|
||||
}
|
||||
|
||||
public createFeature(
|
||||
|
@ -85,4 +90,8 @@ export class LastClickFeatureSource implements FeatureSource {
|
|||
},
|
||||
}
|
||||
}
|
||||
|
||||
clear() {
|
||||
this._features.setData([])
|
||||
}
|
||||
}
|
||||
|
|
|
@ -853,6 +853,8 @@ export default class ThemeViewState implements SpecialVisualizationState {
|
|||
this.selectedElement.addCallback((selected) => {
|
||||
if (selected === undefined) {
|
||||
this.focusOnMap()
|
||||
}else{
|
||||
this.lastClickObject.clear()
|
||||
}
|
||||
})
|
||||
this.guistate.allToggles.forEach((toggle) => {
|
||||
|
|
Loading…
Reference in a new issue