dev #160

Merged
sora merged 97 commits from dev into master 2025-03-02 01:09:30 +01:00
Showing only changes of commit c307dd0a22 - Show all commits

View File

@ -1,3 +1,4 @@
import * as api from "./api";
import journey_wrapper from "./types/wrapper";
import { migrator } from "./types/migration";
@ -31,21 +32,21 @@ const app = new Vue({
monthBeforeYear: true,
},
polyline: {
latlngs: [[47.334852, -1.509485], [47.342596, -1.328731], [47.241487, -1.190568], [47.234787, -1.358337]],
latlngs: [],
color: 'green'
}
},
methods: {
start_journey: function(){ window.location.href = "/" + this.journey.id},
start_journey: function () { window.location.href = "/" + this.journey.id },
compute_bb: function(){
compute_bb: function () {
const map = this.$refs.map[0].mapObject;
var bounds = map.getBounds();
var minLng = bounds.getSouthWest().lng;
var minLat = bounds.getSouthWest().lat;
var maxLng = bounds.getNorthEast().lng;
var maxLat = bounds.getNorthEast().lat;
return [[minLng,minLat],[maxLng,maxLat]]
return [[minLng, minLat], [maxLng, maxLat]]
},
search_nominatim: function (txt, f) {
@ -54,7 +55,7 @@ const app = new Vue({
return Promise.resolve([]);
}
let bb = this.journey.leg_get();
return api.query_nominatim(txt,this.compute_bb(), f).catch((err) => []).then((results) => {
return api.query_nominatim(txt, this.compute_bb(), f).catch((err) => []).then((results) => {
results.forEach((r) => {
r.latlon = [parseFloat(r.lat), parseFloat(r.lon)];
r.sname = r.display_name.split(",")[0];
@ -65,7 +66,7 @@ const app = new Vue({
search_flight: function (txt) {
if (txt == "") return;
this.querying.flight = true;
api.query_flight(txt.replace(" ", "")).then((results) => {
api.query_flight(txt).then((results) => {
if (results.results == "") {
this.query.flight = [];
this.querying.flight = false;
@ -139,6 +140,14 @@ const app = new Vue({
api.load(this.journey.id).then((r) => (app.journey.data = migrator(r)));
api.query_flight("qf1").then(r => {
console.log(r)
this.polyline.latlngs = L.geodesic([
new L.LatLng(r[0].from_geo.lat, r[0].from_geo.lon),
new L.LatLng(r[0].to_geo.lat, r[0].to_geo.lon)], {})._latlngs
})
this.debounceSave = api.throttle(this.save_data, 500);
this.debounceSearch = {
hotel: api.throttle((q) => {