diff --git a/app/component/way/waymap/waymap.js b/app/component/way/waymap/waymap.js index 1e38d3a..92407a7 100644 --- a/app/component/way/waymap/waymap.js +++ b/app/component/way/waymap/waymap.js @@ -29,7 +29,7 @@ function WayMapController($log, $http, $interval, NgMap, wayService, $mdMedia, $ this.googlePaths = []; const drawWays = () => { - console.log('in draw ways'); + console.log('this in draw ways', this); NgMap.getMap().then( map => { this.startMarkers.forEach( marker => marker.setMap(null)); @@ -138,8 +138,8 @@ function WayMapController($log, $http, $interval, NgMap, wayService, $mdMedia, $ NgMap.getMap().then( map => { this.isMapInitialized = true; this.map = map; - drawWays(); + drawWays(); }); }; diff --git a/app/directive/radius-change/radius-change.js b/app/directive/radius-change/radius-change.js new file mode 100644 index 0000000..70183c9 --- /dev/null +++ b/app/directive/radius-change/radius-change.js @@ -0,0 +1,13 @@ +'use strict'; + +module.exports = function() { + return { + restrict: 'A', + link: function(scope, element, attrs) { + element.on('$md.dragend', function() { + console.info('Drag Ended'); + console.log('this is radius directive', this); + }); + } + }; +}; diff --git a/app/entry.js b/app/entry.js index a69ecef..7e7c0b5 100644 --- a/app/entry.js +++ b/app/entry.js @@ -58,9 +58,9 @@ context.keys().forEach( key => { ways2go.filter(name, module); }); -// context = require.context('./directive/', true, /\.js$/); -// context.keys().forEach( key => { -// let name = camelcase(path.basename(key, '.js')); -// let module = context(key); -// ways2go.directive(name, module); -// }); +context = require.context('./directive/', true, /\.js$/); +context.keys().forEach( key => { + let name = camelcase(path.basename(key, '.js')); + let module = context(key); + ways2go.directive(name, module); +}); diff --git a/app/view/way/way-controller.js b/app/view/way/way-controller.js index c992fce..57f4de3 100644 --- a/app/view/way/way-controller.js +++ b/app/view/way/way-controller.js @@ -26,7 +26,9 @@ function WayController($log, $rootScope, $mdDialog, wayService, $http, $interval const meterToMile = 0.000621371; this.distanceWays = this.ways .map( way => Object.assign(way, {distance: this.computeWayDistance(way) * meterToMile})) - .filter( way => way.distance < this.searchRadius); + .filter( way => way.distance <= this.searchRadius); + + $scope.$broadcast('wayChange'); }; this.computeWayDistance = (way) => { diff --git a/app/view/way/way.html b/app/view/way/way.html index 65ca964..560ece6 100644 --- a/app/view/way/way.html +++ b/app/view/way/way.html @@ -14,7 +14,11 @@