Skip to content

Commit 221d199

Browse files
fix bug with map pan+zoom on statup
1 parent 0724285 commit 221d199

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

cache.manifest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
CACHE MANIFEST
2-
# version 203
2+
# version 204
33

44
# gogole maps files
55
http://maps.google.com/maps/api/js?v=3.10&sensor=false&language=en_us&key=AIzaSyCOqkcNey4CCyG4X0X5qxHAhCgD8g5DwXg

js/tracker.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,10 @@ function unload() {
112112
}
113113

114114
function panTo(vehicle_index) {
115-
if(vehicles[vehicle_index].marker_shadow) map.panTo(vehicles[vehicle_index].marker_shadow.getPosition());
116-
else map.panTo(vehicles[vehicle_index].marker.getPosition());
115+
if(vehicle_index < 0) return;
116+
117+
if(vehicles[vehicle_index].marker_shadow) map.panTo(vehicles[vehicle_index].marker_shadow.getPosition());
118+
else map.panTo(vehicles[vehicle_index].marker.getPosition());
117119
}
118120

119121
function optional(caption, value, postfix) {
@@ -273,9 +275,7 @@ function stopFollow() {
273275
}
274276

275277
function followVehicle(index) {
276-
if(vehicles.length < 1) return;
277-
278-
if(follow_vehicle != -1) vehicles[follow_vehicle].follow = false;
278+
if(follow_vehicle != -1 && vehicles.length) vehicles[follow_vehicle].follow = false;
279279

280280
if(follow_vehicle == index) {
281281
vehicles[follow_vehicle].follow = false;
@@ -1248,9 +1248,9 @@ function update(response) {
12481248
function zoom_on_payload() {
12491249
// find a the first balloon
12501250
var i = -1, ii = vehicles.length;
1251-
while(++i < ii && !vehicles[i].marker_shadow);
1251+
while(++i < ii) if(vehicles[i].type == "balloon") break;
12521252

1253-
if(i == ii) { i = 0 }
1253+
if(i == ii) return;
12541254
else {
12551255
// find the bounds of the ballons first and last positions
12561256
var bounds = new google.maps.LatLngBounds();

0 commit comments

Comments
 (0)