forked from MapComplete/MapComplete
		
	Merge branch 'fix/location-handler' into kletterspots-develop
This commit is contained in:
		
						commit
						baf7b8e5ea
					
				
					 3 changed files with 19 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -42,6 +42,11 @@ export class Basemap {
 | 
			
		|||
            layers: [this._previousLayer],
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        L.control.scale(
 | 
			
		||||
            {
 | 
			
		||||
                position: 'topright',
 | 
			
		||||
            }
 | 
			
		||||
        ).addTo(this.map)
 | 
			
		||||
 | 
			
		||||
        // Users are not allowed to zoom to the 'copies' on the left and the right, stuff goes wrong then
 | 
			
		||||
        // We give a bit of leeway for people on the edges
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,6 +17,14 @@ export class GeoLocationHandler extends UIElement {
 | 
			
		|||
    constructor() {
 | 
			
		||||
        super(undefined);
 | 
			
		||||
        this._hasLocation = State.state.currentGPSLocation.map((location) => location !== undefined);
 | 
			
		||||
        var self = this;
 | 
			
		||||
        import("../../vendor/Leaflet.AccuratePosition.js").then(() => {
 | 
			
		||||
            self.init();
 | 
			
		||||
        })
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    public init() {
 | 
			
		||||
        this.ListenTo(this._hasLocation);
 | 
			
		||||
        this.ListenTo(this._isActive);
 | 
			
		||||
        this.ListenTo(this._permission);
 | 
			
		||||
| 
						 | 
				
			
			@ -106,7 +114,12 @@ export class GeoLocationHandler extends UIElement {
 | 
			
		|||
            return "";
 | 
			
		||||
        }
 | 
			
		||||
        if (State.state.currentGPSLocation.data !== undefined) {
 | 
			
		||||
            map.flyTo(State.state.currentGPSLocation.data.latlng, 18);
 | 
			
		||||
            State.state.bm.map.flyTo(
 | 
			
		||||
                State.state.currentGPSLocation.data.latlng, 16,
 | 
			
		||||
                {
 | 
			
		||||
                    duration: 0.25,
 | 
			
		||||
                }
 | 
			
		||||
            );
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -65,7 +65,6 @@
 | 
			
		|||
<div id="leafletDiv"></div>
 | 
			
		||||
 | 
			
		||||
<script src="./index.ts"></script>
 | 
			
		||||
<script src="./vendor/Leaflet.AccuratePosition.js"></script>
 | 
			
		||||
 | 
			
		||||
<script data-goatcounter="https://pietervdvn.goatcounter.com/count" async src="//gc.zgo.at/count.js"></script>
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue