Skip to content

Commit ebd0576

Browse files
listeners, vehicles and horizon circles on map
1 parent 894f6aa commit ebd0576

File tree

5 files changed

+232
-216
lines changed

5 files changed

+232
-216
lines changed

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ <h2>Chase car mode</h2>
100100
</div>
101101
<script src="http://maps.google.com/maps/api/js?sensor=false&key=AIzaSyCOqkcNey4CCyG4X0X5qxHAhCgD8g5DwXg" type="text/javascript"></script>
102102
<script type="text/javascript" language="javascript" src="js/jquery-1.8.3-min.js"></script>
103-
<script type="text/javascript" language="javascript" src="js/balloonmarker.js"></script>
103+
<script type="text/javascript" language="javascript" src="js/chasecar.lib.js"></script>
104104
<script type="text/javascript" language="javascript" src="js/iscroll.js"></script>
105105
<script type="text/javascript" language="javascript" src="js/tracker.js"></script>
106106
<script type="text/javascript" language="javascript" src="js/app.js"></script>

js/app.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ var preloadTimer;
44
var preloadImages = [
55
"img/logo.png",
66
"img/marker-you.png",
7+
"img/markers/antenna-green.png",
8+
"img/markers/balloon-red.png",
9+
"img/markers/balloon-blue.png",
10+
"img/markers/shadow.png"
711
];
812
var GPS_ts = null;
913
var GPS_lat = null;
@@ -38,7 +42,7 @@ function checkSize() {
3842
$('#main').height(180); // 180px is just enough to hold one expanded vehicle
3943
}
4044

41-
if(map) map.checkResize();
45+
//if(map) map.checkResize();
4246

4347
// this should hide the address bar, when possible
4448
window.scrollTo(0,1);
@@ -207,7 +211,7 @@ $(window).ready(function() {
207211
CHASE_enabled = false;
208212

209213
// blue man reappers :)
210-
if(currentPosition && currentPosition.marker) currentPosition.marker.show();
214+
if(currentPosition && currentPosition.marker) currentPosition.marker.setVisible(true);
211215
// turning the switch on
212216
} else {
213217
if(callsign.length < 5) { alert('Please enter a valid callsign, at least 5 characters'); return; }
@@ -230,7 +234,7 @@ $(window).ready(function() {
230234
CHASE_enabled = true;
231235

232236
// hide the blue man
233-
if(currentPosition && currentPosition.marker) currentPosition.marker.hide();
237+
if(currentPosition && currentPosition.marker) currentPosition.marker.setVisible(false);
234238
}
235239
});
236240

@@ -264,7 +268,7 @@ $(window).ready(function() {
264268
$("#locate-me").click(function() {
265269
if(map && currentPosition) {
266270
$('.nav .home').click();
267-
map.panTo(new GLatLng(currentPosition.lat, currentPosition.lon));
271+
map.panTo(new google.maps.LatLng(currentPosition.lat, currentPosition.lon));
268272
} else {
269273
alert("No position available");
270274
}

js/balloonmarker.js

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ var image_shadow = "http://spacenear.us/tracker/images/markers/shadow.png";
1313
var image_shadow_width = 24;
1414
var image_shadow_height = 16;
1515

16-
function BalloonMarker(latlng, opts) {
16+
function BalloonMarker(map, latlng, opts) {
1717
this.latlng = latlng;
1818

1919
if (!opts) opts = {};
@@ -25,6 +25,8 @@ function BalloonMarker(latlng, opts) {
2525
this.clicked_ = 0;
2626
this.altitude_ = opts.altitude? opts.altitude : 0;
2727
this.img_ = opts.img;
28+
29+
this.initialize(map);
2830
}
2931

3032
/* BalloonMarker extends GOverlay class from the Google Maps API
@@ -36,6 +38,10 @@ BalloonMarker.prototype = new google.maps.OverlayView();
3638
*/
3739
BalloonMarker.prototype.initialize = function(map) {
3840
var me = this;
41+
this.draw = function() {};
42+
this.onAdd = function() {};
43+
this.onRemove = function() {};
44+
this.setMap(map);
3945

4046
// Create the DIV representing our BalloonMarker
4147
var div = document.createElement("div");
@@ -55,13 +61,16 @@ BalloonMarker.prototype.initialize = function(map) {
5561
div.style.backgroundRepeat = 'no-repeat';
5662
div.style.backgroundPosition = "" + ((image_width - image_shadow_width)/2) + "px " + (image_height + me.altitude_ - image_shadow_height) + "px";
5763
}
58-
64+
/*
5965
google.maps.Event.addDomListener(this.img_, "click", function(event) {
6066
me.clicked_ = 1;
6167
GEvent.trigger(me, "click");
6268
});
69+
*/
6370

64-
map.getPane(G_MAP_MARKER_PANE).appendChild(div);
71+
//map.getPane(G_MAP_MARKER_PANE).appendChild(div);
72+
console.log(this.getPanes());
73+
this.getPanes().overlayImage.appendChild(div);
6574

6675
this.map_ = map;
6776
this.div_ = div;
@@ -84,7 +93,7 @@ BalloonMarker.prototype.copy = function() {
8493
opts.mode = this.mode_;
8594
opts.altitude = this.altitude_;
8695
opts.img = this.img_;
87-
return new BalloonMarker(this.latlng, opts);
96+
return new BalloonMarker(this.map_, this.latlng, opts);
8897
};
8998

9099
/* Redraw the BalloonMarker based on the current projection and zoom level
@@ -98,7 +107,7 @@ BalloonMarker.prototype.redraw = function(force) {
98107
// Calculate the DIV coordinates of two opposite corners
99108
// of our bounds to get the size and position of our BalloonMarker
100109
if(!this.latlng) return;
101-
var divPixel = this.map_.fromLatLngToDivPixel(this.latlng);
110+
var divPixel = this.getProjection().fromLatLngToDivPixel(this.latlng);
102111

103112
// Now position our DIV based on the DIV coordinates of our bounds
104113
this.div_.style.width = this.width_ + "px";

js/mobile.js

Lines changed: 0 additions & 2 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)