diff --git a/src/constants/app_info.ts b/src/constants/app_info.ts index 647d2d0..e39478c 100644 --- a/src/constants/app_info.ts +++ b/src/constants/app_info.ts @@ -13,6 +13,8 @@ export const APP_INFO = { 'Приложение для vk', // [11.12.18] 'Фильтр в диалоге поиска карт', // [13.12.18] 'Экспорт GPX', // [18.02.19] + 'Улучшенный редактор ломанных', // [23.02.19] + 'Отметки расстояний и стрелки', // [04.03.19] ], [ 'Первый коммит', // [15.08.18] diff --git a/src/index.tsx b/src/index.tsx index 07ec1a0..e554cef 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -2,12 +2,10 @@ ## BUGS - todo fix arrows (can't reproduce now :-( ) - done adding route, applying it and adding again and deleting it makes ghost points on the map - + todo moving out the screen makes stickers editable again ## FEATURES - todo make arrows and distance points + done make arrows and distance points todo selecting logo on crop done public maps @@ -20,10 +18,12 @@ todo check canvas support at startup todo check osrm is up - todo maybe: map preview on save + todo maybe: map preview on save (nope) done maybe: stickers clusterization? ## DONE + done fix arrows (can't reproduce now :-( ) + done adding route, applying it and adding again and deleting it makes ghost points on the map done adding/removing points doesn't change distance done cancelling editing someone's else map return back to it's original address /razminochnyj/ diff --git a/src/modules/InteractivePoly.ts b/src/modules/InteractivePoly.ts index cb2f819..2ee587f 100644 --- a/src/modules/InteractivePoly.ts +++ b/src/modules/InteractivePoly.ts @@ -405,6 +405,7 @@ export class Component extends Polyline { this.setLatLngs(latlngs); this.fire('latlngschange', { latlngs }); + this.showVisibleMarkers(); this.startDrawing(); }; diff --git a/src/modules/KmMarks.ts b/src/modules/KmMarks.ts index 5e52c87..b39958d 100644 --- a/src/modules/KmMarks.ts +++ b/src/modules/KmMarks.ts @@ -1,7 +1,8 @@ -import { divIcon, LatLngLiteral, LayerGroup, Map, marker, Marker } from "leaflet"; +import { divIcon, LatLngLiteral, Layer, LayerGroup, Map, marker, Marker } from "leaflet"; import { arrowClusterIcon, createArrow } from "$utils/arrow"; import { MarkerClusterGroup } from 'leaflet.markercluster/dist/leaflet.markercluster-src.js'; import { allwaysPositiveAngleDeg, angleBetweenPoints, distKm } from "$utils/geom"; +import classNames from 'classnames'; interface KmMarksOptions { showMiddleMarkers: boolean, @@ -24,8 +25,11 @@ class Component extends LayerGroup { setLatLngs = (latlngs: LatLngLiteral[]): void => { if (!this.map) return; this.marksLayer.clearLayers(); + this.endMarker.clearLayers(); - if (latlngs.length === 0) return; + this.distance = 0; + + if (latlngs.length <= 1) return; if (this.options.showMiddleMarkers) this.drawMiddleMarkers(latlngs); if (this.options.showEndMarker) this.drawEndMarker(latlngs); @@ -35,8 +39,8 @@ class Component extends LayerGroup { const kmMarks = {}; let last_km_mark = 0; - latlngs.reduce((dist, current, index) => { - if (index >= latlngs.length - 1) return; + this.distance = latlngs.reduce((dist, current, index) => { + if (index >= latlngs.length - 1) return dist; const next = latlngs[index + 1]; const diff = distKm(current, next); @@ -86,8 +90,35 @@ class Component extends LayerGroup { }) }); - drawEndMarker = (latlngs: LatLngLiteral[]): void => { + createEndMarker = (latlng: LatLngLiteral, angle: number, distance: number): Marker => marker(latlng, { + draggable: false, + interactive: true, + icon: divIcon({ + html: ` +