gpstrek - Fix drawing finish icon

pull/2768/head
Martin Boonk 2023-06-10 18:29:14 +02:00
parent 3d7575438e
commit 5433953ca9
1 changed files with 3 additions and 5 deletions

View File

@ -509,6 +509,7 @@ let getMapSlice = function(){
data.poly.push((startingPoint.y-toDraw.y)*-1);
if (j < SETTINGS.mapChunkSize - 1) data.i = data.i + (reverse?-1:1);
}
finish = isLast(route, data.i - 1);
data.poly = graphics.transformVertices(data.poly, mapTrans);
graphics.drawPoly(data.poly, false);
@ -526,12 +527,9 @@ let getMapSlice = function(){
graphics.drawString(c.n, data.poly[c.i] + 10, data.poly[c.i+1]);
}
finish = isLast(route, currentRouteIndex + data.i);
if (finish)
graphics.drawImage(finishIcon, data.poly[data.poly.length - 2] -5, data.poly[data.poly.length - 1] - 4);
if (last) {
else if (last) {
graphics.drawImage(cross, data.poly[data.poly.length - 2] - cross.width/2, data.poly[data.poly.length - 1] - cross.height/2);
}
@ -1055,12 +1053,12 @@ let prev = function(route){
};
let getLast = function(route){
lastMirror = route.mirror;
return get(route, route.indexToOffset.length - 1);
};
let isLast = function(route, index){
if (isNaN(index)) index = route.index;
index = getWaypointIndex(route, index);
return route.indexToOffset.length - 1 == index;
};