Skip to content

Instantly share code, notes, and snippets.

@kopiro
Last active August 29, 2015 13:57
Show Gist options
  • Select an option

  • Save kopiro/9639795 to your computer and use it in GitHub Desktop.

Select an option

Save kopiro/9639795 to your computer and use it in GitHub Desktop.
Center a map in Titanium + Underscore && Collections
var bb = [
_.min($$.pluck('lat')), _.min($$.pluck('lng')),
_.max($$.pluck('lat')), _.max($$.pluck('lng'))
];
$.map.region = {
latitude: (bb[0]+bb[2])/2,
longitude: (bb[1]+bb[3])/2,
latitudeDelta: 1.4*(bb[2]-bb[0]),
longitudeDelta: 1.4*(bb[3]-bb[1])
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment