Fix the broken initial location
This commit is contained in:
parent
ba63ac7248
commit
f5b2ba6a06
4 changed files with 19 additions and 11 deletions
|
@ -257,10 +257,15 @@ export class FilteredLayer {
|
||||||
// We monky-patch the feature element with an update-style
|
// We monky-patch the feature element with an update-style
|
||||||
feature.updateStyle = () => {
|
feature.updateStyle = () => {
|
||||||
if (layer.setIcon) {
|
if (layer.setIcon) {
|
||||||
const icon = self._style(feature.properties).icon;
|
const style = self._style(feature.properties);
|
||||||
|
const icon = style.icon;
|
||||||
if (icon.iconUrl) {
|
if (icon.iconUrl) {
|
||||||
|
if (icon.iconUrl.startsWith("$circle")) {
|
||||||
|
// pass
|
||||||
|
} else {
|
||||||
layer.setIcon(L.icon(icon))
|
layer.setIcon(L.icon(icon))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
self._geolayer.setStyle(function (featureX) {
|
self._geolayer.setStyle(function (featureX) {
|
||||||
return self._style(featureX.properties);
|
return self._style(featureX.properties);
|
||||||
|
|
|
@ -77,11 +77,13 @@ export class UIEventSource<T>{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public syncWith(otherSource: UIEventSource<T>) : UIEventSource<T>{
|
public syncWith(otherSource: UIEventSource<T>, reverseOverride = false): UIEventSource<T> {
|
||||||
this.addCallback((latest) => otherSource.setData(latest));
|
this.addCallback((latest) => otherSource.setData(latest));
|
||||||
const self = this;
|
const self = this;
|
||||||
otherSource.addCallback((latest) => self.setData(latest));
|
otherSource.addCallback((latest) => self.setData(latest));
|
||||||
if(this.data === undefined){
|
if (reverseOverride && otherSource.data !== undefined) {
|
||||||
|
this.setData(otherSource.data);
|
||||||
|
} else if (this.data === undefined) {
|
||||||
this.setData(otherSource.data);
|
this.setData(otherSource.data);
|
||||||
} else {
|
} else {
|
||||||
otherSource.setData(this.data);
|
otherSource.setData(this.data);
|
||||||
|
|
9
State.ts
9
State.ts
|
@ -134,12 +134,13 @@ export class State {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
this.zoom = asFloat(QueryParameters.GetQueryParameter("z", "" + layoutToUse.startzoom)
|
this.zoom = asFloat(
|
||||||
.syncWith(LocalStorageSource.Get("zoom")));
|
QueryParameters.GetQueryParameter("z", "" + layoutToUse.startzoom)
|
||||||
|
.syncWith(LocalStorageSource.Get("zoom"), true));
|
||||||
this.lat = asFloat(QueryParameters.GetQueryParameter("lat", "" + layoutToUse.startLat)
|
this.lat = asFloat(QueryParameters.GetQueryParameter("lat", "" + layoutToUse.startLat)
|
||||||
.syncWith(LocalStorageSource.Get("lat")));
|
.syncWith(LocalStorageSource.Get("lat"), true));
|
||||||
this.lon = asFloat(QueryParameters.GetQueryParameter("lon", "" + layoutToUse.startLon)
|
this.lon = asFloat(QueryParameters.GetQueryParameter("lon", "" + layoutToUse.startLon)
|
||||||
.syncWith(LocalStorageSource.Get("lon")));
|
.syncWith(LocalStorageSource.Get("lon"), true));
|
||||||
|
|
||||||
|
|
||||||
this.locationControl = new UIEventSource<{ lat: number, lon: number, zoom: number }>({
|
this.locationControl = new UIEventSource<{ lat: number, lon: number, zoom: number }>({
|
||||||
|
|
2
index.ts
2
index.ts
|
@ -36,7 +36,7 @@ if (location.hostname === "localhost" || location.hostname === "127.0.0.1") {
|
||||||
|
|
||||||
// ----------------- SELECT THE RIGHT QUESTSET -----------------
|
// ----------------- SELECT THE RIGHT QUESTSET -----------------
|
||||||
|
|
||||||
let defaultLayout = "bookcases"
|
let defaultLayout = "buurtnatuur"
|
||||||
|
|
||||||
const path = window.location.pathname.split("/").slice(-1)[0];
|
const path = window.location.pathname.split("/").slice(-1)[0];
|
||||||
if (path !== "index.html" && path !== "") {
|
if (path !== "index.html" && path !== "") {
|
||||||
|
|
Loading…
Reference in a new issue