Skip to content

Commit a42801d

Browse files
committed
trail: hopefully got map drawing to work.
1 parent 8acb48a commit a42801d

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

apps/trail/trail.app.js

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -493,9 +493,12 @@ function angleDifference(angle1, angle2) {
493493
return difference;
494494
}
495495

496+
/* Main code */
497+
496498
/* These are initialized by read() function, below */
497499
var start = {}, destination = {}, num = 0, dist = 0;
498500

501+
/* pp .. Point, n .. filename, candy .. enable "eye candy" drawing */
499502
function read(pp, n, candy) {
500503
let f = require("Storage").open(n+".st", "r");
501504
let l = f.readLine();
@@ -544,7 +547,7 @@ function read(pp, n, candy) {
544547

545548
/* Find out start/stop points (and display some eye-candy) */
546549
function time_read() {
547-
let n = track_name
550+
let n = track_name;
548551
ui.drawMsg("Converting");
549552
print("Converting...");
550553
to_storage(n);
@@ -562,6 +565,7 @@ function time_read() {
562565
let v2 = getTime();
563566
print("Read took", (v2-v1), "seconds");
564567
step_init();
568+
zoom.geoNew(start, 3000);
565569
print(num, "points", dist, "distance");
566570
setTimeout(step, 100);
567571
}
@@ -714,6 +718,11 @@ function step() {
714718
pp.lon = track[i].lon;
715719
pp.course = fmt.bearing(track[i], track[i+1]);
716720
}
721+
if (!follow && !fix.fix) {
722+
pp.lat = 50.010507; /* FIXME */
723+
pp.lon = 14.765840;
724+
pp.course = 0;
725+
}
717726

718727
let quiet = {};
719728
if (follow)
@@ -748,7 +757,7 @@ function step() {
748757
}
749758

750759
g.setColor(0, 0, 0);
751-
if (follow && !fast) {
760+
if (zoom_scale && !fast) {
752761
g.setFont("Vector", 31);
753762
g.setFontAlign(-1, -1);
754763
let msg = "\noff " + fmt.fmtDist(quiet.offtrack/1000);
@@ -826,13 +835,9 @@ function draw_map() {
826835
pp.y = 176/2;
827836
pp.g = zoom.buf;
828837
let d = 0;
829-
//load_next();
830-
zoom.geoNew(pp, 3000);
831-
{
832-
read(pp, track_name, 0);
833-
ui.drawMsg("Drawn\n" + fmt.fmtDist(d / 1000) + "\n" + point_num + "/" + num);
834-
step_init();
835-
}
838+
step_init();
839+
read(pp, track_name, 0);
840+
ui.drawMsg("Drawn\n" + fmt.fmtDist(d / 1000) + "\n" + point_num + "/" + num);
836841
}
837842

838843
/* Convert "normal" file to storagefile... so that we can read lines from it */

0 commit comments

Comments
 (0)