2021-07-28 16:48:59 +02:00
|
|
|
import Combine from "../Base/Combine"
|
|
|
|
import Toggle from "../Input/Toggle"
|
|
|
|
import MapControlButton from "../MapControlButton"
|
|
|
|
import GeoLocationHandler from "../../Logic/Actors/GeoLocationHandler"
|
|
|
|
import Svg from "../../Svg"
|
2022-08-06 17:30:23 +02:00
|
|
|
import MapState from "../../Logic/State/MapState"
|
2022-07-21 15:54:24 +02:00
|
|
|
import FeaturePipeline from "../../Logic/FeatureSource/FeaturePipeline"
|
|
|
|
import { Utils } from "../../Utils"
|
2022-07-22 01:33:11 +02:00
|
|
|
import { TagUtils } from "../../Logic/Tags/TagUtils"
|
2022-07-25 16:55:44 +02:00
|
|
|
import { BBox } from "../../Logic/BBox"
|
|
|
|
import { OsmFeature } from "../../Models/OsmFeature"
|
2022-08-06 17:30:23 +02:00
|
|
|
import LevelSelector from "./LevelSelector"
|
2021-07-28 16:48:59 +02:00
|
|
|
|
|
|
|
export default class RightControls extends Combine {
|
2022-07-21 15:54:24 +02:00
|
|
|
constructor(state: MapState & { featurePipeline: FeaturePipeline }) {
|
2021-11-03 00:44:53 +01:00
|
|
|
const geolocatioHandler = new GeoLocationHandler(state)
|
2021-11-07 16:34:51 +01:00
|
|
|
|
2021-07-28 16:48:59 +02:00
|
|
|
const geolocationButton = new Toggle(
|
|
|
|
new MapControlButton(geolocatioHandler, {
|
|
|
|
dontStyle: true,
|
2022-12-13 03:46:53 +01:00
|
|
|
}).SetClass("p-1"),
|
2021-07-28 16:48:59 +02:00
|
|
|
undefined,
|
2021-10-15 05:20:02 +02:00
|
|
|
state.featureSwitchGeolocation
|
2021-07-28 16:48:59 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
const plus = new MapControlButton(Svg.plus_svg()).onClick(() => {
|
2021-10-15 05:20:02 +02:00
|
|
|
state.locationControl.data.zoom++
|
|
|
|
state.locationControl.ping()
|
2021-07-28 16:48:59 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
const min = new MapControlButton(Svg.min_svg()).onClick(() => {
|
2021-10-15 05:20:02 +02:00
|
|
|
state.locationControl.data.zoom--
|
|
|
|
state.locationControl.ping()
|
2021-07-28 16:48:59 +02:00
|
|
|
})
|
|
|
|
|
2022-08-06 17:30:23 +02:00
|
|
|
const levelSelector = new LevelSelector(state)
|
|
|
|
super(
|
|
|
|
[levelSelector, plus, min, geolocationButton].map((el) => el.SetClass("m-0.5 md:m-1"))
|
2022-09-08 21:40:48 +02:00
|
|
|
)
|
2021-08-19 23:41:48 +02:00
|
|
|
this.SetClass("flex flex-col items-center")
|
2021-07-28 16:48:59 +02:00
|
|
|
}
|
|
|
|
}
|