Commit e0e041b5 authored by Michael Ochmann's avatar Michael Ochmann
Browse files

* fixed `navigator.geolocation.watchPosition` bug with accuracy

* added scaling to x value of points in canvas
parent b5330df8
......@@ -157,13 +157,15 @@ class HeightMapViewController extends UIViewController {
ctx.font = "15px Arial";
ctx.textAlign = "left";
let num = 0;
let lastPoint = null;
for (let point of this.model.points) {
let ordinateVal = Std.Map(point.altitude, min, this.model.max, 0, height * 0.95);
ctx.lineTo(x, height - ordinateVal);
x+=40;
x = lastPoint === null ? x : x + HeightMapViewController.DistanceToPixels(lastPoint.distance(point));
if (point.altitude && num % 2 === 0)
ctx.fillText(point.altitude.toFixed(2), x - 50, height - ordinateVal - 16);
num++;
lastPoint = point;
}
ctx.lineTo(x - 40, height);
ctx.lineTo(0, height);
......@@ -262,8 +264,11 @@ class HeightMapViewController extends UIViewController {
`;
}
static DistanceToPixels(distance) {
let fiveMeters = 40; // pixels
return distance * fiveMeters / 5;
}
}
HeightMapViewController.BACKGROUND = "#ccc";
HeightMapViewController.MAINLOOP = null;
export default HeightMapViewController;
\ No newline at end of file
......@@ -181,7 +181,7 @@ class ViewController extends UIViewController {
*/
downloadIOS() {
let track = this.tracks.get(this.track);
let mediaType = "plain/text";
let mediaType = "text/plain";
let link = document.createElement("a");
let blob = new Blob([Std.StringToBinary(new GeoJSONCollection(track).toString())], { type: mediaType });
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment