finishes trail printing

This commit is contained in:
Christian Beutel
2024-04-12 00:25:26 +02:00
parent 71d548b9d6
commit f9f8998617
20 changed files with 643 additions and 39 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -2,6 +2,7 @@
import type { Trail } from "$lib/models/trail";
import { currentUser } from "$lib/stores/user_store";
import { createMarkerFromWaypoint } from "$lib/util/leaflet_util";
import type AutoGraticule from "$lib/vendor/leaflet-graticule/leaflet-auto-graticule";
import type { Map, Marker } from "leaflet";
import { createEventDispatcher, onMount } from "svelte";
@@ -9,6 +10,7 @@
export let markers: Marker[] = [];
export let map: Map | null = null;
export let options = {};
export let graticule: AutoGraticule | null = null;
const dispatch = createEventDispatcher();
@@ -110,7 +112,8 @@
}
if(elevation_options.graticule) {
new AutoGraticule().addTo(map!);
graticule = new AutoGraticule();
graticule.addTo(map!);
}
});
@@ -120,6 +123,6 @@
<div id="map" class="rounded-xl z-0 basis-full"></div>
<div class="flex items-center justify-between">
<slot />
<div class="basis-full min-w-[300px]" id="elevation"></div>
<div class="basis-[300px] flex-grow flex-shrink-0" id="elevation"></div>
</div>
</div>

View File

@@ -40,6 +40,7 @@
},
]
: []),
{ text: $_("print"), value: "print", icon: "print" },
{ text: $_("add-to-list"), value: "list", icon: "bookmark" },
{ text: $_("edit"), value: "edit", icon: "pen" },
{ text: $_("delete"), value: "delete", icon: "trash" },
@@ -61,6 +62,8 @@
"_blank",
)
?.focus();
} else if (item.value == "print") {
goto(`/map/trail/${trail.id}/print`);
} else if (item.value == "download") {
downloadURI(getFileURL(trail, trail.gpx), trail.gpx!);
} else if (item.value == "edit") {

View File

@@ -52,6 +52,7 @@
"entry": "Eintrag",
"error-creating-user": "Fehler beim Erstellen des Nutzers",
"error-during-login": "Fehler beim Login",
"error-printing-map": "",
"error-reading-file": "Fehler beim Lesen der Datei",
"est-duration": "Gesch. Dauer",
"explore": "Erkunden",
@@ -59,6 +60,7 @@
"features": "Features",
"french": "Französisch",
"german": "Deutsch",
"grid": "",
"hero_section_0_text": "Entdecke spannende Routen, speichere deine Favoriten und erlebe die Schönheit der Natur. Finde dein nächstes Abenteuer!",
"hero_section_1_heading": "Hier gibt es noch keine Routen",
"hero_section_1_text": "Hier sind einige Routen, die dir gefallen könnten. Oder du wirfst einen Blick auf die vollständige Liste.",
@@ -67,6 +69,7 @@
"hungarian": "Ungarisch",
"icon": "Icon",
"imperial": "Amerikanisch",
"include-description": "",
"invalid-date": "Ungültiges Datum",
"invalid-username": "Ungültiger Nutzername",
"language": "Sprache",
@@ -99,6 +102,8 @@
"not-a-valid-email-address": "Keine gültige Email-Adresse",
"not-completed": "Nicht abgeschlossen",
"or": "oder",
"orientation": "",
"paper-size": "",
"password": "Passwort",
"photos": "Fotos",
"pick-a-trail": "Route auswählen",

View File

@@ -52,6 +52,7 @@
"entry": "Entry",
"error-creating-user": "Error creating user",
"error-during-login": "Error during login",
"error-printing-map": "Error printing map",
"error-reading-file": "Error reading file",
"est-duration": "Est. duration",
"explore": "Explore",
@@ -59,6 +60,7 @@
"features": "Features",
"french": "French",
"german": "German",
"grid": "Grid",
"hero_section_0_text": "Explore exciting trails, save your favorites, and experience the beauty of nature. Find your next adventure!",
"hero_section_1_heading": "It seems there are no trails here yet.",
"hero_section_1_text": "Here are some trails you might like. Or you can just go to the full list right now.",
@@ -67,6 +69,7 @@
"hungarian": "Hungarian",
"icon": "Icon",
"imperial": "Imperial",
"include-description": "Include description",
"invalid-date": "Invalid Date",
"invalid-username": "Invalid username",
"language": "Language",
@@ -99,6 +102,8 @@
"not-a-valid-email-address": "Not a valid email address",
"not-completed": "Not completed",
"or": "or",
"orientation": "Orientation",
"paper-size": "Paper size",
"password": "Password",
"photos": "Photos",
"pick-a-trail": "Pick a trail",

View File

@@ -52,6 +52,7 @@
"entry": "Entrée",
"error-creating-user": "Erreur durant la création de l'utilisateur",
"error-during-login": "Erreur durant la connexion",
"error-printing-map": "",
"error-reading-file": "Erreur de lecture du fichier",
"est-duration": "Temps estimé",
"explore": "Explorer",
@@ -59,6 +60,7 @@
"features": "Fonctionnalités",
"french": "Français",
"german": "Allemand",
"grid": "",
"hero_section_0_text": "Explorez des itinéraires passionnants, sauvegardez vos favoris et découvrez la beauté de la nature. Trouvez votre prochaine aventure !",
"hero_section_1_heading": "Il semble qu'il n'y ait pas encore d'itinéraire ici.",
"hero_section_1_text": "Voici quelques itinéraires qui pourraient vous plaire. Vous pouvez également consulter la liste complète dès maintenant.",
@@ -67,6 +69,7 @@
"hungarian": "Hongrois",
"icon": "Icône",
"imperial": "Impérial",
"include-description": "",
"invalid-date": "Date invalide",
"invalid-username": "Nom d'utilisateur invalide",
"language": "Langue",
@@ -99,6 +102,8 @@
"not-a-valid-email-address": "Adresse email invalide",
"not-completed": "Pas terminé",
"or": "ou",
"orientation": "",
"paper-size": "",
"password": "Mot de passe",
"photos": "Photos",
"pick-a-trail": "Choisir un itinéraire",

View File

@@ -52,6 +52,7 @@
"entry": "Bejegyzés",
"error-creating-user": "Hiba felhasználó hozzáadása közben",
"error-during-login": "Hiba bejelentkezés közben",
"error-printing-map": "",
"error-reading-file": "Hiba a fájl olvasása közben",
"est-duration": "Becsült időtartam",
"explore": "Felfedezés",
@@ -59,6 +60,7 @@
"features": "Jellemzők",
"french": "Francia",
"german": "Német",
"grid": "",
"hero_section_0_text": "Fedezze fel az izgalmas útvonalakat, mentse el kedvenceit, és tapasztalja meg a természet szépségét. Találja meg a következő kalandját!",
"hero_section_1_heading": "Úgy tűnik, itt még nincsenek ösvények.",
"hero_section_1_text": "Íme néhány nyomvonal, amely tetszeni fog. Vagy csak menj a teljes listára most rögtön.",
@@ -67,6 +69,7 @@
"hungarian": "Magyar",
"icon": "Ikon",
"imperial": "Angolszász",
"include-description": "",
"invalid-date": "Érvénytelen dátum",
"invalid-username": "Érvénytelen felhasználó",
"language": "Nyelf",
@@ -99,6 +102,8 @@
"not-a-valid-email-address": "Érvénytelen e-mail cím",
"not-completed": "Nem teljesített",
"or": "vagy",
"orientation": "",
"paper-size": "",
"password": "Jelszó",
"photos": "Képek",
"pick-a-trail": "Válasszon útvonalat",

View File

@@ -52,6 +52,7 @@
"entry": "Item",
"error-creating-user": "Het account kan niet worden aangemaakt",
"error-during-login": "Het inloggen is mislukt",
"error-printing-map": "",
"error-reading-file": "Het bestand kan niet worden ingelezen",
"est-duration": "Geschatte duur",
"explore": "Verkennen",
@@ -59,6 +60,7 @@
"features": "Kenmerken",
"french": "Frans",
"german": "Duits",
"grid": "",
"hero_section_0_text": "Verken uitdagende wandelroutes, bewaar je favoriete en ervaar de pracht van de natuur. Op naar het volgende avontuur!",
"hero_section_1_heading": "Je hebt nog geen wandelroutes.",
"hero_section_1_text": "Wellicht vind je deze routes interessant. Ook kun je de volledige lijst bekijken.",
@@ -67,6 +69,7 @@
"hungarian": "Hongaars",
"icon": "Pictogram",
"imperial": "Imperiaal",
"include-description": "",
"invalid-date": "Ongeldige datum",
"invalid-username": "Ongeldige gebruikersnaam",
"language": "Taal",
@@ -99,6 +102,8 @@
"not-a-valid-email-address": "Het e-mailadres is ongeldig",
"not-completed": "Niet voltooid",
"or": "of",
"orientation": "",
"paper-size": "",
"password": "Wachtwoord",
"photos": "Foto's",
"pick-a-trail": "Kies een wandelroute",

View File

@@ -52,6 +52,7 @@
"entry": "Pozycja",
"error-creating-user": "Błąd tworzenia użytkownika",
"error-during-login": "Błąd podczas logowania",
"error-printing-map": "",
"error-reading-file": "Błąd wczytywania pliku",
"est-duration": "Szacowany czas",
"explore": "Eksploruj",
@@ -59,6 +60,7 @@
"features": "Funkcje",
"french": "Francuski",
"german": "Niemiecki",
"grid": "",
"hero_section_0_text": "Eksploruj ekscytujące szlaki, zapisz swoje ulubione, doświadcz piękna naturalnego świata. Znajdź swoją następną przygodę!",
"hero_section_1_heading": "Wygląda na to że nie ma tutaj ścieżek.",
"hero_section_1_text": "Oto kila ścieżek które możesz zobaczyć lub możesz przejść do pełnej listy.",
@@ -67,6 +69,7 @@
"hungarian": "Język węgierski",
"icon": "Ikona",
"imperial": "Anglosaskie",
"include-description": "",
"invalid-date": "Nieprawidłowa data",
"invalid-username": "Błędna nazwa użytkownika",
"language": "Język",
@@ -99,6 +102,8 @@
"not-a-valid-email-address": "Nieprawidłowy adres email",
"not-completed": "Nie dokończono",
"or": "lub",
"orientation": "",
"paper-size": "",
"password": "Hasło",
"photos": "Zdjęcia",
"pick-a-trail": "Wybierz ścieżkę",

View File

@@ -52,6 +52,7 @@
"entry": "Entrada",
"error-creating-user": "Erro ao criar usuário",
"error-during-login": "Erro durante o login",
"error-printing-map": "",
"error-reading-file": "Erro ao ler o arquivo",
"est-duration": "Duração prevista",
"explore": "Explorar",
@@ -59,6 +60,7 @@
"features": "Características",
"french": "Francês",
"german": "Alemão",
"grid": "",
"hero_section_0_text": "Explore trilhas emocionantes, salve seus favoritos e experimente a beleza da natureza. Encontre sua próxima aventura!",
"hero_section_1_heading": "Parece que ainda não há trilhas aqui.",
"hero_section_1_text": "Aqui estão algumas trilhas que você pode gostar. Ou podes ir à lista completa agora.",
@@ -67,6 +69,7 @@
"hungarian": "Húngaro",
"icon": "Ícone",
"imperial": "Imperial",
"include-description": "",
"invalid-date": "Data inválida",
"invalid-username": "Nome de usuário inválido",
"language": "Língua",
@@ -99,6 +102,8 @@
"not-a-valid-email-address": "Não um endereço de e-mail válido",
"not-completed": "Não preenchido",
"or": "ou",
"orientation": "",
"paper-size": "",
"password": "Senha",
"photos": "Fotos",
"pick-a-trail": "Escolha uma trilha",

View File

@@ -52,6 +52,7 @@
"entry": "日程",
"error-creating-user": "创建用户错误",
"error-during-login": "登录错误",
"error-printing-map": "",
"error-reading-file": "读取文件错误",
"est-duration": "预计时长",
"explore": "探索",
@@ -59,6 +60,7 @@
"features": "特性",
"french": "法语",
"german": "德语",
"grid": "",
"hero_section_0_text": "探索激动人心的探险,收藏最爱行程,,体验美丽地大自然。找到你的下一次冒险!",
"hero_section_1_heading": "这儿似乎还没有行程。",
"hero_section_1_text": "以下有你可能喜欢的线路,或者立刻浏览全部列表。",
@@ -67,6 +69,7 @@
"hungarian": "匈牙利语",
"icon": "图标",
"imperial": "英制",
"include-description": "",
"invalid-date": "无效日期",
"invalid-username": "无效用户名",
"language": "语言",
@@ -99,6 +102,8 @@
"not-a-valid-email-address": "无效电子邮箱地址",
"not-completed": "未完成",
"or": "或",
"orientation": "",
"paper-size": "",
"password": "密码",
"photos": "图片",
"pick-a-trail": "选择一个路线",

View File

@@ -4,6 +4,7 @@ export function createRect(
width: number,
height: number,
fill: string,
border?: string,
) {
const svgns = "http://www.w3.org/2000/svg";
@@ -12,7 +13,7 @@ export function createRect(
rect.setAttribute("y", y.toString());
rect.setAttribute("width", width.toString());
rect.setAttribute("height", height.toString());
rect.setAttribute("fill", fill);
rect.setAttribute("style", `fill:${fill};stroke-width:1;stroke:${border ?? ''}`);
return rect;
}

View File

@@ -327,7 +327,7 @@
--ele-stroke: #7b7b7b;
--ele-circle: #fff;
--ele-line: #000;
--ele-grid: rgba(var(--input-border));
--ele-grid: #d1d5db;
}
.elevation-detached.lightblue-theme .area {

View File

@@ -215,7 +215,7 @@ export default function leafletImage(map, callback) {
im.onload = function () {
if (marker._icon.classList.contains("leaflet-grid-label")) {
const label = marker._icon.children[0].textContent;
ctx.font = '600 8px "Font Awesome 6 Free"';
ctx.font = '600 10px "IBMPlexSans"';
ctx.fillStyle = "#000";
ctx.fillText(label, x + 4, y + 12);
} else {
@@ -224,14 +224,16 @@ export default function leafletImage(map, callback) {
ctx.drawImage(this, x, y, size[0], size[1]);
ctx.font = '600 14px "Font Awesome 6 Free"';
ctx.fillStyle = "#ffffff";
ctx.fillText(icon, x + 10.2, y + 24);
const iconWidth = ctx.measureText(icon).width
ctx.fillText(icon, x + size[0] / 2 - iconWidth / 2, y + 24);
if (waypointName) {
ctx.fillStyle = "#313131"
ctx.roundRect(x - 8, y - 18, waypointName.length * 7, 20, 5)
ctx.fill();
ctx.fillStyle = "rgba(49, 49, 49, 0.5)"
ctx.font = '600 12px "IBMPlexSans"';
const textWidth = ctx.measureText(waypointName).width
ctx.roundRect(size[0] / 2 + x - (textWidth + 16) / 2, y - 18, textWidth + 16, 20, 5)
ctx.fill();
ctx.fillStyle = "#ffffff";
ctx.fillText(waypointName, x, y - 4);
ctx.fillText(waypointName, size[0] / 2 + x - (textWidth + 16) / 2 + 8, y - 4);
}
}