Skip to content

Commit

Permalink
Fix bug triggered by calling slider.update()
Browse files Browse the repository at this point in the history
Would render slider unresponsive
  • Loading branch information
johnwalley committed Oct 16, 2018
1 parent e35097e commit fcc9f3f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "d3-simple-slider",
"version": "1.0.1",
"version": "1.0.2",
"description": "Renders an SVG slider",
"keywords": [
"d3",
Expand Down
19 changes: 9 additions & 10 deletions src/slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,8 @@ function slider() {
updateValue(newValue, true);
}

textSelection = selection.select(".parameter-value text");
handleSelection = selection.select('.parameter-value');

textSelection = selection.select('.parameter-value text');
handleSelection = selection.select('.parameter-value');
}

function fadeTickText() {
Expand Down Expand Up @@ -250,19 +249,19 @@ function slider() {
}
}


function updateHandle(newValue, animate) {
animate = typeof animate !== 'undefined' ? animate : false;

if (animate) {
handleSelection = handleSelection
handleSelection
.transition()
.ease(easeQuadOut)
.duration(UPDATE_DURATION);
.duration(UPDATE_DURATION)
.attr('transform', 'translate(' + scale(newValue) + ',0)');
} else {
handleSelection.attr('transform', 'translate(' + scale(newValue) + ',0)');
}

handleSelection.attr('transform', 'translate(' + scale(newValue) + ',0)');

if (displayValue) {
textSelection.text(displayFormat(newValue));
}
Expand Down Expand Up @@ -302,7 +301,7 @@ function slider() {
if (!arguments.length) return displayFormat;
displayFormat = _;
return slider;
};
};

slider.ticks = function(_) {
if (!arguments.length) return ticks;
Expand Down Expand Up @@ -330,7 +329,7 @@ function slider() {
updateValue(newValue, false);

return slider;
};
};

slider.default = function(_) {
if (!arguments.length) return defaultValue;
Expand Down

0 comments on commit fcc9f3f

Please sign in to comment.