This commit is contained in:
Pieter Vander Vennet 2023-02-07 02:11:17 +01:00
parent c900bfccb1
commit d04f56603e
2 changed files with 4 additions and 6 deletions

View file

@ -27,9 +27,9 @@ export class GeolocationControl extends VariableUiElement {
const timeDiff = (new Date().getTime() - lastClick.getTime()) / 1000 const timeDiff = (new Date().getTime() - lastClick.getTime()) / 1000
return timeDiff <= 3 return timeDiff <= 3
}) })
const geolocationState = geolocationHandler.geolocationState const geolocationState = geolocationHandler?.geolocationState
super( super(
geolocationState.permission.map( geolocationState?.permission?.map(
(permission) => { (permission) => {
if (permission === "denied") { if (permission === "denied") {
return Svg.location_refused_svg() return Svg.location_refused_svg()

View file

@ -13,12 +13,10 @@ export default class RightControls extends Combine {
state: MapState & { featurePipeline: FeaturePipeline }, state: MapState & { featurePipeline: FeaturePipeline },
geolocationHandler: GeoLocationHandler geolocationHandler: GeoLocationHandler
) { ) {
const geolocationButton = new Toggle( const geolocationButton = Toggle.If(state.featureSwitchGeolocation, () =>
new MapControlButton(new GeolocationControl(geolocationHandler, state), { new MapControlButton(new GeolocationControl(geolocationHandler, state), {
dontStyle: true, dontStyle: true,
}).SetClass("p-1"), }).SetClass("p-1")
undefined,
state.featureSwitchGeolocation
) )
const plus = new MapControlButton(Svg.plus_svg()).onClick(() => { const plus = new MapControlButton(Svg.plus_svg()).onClick(() => {