@@ -17,11 +17,15 @@ export enum ClickType {
1717
1818
1919export class MapBounds < T = DefaultLatLonKeys > extends BaseNative < NTMapBounds , { } > {
20- constructor ( public northeast : GenericMapPos < T > , public southwest : GenericMapPos < T > , native ?: NTMapBounds ) {
20+ constructor ( public northeast ? : GenericMapPos < T > , public southwest ? : GenericMapPos < T > , native ?: NTMapBounds ) {
2121 super ( undefined , native ) ;
2222 }
2323 createNative ( ) {
24- return NTMapBounds . alloc ( ) . initWithMinMax ( toNativeMapPos ( this . southwest ) , toNativeMapPos ( this . northeast ) ) ;
24+ if ( this . southwest && this . northeast ) {
25+ return NTMapBounds . alloc ( ) . initWithMinMax ( toNativeMapPos < T > ( this . southwest ) , toNativeMapPos < T > ( this . northeast ) ) ;
26+ } else {
27+ return NTMapBounds . alloc ( ) . init ( ) ;
28+ }
2529 }
2630 contains ( position : GenericMapPos < T > | MapBounds < T > ) {
2731 if ( position [ 'southwest' ] ) {
@@ -33,6 +37,9 @@ export class MapBounds<T = DefaultLatLonKeys> extends BaseNative<NTMapBounds, {}
3337 intersects ( position : MapBounds < T > ) {
3438 return this . getNative ( ) . intersects ( toNativeMapBounds < T > ( position ) ) ;
3539 }
40+ shrinkToIntersection ( position : MapBounds ) {
41+ return this . getNative ( ) . shrinkToIntersection ( toNativeMapBounds ( position ) ) ;
42+ }
3643 equals ( position : MapBounds < T > ) {
3744 return this . getNative ( ) . isEqualInternal ( toNativeMapBounds < T > ( position ) ) ;
3845 }
@@ -119,6 +126,9 @@ export function toNativeMapBounds<T = DefaultLatLonKeys>(bounds: MapBounds<T>) {
119126 if ( bounds instanceof NTMapBounds ) {
120127 return bounds ;
121128 }
129+ if ( typeof bounds . getNative === 'function' ) {
130+ return bounds . getNative ( ) ;
131+ }
122132 return NTMapBounds . alloc ( ) . initWithMinMax ( toNativeMapPos < T > ( bounds . southwest ) , toNativeMapPos < T > ( bounds . northeast ) ) ;
123133}
124134
0 commit comments