Fix initial world size on mobile
All checks were successful
Deploy Spot / deploy (push) Successful in 38s
All checks were successful
Deploy Spot / deploy (push) Successful in 38s
This commit is contained in:
@@ -233,9 +233,12 @@ export default {
|
||||
|
||||
//Adapt zoom to see whole planet
|
||||
const $Canvas = this.map.getCanvas();
|
||||
const iTargetRadius = Math.min($Canvas.clientWidth, $Canvas.clientHeight) / 2;
|
||||
const iWorldSize = iTargetRadius * 2 * Math.PI * Math.cos(oDefaultProject.latitude * Math.PI / 180);
|
||||
const oMapBounds = this.map.getContainer().getBoundingClientRect();
|
||||
|
||||
//Adapt zoom to see whole planet
|
||||
const iTargetRadius = Math.max(1, Math.min(oMapBounds.width || $Canvas.clientWidth, oMapBounds.height || $Canvas.clientHeight) / 2);
|
||||
const iWorldSize = iTargetRadius * 2 * Math.PI * Math.cos(oDefaultProject.latitude * Math.PI / 180);
|
||||
|
||||
this.map.jumpTo({
|
||||
center: new LngLat(oDefaultProject.longitude, oDefaultProject.latitude),
|
||||
zoom: Math.log2(iWorldSize / this.map.transform.tileSize)
|
||||
|
||||
Reference in New Issue
Block a user