Created
November 29, 2016 02:21
-
-
Save samueleastdev/0d1d532d75e0341fd1d7dbb3f0d501df to your computer and use it in GitHub Desktop.
Appcelerator MapView showAnnotations Android
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var returnData; // returned array of location data | |
if (OS_IOS) { | |
$.MapView.showAnnotations(annotationArray); | |
} | |
if (OS_ANDROID) { | |
var largestLat = Math.max.apply(Math, returnData.map(function(o) { | |
return o.business.loc[1]; | |
})); | |
var smallestLat = Math.min.apply(Math, returnData.map(function(o) { | |
return o.business.loc[1]; | |
})); | |
var largestLon = Math.max.apply(Math, returnData.map(function(o) { | |
return o.business.loc[0]; | |
})); | |
var smallestLon = Math.min.apply(Math, returnData.map(function(o) { | |
return o.business.loc[0]; | |
})); | |
var latDelta = (largestLat - smallestLat); | |
var lonDelta = (largestLon - smallestLon); | |
$.MapView.setRegion({ | |
latitude: Ti.App.cords.latitude, | |
longitude: Ti.App.cords.longitude, | |
latitudeDelta: latDelta, | |
longitudeDelta: lonDelta, | |
//bearing : Ti.App.cords.heading, | |
tilt: 60 | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment