UX: attempt to fix #2394

This commit is contained in:
Pieter Vander Vennet 2025-05-04 02:37:57 +02:00
parent 4604fc62e5
commit 156493ef06
6 changed files with 31 additions and 25 deletions

View file

@ -9,6 +9,7 @@ import { FeatureSource, IndexedFeatureSource } from "../../Logic/FeatureSource/F
import { Tag } from "../../Logic/Tags/Tag"
import Hotkeys from "../../UI/Base/Hotkeys"
import Translations from "../../UI/i18n/Translations"
import { Feature } from "geojson"
export class WithLayoutSourceState extends WithSelectedElementState {
readonly layerState: LayerState
@ -127,4 +128,10 @@ export class WithLayoutSourceState extends WithSelectedElementState {
this.featureProperties.trackFeature(feature)
this.selectedElement.setData(feature)
}
protected setSelectedElement(feature: Feature) {
// The given feature might be a partial one from the cache
feature = this.indexedFeatures.featuresById.data?.get(feature.properties.id) ?? feature
super.setSelectedElement(feature)
}
}

View file

@ -18,7 +18,7 @@ import { Store, UIEventSource } from "../../Logic/UIEventSource"
import NearbyFeatureSource from "../../Logic/FeatureSource/Sources/NearbyFeatureSource"
import {
SummaryTileSource,
SummaryTileSourceRewriter,
SummaryTileSourceRewriter
} from "../../Logic/FeatureSource/TiledFeatureSource/SummaryTileSource"
import { ShowDataLayerOptions } from "../../UI/Map/ShowDataLayerOptions"
@ -121,7 +121,7 @@ export class WithSpecialLayers extends WithChangesState {
new ShowDataLayer(this.map, {
features: source,
layer: new LayerConfig(<LayerConfigJson>summaryLayer, "summaryLayer"),
layer: new LayerConfig(<LayerConfigJson><unknown>summaryLayer, "summaryLayer"),
// doShowLayer: this.mapProperties.zoom.map((z) => z < maxzoom),
selectedElement: this.selectedElement,
})
@ -147,7 +147,7 @@ export class WithSpecialLayers extends WithChangesState {
private drawLastClick() {
const source = this.lastClickObject
const lastClickLayerConfig = new LayerConfig(
<LayerConfigJson>last_click_layerconfig,
<LayerConfigJson><unknown>last_click_layerconfig,
"last_click"
)
const lastClickFiltered =
@ -185,7 +185,7 @@ export class WithSpecialLayers extends WithChangesState {
const src = new StaticFeatureSource(
this.selectedElement.map((f) => (f === undefined ? [] : [f]))
)
ShowDataLayer.showMultipleLayers(this.map, src, this.theme.layers)
ShowDataLayer.showMultipleLayers(this.map, src, this.theme.layers, { prefix: "selected_element_" })
}
private drawSpecialLayers() {