Update src/client/old.js
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
1df6f14f1a
commit
c307dd0a22
@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
import * as api from "./api";
|
import * as api from "./api";
|
||||||
import journey_wrapper from "./types/wrapper";
|
import journey_wrapper from "./types/wrapper";
|
||||||
import { migrator } from "./types/migration";
|
import { migrator } from "./types/migration";
|
||||||
@ -31,21 +32,21 @@ const app = new Vue({
|
|||||||
monthBeforeYear: true,
|
monthBeforeYear: true,
|
||||||
},
|
},
|
||||||
polyline: {
|
polyline: {
|
||||||
latlngs: [[47.334852, -1.509485], [47.342596, -1.328731], [47.241487, -1.190568], [47.234787, -1.358337]],
|
latlngs: [],
|
||||||
color: 'green'
|
color: 'green'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
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;
|
const map = this.$refs.map[0].mapObject;
|
||||||
var bounds = map.getBounds();
|
var bounds = map.getBounds();
|
||||||
var minLng = bounds.getSouthWest().lng;
|
var minLng = bounds.getSouthWest().lng;
|
||||||
var minLat = bounds.getSouthWest().lat;
|
var minLat = bounds.getSouthWest().lat;
|
||||||
var maxLng = bounds.getNorthEast().lng;
|
var maxLng = bounds.getNorthEast().lng;
|
||||||
var maxLat = bounds.getNorthEast().lat;
|
var maxLat = bounds.getNorthEast().lat;
|
||||||
return [[minLng,minLat],[maxLng,maxLat]]
|
return [[minLng, minLat], [maxLng, maxLat]]
|
||||||
},
|
},
|
||||||
|
|
||||||
search_nominatim: function (txt, f) {
|
search_nominatim: function (txt, f) {
|
||||||
@ -54,7 +55,7 @@ const app = new Vue({
|
|||||||
return Promise.resolve([]);
|
return Promise.resolve([]);
|
||||||
}
|
}
|
||||||
let bb = this.journey.leg_get();
|
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) => {
|
results.forEach((r) => {
|
||||||
r.latlon = [parseFloat(r.lat), parseFloat(r.lon)];
|
r.latlon = [parseFloat(r.lat), parseFloat(r.lon)];
|
||||||
r.sname = r.display_name.split(",")[0];
|
r.sname = r.display_name.split(",")[0];
|
||||||
@ -65,7 +66,7 @@ const app = new Vue({
|
|||||||
search_flight: function (txt) {
|
search_flight: function (txt) {
|
||||||
if (txt == "") return;
|
if (txt == "") return;
|
||||||
this.querying.flight = true;
|
this.querying.flight = true;
|
||||||
api.query_flight(txt.replace(" ", "")).then((results) => {
|
api.query_flight(txt).then((results) => {
|
||||||
if (results.results == "") {
|
if (results.results == "") {
|
||||||
this.query.flight = [];
|
this.query.flight = [];
|
||||||
this.querying.flight = false;
|
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.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.debounceSave = api.throttle(this.save_data, 500);
|
||||||
this.debounceSearch = {
|
this.debounceSearch = {
|
||||||
hotel: api.throttle((q) => {
|
hotel: api.throttle((q) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user