Skip to content

Commit

Permalink
filter slider works for way-detail but uses previous state when filte…
Browse files Browse the repository at this point in the history
…ring the waymap
  • Loading branch information
remilonwheels committed May 1, 2017
1 parent 4fc3bc1 commit d9d79ff
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 9 deletions.
4 changes: 2 additions & 2 deletions app/component/way/waymap/waymap.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -138,8 +138,8 @@ function WayMapController($log, $http, $interval, NgMap, wayService, $mdMedia, $
NgMap.getMap().then( map => {
this.isMapInitialized = true;
this.map = map;
drawWays();

drawWays();
});
};

Expand Down
13 changes: 13 additions & 0 deletions app/directive/radius-change/radius-change.js
Original file line number Diff line number Diff line change
@@ -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);
});
}
};
};
12 changes: 6 additions & 6 deletions app/entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
4 changes: 3 additions & 1 deletion app/view/way/way-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
4 changes: 4 additions & 0 deletions app/view/way/way.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@
</md-input-container>

<div class="map-action">
<md-slider flex md-discrete ng-model="wayCtrl.searchRadius" step="5" min="0" max="50" aria-label="search-radius" ng-change="wayCtrl.createDistanceWays()">
</md-slider>

<md-button ng-click="wayCtrl.createWay($event, true)" class="md-raised md-warn md-hue-2">Create Way</md-button>

<md-button ng-click="wayCtrl.toggleView()" class="md-raised md-warn md-hue-2">Toggle View</md-button>
</div>

Expand Down

0 comments on commit d9d79ff

Please sign in to comment.