Fix to slider events

This commit is contained in:
Colin McLeod
2015-09-01 18:05:35 -07:00
parent aebfb62ac4
commit aac4c9a872

View File

@@ -51,6 +51,7 @@ angular.module('app').directive('slider', ['$window', function($window) {
function brushed() { function brushed() {
val = x.invert(d3.mouse(this)[0]); val = x.invert(d3.mouse(this)[0]);
brush.extent([val, val]); brush.extent([val, val]);
scope.change({ val: val });
drawBrush(); drawBrush();
} }
@@ -58,7 +59,6 @@ angular.module('app').directive('slider', ['$window', function($window) {
if (unit) { if (unit) {
lbl.text(fmt(val) + ' ' + unit + ' ' + pct(val / scope.max)); lbl.text(fmt(val) + ' ' + unit + ' ' + pct(val / scope.max));
} }
scope.change({ val: val });
handle.attr('cx', x(val)); handle.attr('cx', x(val));
filled.attr('d', 'M0,0V0H' + x(val) + 'V0'); filled.attr('d', 'M0,0V0H' + x(val) + 'V0');
} }
@@ -77,7 +77,7 @@ angular.module('app').directive('slider', ['$window', function($window) {
scope.$on('reset', function() { scope.$on('reset', function() {
val = def; val = def;
render(); drawBrush();
}); });
scope.$on('$destroy', function() { scope.$on('$destroy', function() {