Skip to content

Commit 1e29f06

Browse files
autopan will not trigger if you've dragged the map
1 parent 7323b1b commit 1e29f06

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

js/tracker.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ var got_positions = false;
2020
var zoomed_in = false;
2121
var max_positions = 0; // maximum number of positions that ajax request should return (0 means no maximum)
2222
var follow_vehicle = null;
23+
var manual_pan = false;
2324

2425
var car_index = 0;
2526
var car_colors = ["blue", "red", "green", "yellow"];
@@ -357,6 +358,10 @@ function load() {
357358
updateZoom();
358359
});
359360

361+
google.maps.event.addListener(map, 'dragstart', function() {
362+
manual_pan = true;
363+
});
364+
360365
// only start population the map, once its completely loaded
361366
google.maps.event.addListenerOnce(map, 'idle', function(){
362367
startAjax();
@@ -611,6 +616,7 @@ function followVehicle(vcallsign) {
611616
updateGraph(vcallsign, true);
612617
}
613618

619+
manual_pan = false;
614620
panTo(vcallsign);
615621
}
616622

@@ -2038,7 +2044,7 @@ function update(response) {
20382044
ctx.lastPPointer.push(vehicle.curr_position);
20392045

20402046
if(listScroll) listScroll.refresh();
2041-
if(zoomed_in && follow_vehicle == vcallsign) panTo(follow_vehicle);
2047+
if(zoomed_in && follow_vehicle == vcallsign && !manual_pan) panTo(follow_vehicle);
20422048
}
20432049

20442050
// step to the next callsign

0 commit comments

Comments
 (0)