@@ -487,6 +487,7 @@ class Map extends Handlerable(Eventable(Renderable(Class))) {
487
487
// const pitch = this.getPitch();
488
488
// const visualDistance = this.height / 2 * Math.tan(visualPitch * Math.PI / 180);
489
489
// return this.height / 2 + visualDistance * Math.tan((90 - pitch) * Math.PI / 180);
490
+ visualPitch = visualPitch || 1E-2 ;
490
491
491
492
const pitch = ( 90 - this . getPitch ( ) ) * Math . PI / 180 ;
492
493
const fov = this . getFov ( ) * Math . PI / 180 ;
@@ -1338,21 +1339,28 @@ class Map extends Handlerable(Eventable(Renderable(Class))) {
1338
1339
return this ;
1339
1340
}
1340
1341
const center = this . getCenter ( ) ;
1341
- this . _updateMapSize ( watched ) ;
1342
1342
1343
1343
if ( ! this . options [ 'fixCenterOnResize' ] ) {
1344
- const resizeOffset = new Point ( ( oldWidth - watched . width ) / 2 , ( oldHeight - watched . height ) / 2 ) ;
1345
- this . _offsetCenterByPixel ( resizeOffset ) ;
1344
+ // fix northwest's geo coordinate
1345
+ const vh = this . _getVisualHeight ( this . getPitch ( ) ) ;
1346
+ const nwCP = new Point ( 0 , this . height - vh ) ;
1347
+ const nwCoord = this . _containerPointToPrj ( nwCP ) ;
1348
+ this . _updateMapSize ( watched ) ;
1349
+ const vhAfter = this . _getVisualHeight ( this . getPitch ( ) ) ;
1350
+ const nwCPAfter = new Point ( 0 , this . height - vhAfter ) ;
1351
+ this . _setPrjCoordAtContainerPoint ( nwCoord , nwCPAfter ) ;
1346
1352
// when size changed, center is updated but panel's offset remains.
1347
1353
this . _mapViewCoord = this . _getPrjCenter ( ) ;
1354
+ } else {
1355
+ this . _updateMapSize ( watched ) ;
1348
1356
}
1349
1357
1350
1358
const hided = ( watched [ 'width' ] === 0 || watched [ 'height' ] === 0 || oldWidth === 0 || oldHeight === 0 ) ;
1351
1359
1352
1360
if ( justStart || hided ) {
1353
- this . _noEvent = true ;
1361
+ this . _eventSilence = true ;
1354
1362
this . setCenter ( center ) ;
1355
- delete this . _noEvent ;
1363
+ delete this . _eventSilence ;
1356
1364
}
1357
1365
/**
1358
1366
* resize event when map container's size changes
@@ -1659,7 +1667,7 @@ class Map extends Handlerable(Eventable(Renderable(Class))) {
1659
1667
1660
1668
1661
1669
_fireEvent ( eventName , param ) {
1662
- if ( this . _noEvent ) {
1670
+ if ( this . _eventSilence ) {
1663
1671
return ;
1664
1672
}
1665
1673
//fire internal events at first
0 commit comments