Skip to content

Instantly share code, notes, and snippets.

@werelax
Created October 26, 2013 16:16
Show Gist options
  • Select an option

  • Save werelax/7171337 to your computer and use it in GitHub Desktop.

Select an option

Save werelax/7171337 to your computer and use it in GitHub Desktop.
Para el hackaton de tizen
distance: function(coords) {
var barPos = this.get("location"),
R = 6371*1000,
dtr = Math.PI / 180,
lat1 = coords.latitude*dtr, lon1 = coords.longitude*dtr,
lat2 = barPos.latitude*dtr, lon2 = barPos.longitude*dtr,
x = (lon2-lon1) * Math.cos((lat1+lat2)/2),
y = (lat2-lat1),
d = Math.sqrt(x*x + y*y) * R;
var co = this.model.get("location");
var mapOptions = {
zoom: 18,
center: new google.maps.LatLng(co.latitude, co.longitude),
mapTypeId: google.maps.MapTypeId.ROADMAP,
disableDefaultUI: true
};
this.map = new google.maps.Map(this.$("#map").get(0), mapOptions);
new google.maps.Marker({
map: this.map,
draggable: false,
animation: google.maps.Animation.DROP,
position: new google.maps.LatLng(co.latitude, co.longitude),
});
this.ui.money.val(this.model.get("money") || 5);
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment