File tree Expand file tree Collapse file tree 3 files changed +7
-16
lines changed Expand file tree Collapse file tree 3 files changed +7
-16
lines changed Original file line number Diff line number Diff line change @@ -101,18 +101,15 @@ export function toNativeScreenPos(position: ScreenPos) {
101101 }
102102 return new com . carto . core . ScreenPos ( position . x , position . y ) ;
103103}
104- export function fromNativeMapRange ( value : com . carto . core . MapRange ) {
105- return {
106- max : value . getMax ( ) ,
107- min : value . getMin ( )
108- } as MapRange ;
104+ export function fromNativeMapRange ( value : NTMapRange ) {
105+ return [ value . getMax ( ) , value . getMin ( ) ] as MapRange ;
109106}
110107export function toNativeMapRange ( value : MapRange ) {
111- if ( value instanceof com . carto . core . MapRange ) {
108+ if ( value instanceof NTMapRange ) {
112109 return value ;
113110 }
114111 // ignore z for now as points can get under the map!
115- return new com . carto . core . MapRange ( value . min , value . max ) ;
112+ return new com . carto . core . MapRange ( value [ 0 ] , value [ 1 ] ) ;
116113}
117114export function toNativeMapVec ( value : MapVec | [ number , number , number ] ) {
118115 if ( Array . isArray ( value ) ) {
Original file line number Diff line number Diff line change @@ -24,10 +24,7 @@ export interface MapVec {
2424 y : number ;
2525 z : number ;
2626}
27- export interface MapRange {
28- min : number ;
29- max : number ;
30- }
27+ export type MapRange = [ number , number ] ;
3128
3229export class ScreenBounds {
3330 min : ScreenPos ;
Original file line number Diff line number Diff line change @@ -93,17 +93,14 @@ export function toNativeScreenPos(position: ScreenPos | NTScreenPos) {
9393 return NTScreenPos . alloc ( ) . initWithXY ( position . x , position . y ) ;
9494}
9595export function fromNativeMapRange ( value : NTMapRange ) {
96- return {
97- max : value . getMax ( ) ,
98- min : value . getMin ( )
99- } as MapRange ;
96+ return [ value . getMax ( ) , value . getMin ( ) ] as MapRange ;
10097}
10198export function toNativeMapRange ( value : MapRange ) {
10299 if ( value instanceof NTMapRange ) {
103100 return value ;
104101 }
105102 // ignore z for now as points can get under the map!
106- return NTMapRange . alloc ( ) . initWithMinMax ( value . min , value . max ) ;
103+ return NTMapRange . alloc ( ) . initWithMinMax ( value [ 0 ] , value [ 1 ] ) ;
107104}
108105export function toNativeMapVec ( value : MapVec | [ number , number , number ] ) {
109106 if ( Array . isArray ( value ) ) {
You can’t perform that action at this time.
0 commit comments