mapcomplete/test.ts

24 lines
973 B
TypeScript
Raw Normal View History

2021-11-18 23:42:03 +01:00
import BackgroundMapSwitch from "./UI/BigComponents/BackgroundMapSwitch";
import {UIEventSource} from "./Logic/UIEventSource";
import Loc from "./Models/Loc";
import AvailableBaseLayersImplementation from "./Logic/Actors/AvailableBaseLayersImplementation";
import AvailableBaseLayers from "./Logic/Actors/AvailableBaseLayers";
import BaseLayer from "./Models/BaseLayer";
import {VariableUiElement} from "./UI/Base/VariableUIElement";
2021-11-16 04:16:51 +01:00
AvailableBaseLayers.implement(new AvailableBaseLayersImplementation())
const state = {
currentBackground: new UIEventSource<BaseLayer>(AvailableBaseLayers.osmCarto),
2021-11-18 23:42:03 +01:00
locationControl: new UIEventSource<Loc>({
zoom: 19,
lat: 51.2,
lon: 3.2
2021-11-18 23:42:03 +01:00
})
}
const actualBackground = new UIEventSource(AvailableBaseLayers.osmCarto)
new BackgroundMapSwitch(state,
{
currentBackground: actualBackground
}).AttachTo("maindiv")
new VariableUiElement(actualBackground.map(bg => bg.id)).AttachTo("extradiv")