forked from MapComplete/MapComplete
Fix autoapply for GRB theme
This commit is contained in:
parent
db770f2c35
commit
30be86668e
16 changed files with 392 additions and 209 deletions
|
@ -50,7 +50,7 @@ class MetatagUpdater {
|
|||
this.isDirty.setData(true)
|
||||
}
|
||||
|
||||
private updateMetaTags() {
|
||||
public updateMetaTags() {
|
||||
const features = this.source.features.data
|
||||
|
||||
if (features.length === 0) {
|
||||
|
@ -77,12 +77,23 @@ export default class MetaTagRecalculator {
|
|||
private readonly _notifiers: MetatagUpdater[] = []
|
||||
|
||||
/**
|
||||
* The meta tag recalculator receives tiles of layers.
|
||||
* The meta tag recalculator receives tiles of layers via the 'registerSource'-function.
|
||||
* It keeps track of which sources have had their share calculated, and which should be re-updated if some other data is loaded
|
||||
*/
|
||||
constructor(state: { allElements?: ElementStorage }, featurePipeline: FeaturePipeline) {
|
||||
constructor(state: { allElements?: ElementStorage, currentView: FeatureSourceForLayer & Tiled }, featurePipeline: FeaturePipeline) {
|
||||
this._featurePipeline = featurePipeline;
|
||||
this._state = state;
|
||||
|
||||
if(state.currentView !== undefined){
|
||||
const currentViewUpdater = new MetatagUpdater(state.currentView, this._state, this._featurePipeline)
|
||||
this._alreadyRegistered.add(state.currentView)
|
||||
this._notifiers.push(currentViewUpdater)
|
||||
state.currentView.features.addCallback(_ => {
|
||||
console.debug("Requesting an update for currentView")
|
||||
currentViewUpdater.updateMetaTags();
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public registerSource(source: FeatureSourceForLayer & Tiled, recalculateOnEveryChange = false) {
|
||||
|
|
|
@ -18,6 +18,7 @@ import {LocalStorageSource} from "../Web/LocalStorageSource";
|
|||
import {GeoOperations} from "../GeoOperations";
|
||||
import TitleHandler from "../Actors/TitleHandler";
|
||||
import {BBox} from "../BBox";
|
||||
import MetaTagging from "../MetaTagging";
|
||||
|
||||
/**
|
||||
* Contains all the leaflet-map related state
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue