diff --git a/frontend/app/map/markers/markers.js b/frontend/app/map/markers/markers.js index 9380c418..78f52f27 100644 --- a/frontend/app/map/markers/markers.js +++ b/frontend/app/map/markers/markers.js @@ -62,8 +62,8 @@ fm.app.factory("fmMapMarkers", function($uibModal, fmUtils, $compile, $timeout, showMarkerInfoBox: function(marker) { var scope = $rootScope.$new(); + scope.map = map; scope.client = map.client; - scope.marker = marker; scope.edit = function() { @@ -78,6 +78,10 @@ fm.app.factory("fmMapMarkers", function($uibModal, fmUtils, $compile, $timeout, markersUi.deleteMarker(scope.marker); }; + scope.useForRoute = function(mode) { + map.searchUi.setRouteDestination(`${marker.lat},${marker.lon}`, mode); + }; + openMarker = { hide: map.infoBox.show(require("./view-marker.html"), scope, () => { openMarker = null; diff --git a/frontend/app/map/markers/view-marker.html b/frontend/app/map/markers/view-marker.html index facd6483..11933944 100644 --- a/frontend/app/map/markers/view-marker.html +++ b/frontend/app/map/markers/view-marker.html @@ -15,4 +15,12 @@ +
+ + +
\ No newline at end of file diff --git a/frontend/app/search/search-query.js b/frontend/app/search/search-query.js index f942619f..b6c877e8 100644 --- a/frontend/app/search/search-query.js +++ b/frontend/app/search/search-query.js @@ -329,17 +329,7 @@ fm.app.factory("fmSearchQuery", function($rootScope, $compile, fmUtils, $timeout }; popupScope.useForRoute = function(mode) { - searchUi.hide(); - routeUi.show(); - - if(mode == 1) - routeUi.setFrom(query, results, result); - else if(mode == 2) - routeUi.addVia(query, results, result); - else if(mode == 3) - routeUi.setTo(query, results, result); - - routeUi.submit(!!routeUi.getQueries()); + searchUi.setRouteDestination(query, mode, results, result); }; currentInfoBox = map.infoBox.show(require("./result-popup.html"), popupScope, () => { @@ -391,6 +381,20 @@ fm.app.factory("fmSearchQuery", function($rootScope, $compile, fmUtils, $timeout routeUi.submit(noZoom); }, + setRouteDestination: function(query, mode, _results, _result) { + map.searchUi.hide(); + routeUi.show(); + + if(mode == 1) + routeUi.setFrom(query, _results, _result); + else if(mode == 2) + routeUi.addVia(query, _results, _result); + else if(mode == 3) + routeUi.setTo(query, _results, _result); + + routeUi.submit(!!routeUi.getQueries()); + }, + getCurrentSearchForHash: function() { if(searchUi._el.is(":visible")) { if(((scope.searchResults && scope.searchResults.features.length == 1) || !scope.showAll) && scope.activeResult && scope.activeResult.id)