forked from MapComplete/MapComplete
Inject a few functions to fix the build
This commit is contained in:
parent
45bf08744f
commit
ef18846c6a
2 changed files with 19 additions and 7 deletions
|
@ -22,9 +22,8 @@ import Title from "./Base/Title";
|
||||||
import Table from "./Base/Table";
|
import Table from "./Base/Table";
|
||||||
import Histogram from "./BigComponents/Histogram";
|
import Histogram from "./BigComponents/Histogram";
|
||||||
import Loc from "../Models/Loc";
|
import Loc from "../Models/Loc";
|
||||||
import ShowDataLayer from "./ShowDataLayer";
|
|
||||||
import Minimap from "./Base/Minimap";
|
|
||||||
import {Utils} from "../Utils";
|
import {Utils} from "../Utils";
|
||||||
|
import BaseLayer from "../Models/BaseLayer";
|
||||||
|
|
||||||
export default class SpecialVisualizations {
|
export default class SpecialVisualizations {
|
||||||
|
|
||||||
|
@ -129,7 +128,6 @@ export default class SpecialVisualizations {
|
||||||
return features
|
return features
|
||||||
})
|
})
|
||||||
const properties = tagSource.data;
|
const properties = tagSource.data;
|
||||||
|
|
||||||
let zoom = 18
|
let zoom = 18
|
||||||
if (args[0]) {
|
if (args[0]) {
|
||||||
const parsed = Number(args[0])
|
const parsed = Number(args[0])
|
||||||
|
@ -137,7 +135,7 @@ export default class SpecialVisualizations {
|
||||||
zoom = parsed;
|
zoom = parsed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const minimap = new Minimap(
|
const minimap = SpecialVisualizations.constructMiniMap(
|
||||||
{
|
{
|
||||||
background: state.backgroundLayer,
|
background: state.backgroundLayer,
|
||||||
location: new UIEventSource<Loc>({
|
location: new UIEventSource<Loc>({
|
||||||
|
@ -149,9 +147,9 @@ export default class SpecialVisualizations {
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
new ShowDataLayer(
|
SpecialVisualizations.constructShowDataLayer(
|
||||||
featuresToShow,
|
featuresToShow,
|
||||||
minimap.leafletMap,
|
minimap["leafletMap"],
|
||||||
State.state.layoutToUse,
|
State.state.layoutToUse,
|
||||||
false,
|
false,
|
||||||
true
|
true
|
||||||
|
@ -160,7 +158,6 @@ export default class SpecialVisualizations {
|
||||||
|
|
||||||
minimap.SetStyle("overflow: hidden; pointer-events: none;")
|
minimap.SetStyle("overflow: hidden; pointer-events: none;")
|
||||||
return minimap;
|
return minimap;
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -366,6 +363,12 @@ export default class SpecialVisualizations {
|
||||||
|
|
||||||
]
|
]
|
||||||
static HelpMessage: BaseUIElement = SpecialVisualizations.GenHelpMessage();
|
static HelpMessage: BaseUIElement = SpecialVisualizations.GenHelpMessage();
|
||||||
|
static constructMiniMap: (options?: {
|
||||||
|
background?: UIEventSource<BaseLayer>,
|
||||||
|
location?: UIEventSource<Loc>,
|
||||||
|
allowMoving?: boolean
|
||||||
|
}) => BaseUIElement;
|
||||||
|
static constructShowDataLayer: (features: UIEventSource<{ feature: any; freshness: Date }[]>, leafletMap: UIEventSource<any>, layoutToUse: UIEventSource<any>, enablePopups?: boolean, zoomToFeatures?: boolean) => any;
|
||||||
|
|
||||||
private static GenHelpMessage() {
|
private static GenHelpMessage() {
|
||||||
|
|
||||||
|
|
9
index.ts
9
index.ts
|
@ -16,10 +16,19 @@ import CountryCoder from "latlon2country"
|
||||||
import SimpleMetaTagger from "./Logic/SimpleMetaTagger";
|
import SimpleMetaTagger from "./Logic/SimpleMetaTagger";
|
||||||
import Minimap from "./UI/Base/Minimap";
|
import Minimap from "./UI/Base/Minimap";
|
||||||
import DirectionInput from "./UI/Input/DirectionInput";
|
import DirectionInput from "./UI/Input/DirectionInput";
|
||||||
|
import SpecialVisualizations from "./UI/SpecialVisualizations";
|
||||||
|
import ShowDataLayer from "./UI/ShowDataLayer";
|
||||||
|
import * as L from "leaflet";
|
||||||
|
|
||||||
// Workaround for a stupid crash: inject some functions which would give stupid circular dependencies or crash the other nodejs scripts
|
// Workaround for a stupid crash: inject some functions which would give stupid circular dependencies or crash the other nodejs scripts
|
||||||
SimpleMetaTagger.coder = new CountryCoder("https://pietervdvn.github.io/latlon2country/");
|
SimpleMetaTagger.coder = new CountryCoder("https://pietervdvn.github.io/latlon2country/");
|
||||||
DirectionInput.constructMinimap = options => new Minimap(options)
|
DirectionInput.constructMinimap = options => new Minimap(options)
|
||||||
|
SpecialVisualizations.constructMiniMap = options => new Minimap(options)
|
||||||
|
SpecialVisualizations.constructShowDataLayer = (features: UIEventSource<{ feature: any, freshness: Date }[]>,
|
||||||
|
leafletMap: UIEventSource<L.Map>,
|
||||||
|
layoutToUse: UIEventSource<LayoutConfig>,
|
||||||
|
enablePopups = true,
|
||||||
|
zoomToFeatures = false) => new ShowDataLayer(features, leafletMap, layoutToUse, enablePopups, zoomToFeatures)
|
||||||
|
|
||||||
let defaultLayout = ""
|
let defaultLayout = ""
|
||||||
// --------------------- Special actions based on the parameters -----------------
|
// --------------------- Special actions based on the parameters -----------------
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue