Skip to content

Commit bf47ae7

Browse files
update target mark logic for vehicle follow
1 parent 87b9bba commit bf47ae7

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

js/app.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -385,8 +385,6 @@ $(window).ready(function() {
385385
$('#main').on('click', '.row .data', function() {
386386
var e = $(this).parent();
387387
followVehicle(parseInt(e.attr('class').match(/vehicle(\d+)/)[1]));
388-
$('#main .row.follow').removeClass('follow');
389-
e.addClass('follow');
390388
});
391389

392390
// expand/collapse data when header is clicked
@@ -402,7 +400,6 @@ $(window).ready(function() {
402400
// disable following only we are collapsing the followed vehicle
403401
if(follow_vehicle == parseInt(e.attr('class').match(/vehicle(\d+)/)[1])) {
404402
stopFollow();
405-
e.removeClass('follow');
406403
}
407404
} else {
408405
// expand data for selected vehicle
@@ -419,8 +416,6 @@ $(window).ready(function() {
419416

420417
// pan to selected vehicle
421418
followVehicle(parseInt(e.attr('class').match(/vehicle(\d+)/)[1]));
422-
$('#main .row.follow').removeClass('follow');
423-
e.addClass('follow');
424419
}
425420
});
426421

js/tracker.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,9 @@ function updateZoom() {
369369

370370
function stopFollow() {
371371
if(follow_vehicle != -1) {
372+
// remove target mark
373+
$("#main .row.follow").removeClass("follow");
374+
372375
vehicles[follow_vehicle].follow = false;
373376
follow_vehicle = -1;
374377

@@ -387,6 +390,11 @@ function followVehicle(index) {
387390
if(follow_vehicle != index) {
388391
follow_vehicle = index;
389392
vehicles[follow_vehicle].follow = true;
393+
394+
// add target mark
395+
$("#main .row.follow").removeClass("follow");
396+
$("#main .vehicle"+follow_vehicle).addClass("follow");
397+
390398
updateGraph(index, true);
391399
}
392400

0 commit comments

Comments
 (0)