projects
/
lantea.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
8f63227
)
make segments be separate lines without connections, try to make track drawing code...
author
Robert Kaiser
<kairo@kairo.at>
Fri, 7 Nov 2014 02:52:50 +0000
(
03:52
+0100)
committer
Robert Kaiser
<kairo@kairo.at>
Fri, 7 Nov 2014 02:52:50 +0000
(
03:52
+0100)
js/map.js
patch
|
blob
|
blame
|
history
diff --git
a/js/map.js
b/js/map.js
index f6b9d86200761cff1e12d65afb1d2b0f9bc661ea..2532a034aeb76d92b1bdc5e6141cfd99cce604fb 100644
(file)
--- a/
js/map.js
+++ b/
js/map.js
@@
-661,7
+661,7
@@
function drawTrack() {
if (gTrack.length) {
for (var i = 0; i < gTrack.length; i++) {
drawTrackPoint(gTrack[i].coords.latitude, gTrack[i].coords.longitude,
if (gTrack.length) {
for (var i = 0; i < gTrack.length; i++) {
drawTrackPoint(gTrack[i].coords.latitude, gTrack[i].coords.longitude,
- (i + 1 >= gTrack.length));
+ (i + 1 >= gTrack.length
|| gTrack[i+1].beginSegment
));
}
}
}
}
}
}
@@
-681,22
+681,23
@@
function drawTrackPoint(aLatitude, aLongitude, lastPoint) {
gTrackContext.lineCap = "round";
gTrackContext.lineJoin = "round";
}
gTrackContext.lineCap = "round";
gTrackContext.lineJoin = "round";
}
+ // This breaks optimiziation, so make sure to reset optimization.
if (!gLastDrawnPoint || gLastDrawnPoint == trackpoint) {
if (!gLastDrawnPoint || gLastDrawnPoint == trackpoint) {
- // This breaks optimiziation, so make sure to close path and reset optimization.
- if (gLastDrawnPoint && gLastDrawnPoint.optimized)
+ trackpoint.optimized = false;
+ // Close path if one was open.
+ if (gLastDrawnPoint && gLastDrawnPoint.optimized) {
gTrackContext.stroke();
gTrackContext.stroke();
+ }
+ }
+ if (!gLastDrawnPoint || (gLastDrawnPoint == trackpoint) || !gLastDrawnPoint.optimized) {
+ // Start drawing a segment.
gTrackContext.beginPath();
gTrackContext.beginPath();
- trackpoint.optimized = false;
gTrackContext.arc(mappos.x, mappos.y,
gTrackContext.lineWidth, 0, Math.PI * 2, false);
gTrackContext.fill();
}
else {
gTrackContext.arc(mappos.x, mappos.y,
gTrackContext.lineWidth, 0, Math.PI * 2, false);
gTrackContext.fill();
}
else {
- if (!gLastDrawnPoint || !gLastDrawnPoint.optimized) {
- gTrackContext.beginPath();
- gTrackContext.moveTo(Math.round((gLastDrawnPoint.x - gMap.pos.x) / gMap.zoomFactor + gMap.width / 2),
- Math.round((gLastDrawnPoint.y - gMap.pos.y) / gMap.zoomFactor + gMap.height / 2));
- }
+ // Continue drawing segment, close if needed.
gTrackContext.lineTo(mappos.x, mappos.y);
if (!trackpoint.optimized)
gTrackContext.stroke();
gTrackContext.lineTo(mappos.x, mappos.y);
if (!trackpoint.optimized)
gTrackContext.stroke();