Skip to content

Commit

Permalink
Merge pull request #17 from mbostwick/master
Browse files Browse the repository at this point in the history
Fixes display update Issue when updating the watch value,  Closes Rad…
  • Loading branch information
RadMie committed May 13, 2016
2 parents 506bd35 + 4a2903b commit caf858b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion dist/ng-knob.js
Expand Up @@ -270,7 +270,7 @@
}
};
Knob.prototype.setValue = function(newValue) {
if (!this.inDrag && this.value >= this.options.min && this.value <= this.options.max) {
if (!this.inDrag && newValue >= this.options.min && newValue <= this.options.max) {
var radians = this.valueToRadians(newValue, this.options.max, this.options.endAngle, this.options.startAngle, this.options.min);
this.value = Math.round(~~((newValue < 0 ? -.5 : .5) + newValue / this.options.step) * this.options.step * 100) / 100;
if (this.options.step < 1) {
Expand Down Expand Up @@ -357,6 +357,7 @@
scope.$watch("value", function(newValue, oldValue) {
if ((newValue !== null || typeof newValue !== "undefined") && typeof oldValue !== "undefined" && newValue !== oldValue) {
knob.setValue(newValue);
drawKnob();
}
});
if (scope.options.dynamicOptions) {
Expand Down

0 comments on commit caf858b

Please sign in to comment.