@ -19,11 +19,6 @@ class MapHelper {
if ( ! this . _ map ) return
if ( ! this . _ map ) return
if ( is3D ) {
if ( is3D ) {
try {
this . _ map . setProjection ( 'globe' )
} catch ( _ ) {
/* ignore */
}
this . _ map . easeTo ( { pitch : 45 , bearing : 0 , duration : 0 } )
this . _ map . easeTo ( { pitch : 45 , bearing : 0 , duration : 0 } )
this . _ map . dragRotate . enable ( )
this . _ map . dragRotate . enable ( )
this . _ map . touchZoomRotate . enableRotation ( )
this . _ map . touchZoomRotate . enableRotation ( )
@ -32,12 +27,8 @@ class MapHelper {
}
}
if ( is2D ) {
if ( is2D ) {
// 航线/回放编辑需要平面投影;globe 下短航线 fitBounds 易失效
try {
this . _ map . setProjection ( 'mercator' )
} catch ( _ ) {
/* ignore */
}
// 只锁俯仰/旋转;投影由 setProjection 单独控制
// 监控要 globe 圆形地球,航线编辑要 mercator
this . _ map . easeTo ( { pitch : 0 , bearing : 0 , duration : 0 } )
this . _ map . easeTo ( { pitch : 0 , bearing : 0 , duration : 0 } )
this . _ map . dragRotate . disable ( )
this . _ map . dragRotate . disable ( )
this . _ map . touchZoomRotate . disableRotation ( )
this . _ map . touchZoomRotate . disableRotation ( )
@ -46,6 +37,15 @@ class MapHelper {
}
}
}
}
setProjection ( name ) {
if ( ! this . _ map || ! name ) return
try {
this . _ map . setProjection ( name )
} catch ( _ ) {
/* ignore */
}
}
replaceMapContainer ( newParent ) {
replaceMapContainer ( newParent ) {
if ( ! this . _ map || ! newParent ) return
if ( ! this . _ map || ! newParent ) return