Created
October 26, 2013 16:16
-
-
Save werelax/7171337 to your computer and use it in GitHub Desktop.
Para el hackaton de tizen
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
| 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; |
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 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