diff --git a/package.json b/package.json index 4644b6d..2d10611 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,6 @@ "es6-promise": "^4.1.1", "joi": "^14.0.1", "leaflet": "^1.0.3", - "leaflet-polylinedecorator": "^1.3.2", "normalizr": "^3.2.3", "object-hash": "^1.3.0", "react": "^16.6.3", diff --git a/src/js/map/map.js b/src/js/map/map.js deleted file mode 100644 index 04c21a5..0000000 --- a/src/js/map/map.js +++ /dev/null @@ -1,82 +0,0 @@ -import { isNotNullNorUndefined } from '../utilities'; -import hash from 'object-hash'; -import 'leaflet-polylinedecorator'; - -export default function(lMap, svg, newApp, ui) { - - const app = { - selected: [], - highlighted: null, - } - - // Icons for markPoint flags (a yellow ring around a location) - const eventCircleMarkers = {}; - - /** - * Removes the circular ring to mark a particular location - */ - function unmarkPoint() { - Object.keys(eventCircleMarkers).forEach(markerId => { - lMap.removeLayer(eventCircleMarkers[markerId]); - delete eventCircleMarkers[markerId]; - }); - } - - /** - * Makes a circular ring mark in one particular location at a time - * @param {object} location object, with lat and long - */ - function renderSelected() { - unmarkPoint(); - app.selected.forEach(eventPoint => { - if (isNotNullNorUndefined(eventPoint) && isNotNullNorUndefined(eventPoint.location)) { - if (eventPoint.latitude && eventPoint.latitude !== "" && eventPoint.longitude && eventPoint.longitude !== "") { - const location = new L.LatLng(eventPoint.latitude, eventPoint.longitude); - eventCircleMarkers[eventPoint.id] = L.circleMarker(location, { - radius: 32, - fill: false, - color: '#ffffff', - weight: 3, - lineCap: '', - dashArray: '5,2' - }); - eventCircleMarkers[eventPoint.id].addTo(lMap); - } - } - }) - } - - function renderHighlighted() { - // Fly to first of events selected - const eventPoint = (app.selected.length > 0) ? app.selected[0] : null; - if (isNotNullNorUndefined(eventPoint) && isNotNullNorUndefined(eventPoint.location)) { - if (eventPoint.latitude && eventPoint.longitude) { - const location = new L.LatLng(eventPoint.latitude, eventPoint.longitude); - lMap.flyTo(location); - } - } - } - - /** - * Updates displayable data on the map: events, coevents and paths - */ - function update(newApp) { - if (hash(app) !== hash(newApp)) { - app.selected = newApp.selected; - app.highlighted = newApp.highlighted; - renderSelectedAndHighlight(); - } - } - - function renderSelectedAndHighlight () { - renderSelected(); - renderHighlighted(); - } - - /** - * Expose only relevant functions - */ - return { - update - }; -} diff --git a/yarn.lock b/yarn.lock index 590bf00..0f75a41 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3940,16 +3940,6 @@ lcid@^2.0.0: dependencies: invert-kv "^2.0.0" -leaflet-polylinedecorator@^1.3.2: - version "1.6.0" - resolved "https://registry.yarnpkg.com/leaflet-polylinedecorator/-/leaflet-polylinedecorator-1.6.0.tgz#9ef79fd1b5302d67b72efe959a8ecd2553f27266" - dependencies: - leaflet-rotatedmarker "^0.2.0" - -leaflet-rotatedmarker@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/leaflet-rotatedmarker/-/leaflet-rotatedmarker-0.2.0.tgz#4467f49f98d1bfd56959bd9c6705203dd2601277" - leaflet@^1.0.3: version "1.3.4" resolved "https://registry.yarnpkg.com/leaflet/-/leaflet-1.3.4.tgz#7f006ea5832603b53d7269ef5c595fd773060a40"