From 4b7183c42841a80047b88cfbe9324e9af37bde85 Mon Sep 17 00:00:00 2001 From: portree_kid Date: Sun, 5 Jul 2020 21:39:29 +0200 Subject: [PATCH] Backwards line --- src/renderer/loaders/ParkingSpot.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/renderer/loaders/ParkingSpot.js b/src/renderer/loaders/ParkingSpot.js index a1a4455..1c2f141 100644 --- a/src/renderer/loaders/ParkingSpot.js +++ b/src/renderer/loaders/ParkingSpot.js @@ -23,21 +23,22 @@ var $ = require('jquery'); L.ParkingSpot = L.Circle.extend({ createDirection: function () { if (this.direction === undefined ) { - var start = this._latlng; + var center = this._latlng; var options = { units: 'kilometers' }; - var end = turf.destination([start.lng, start.lat], this.options.attributes.radius / 1000, this.options.attributes.heading, options); + var start = turf.destination([center.lng, center.lat], this.options.attributes.radius / 1000, this.normalizeAngle(this.options.attributes.heading+180), options); + var end = turf.destination([center.lng, center.lat], this.options.attributes.radius / 1000, this.normalizeAngle(this.options.attributes.heading), options); // Resize, since leaflet is wrong - var rad2 = start.distanceTo(this.turfToLatLng(end), options); - console.debug('Dist ', start, [start.lng, start.lat], end.geometry.coordinates, this.options.attributes.radius, rad2); + var rad2 = center.distanceTo(this.turfToLatLng(end), options); + console.debug('Dist ', center, [center.lng, center.lat], end.geometry.coordinates, this.options.attributes.radius, rad2); this.setRadius(rad2); // console.log(util.inspect(this.editor)); if(this.editor._resizeLatLng.__vertex !== undefined){ this.editor._resizeLatLng.__vertex.setLatLng(this.turfToLatLng(end)); } - this.direction = L.polyline([start, this.turfToLatLng(end)]); + this.direction = L.polyline([this.turfToLatLng(start), this.turfToLatLng(end)]); this.direction.addTo(this.editor.editLayer); - this.frontWheel = L.circleMarker(start, {radius:4, weight: 2 }); + this.frontWheel = L.circleMarker(center, {radius:4, weight: 2 }); this.frontWheel.addTo(this.editor.editLayer); this.updateWheelPos(); this.updateBox();