forked from MapComplete/MapComplete
		
	Fix padding calculation by using the leaflet builtin padding function
This commit is contained in:
		
							parent
							
								
									202e3cd677
								
							
						
					
					
						commit
						d5853050b0
					
				
					 1 changed files with 5 additions and 7 deletions
				
			
		| 
						 | 
					@ -155,17 +155,15 @@ export default class OverpassFeatureSource implements FeatureSource {
 | 
				
			||||||
            return;
 | 
					            return;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        const bounds = this._leafletMap.data?.getBounds();
 | 
					        const bounds = this._leafletMap.data?.getBounds()?.pad( this._layoutToUse.data.widenFactor);
 | 
				
			||||||
        if (bounds === undefined) {
 | 
					        if (bounds === undefined) {
 | 
				
			||||||
            return;
 | 
					            return;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        const diff = this._layoutToUse.data.widenFactor;
 | 
					        const n = Math.min(90, bounds.getNorth() );
 | 
				
			||||||
 | 
					        const e = Math.min(180, bounds.getEast() );
 | 
				
			||||||
        const n = Math.min(90, bounds.getNorth() + diff);
 | 
					        const s = Math.max(-90, bounds.getSouth());
 | 
				
			||||||
        const e = Math.min(180, bounds.getEast() + diff);
 | 
					        const w = Math.max(-180, bounds.getWest());
 | 
				
			||||||
        const s = Math.max(-90, bounds.getSouth() - diff);
 | 
					 | 
				
			||||||
        const w = Math.max(-180, bounds.getWest() - diff);
 | 
					 | 
				
			||||||
        const queryBounds = {north: n, east: e, south: s, west: w};
 | 
					        const queryBounds = {north: n, east: e, south: s, west: w};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        const z = Math.floor(this._location.data.zoom ?? 0);
 | 
					        const z = Math.floor(this._location.data.zoom ?? 0);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue