gipy: new menu to reverse path quickly

master
frederic wagner 2023-12-11 16:07:20 +01:00
parent ae784dc4f1
commit 8bfa4e32cc
2 changed files with 38 additions and 4 deletions

View File

@ -130,4 +130,5 @@
* Switching screen will clear the screen immediately so you can know your screen touch has been received
0.24:
* Fix for loading very large files (> 65kb)
* Fix for loading very large files (> 65kb)
* new menu on file selection : reverse path without waiting for file to load

View File

@ -1370,14 +1370,47 @@ function drawMenu() {
menu["Exit"] = function () {
load();
};
Bangle.setLCDBrightness(settings.brightness);
Bangle.setLocked(false);
E.showMenu(menu);
}
function ask_options(fn) {
g.clear();
let height = g.getHeight();
let width = g.getWidth();
g.drawRect(10, 10, width - 10, height / 2 - 10);
g.drawRect(10, height/2 + 10, width - 10, height - 10);
g.setFont("Vector:30").setFontAlign(0,0).drawString("Forward", width/2, height/4);
g.drawString("Backward", width/2, 3*height/4);
g.flip();
function options_select(b, xy) {
end = false;
if (xy.y < height / 2 - 10) {
g.setColor(0, 0, 0).fillRect(10, 10, width - 10, height / 2 - 10);
g.setColor(1, 1, 1).setFont("Vector:30").setFontAlign(0,0).drawString("Forward", width/2, height/4);
end = true;
} else if (xy.y > height/2 + 10) {
g.setColor(0, 0, 0).fillRect(10, height/2 + 10, width - 10, height - 10);
g.setColor(1, 1, 1).setFont("Vector:30").setFontAlign(0,0).drawString("Backward", width/2, 3*height/4);
go_backwards = true;
end = true;
}
if (end) {
g.flip();
Bangle.removeListener("touch", options_select);
console.log("loading", fn);
load_gps(fn);
}
}
Bangle.on("touch", options_select);
}
function start(fn) {
E.showMenu();
console.log("loading", fn);
load_gps(fn);
ask_options(fn);
}
function start_gipy(path, maps, interests, heights) {