mapcomplete/UI/BigComponents/RightControls.ts

47 lines
1.4 KiB
TypeScript
Raw Normal View History

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 State from "../../State";
import Svg from "../../Svg";
export default class RightControls extends Combine {
constructor() {
const geolocationButton = new Toggle(
new MapControlButton(
new GeoLocationHandler(
State.state.currentGPSLocation,
State.state.leafletMap,
State.state.layoutToUse
), {
dontStyle: true
}
),
undefined,
State.state.featureSwitchGeolocation
);
const plus = new MapControlButton(
Svg.plus_svg(),{
dontStyle:true
}
2021-07-28 16:48:59 +02:00
).onClick(() => {
State.state.locationControl.data.zoom++;
State.state.locationControl.ping();
});
const min = new MapControlButton(
Svg.min_svg(),{
dontStyle: true
}
2021-07-28 16:48:59 +02:00
).onClick(() => {
State.state.locationControl.data.zoom--;
State.state.locationControl.ping();
});
super([plus, min, geolocationButton].map(el => el.SetClass("m-0.5 md:m-1")))
this.SetClass("flex flex-col items-center")
2021-07-28 16:48:59 +02:00
}
}