Skip to content

Commit

Permalink
Increase number resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
fernandojsg committed Apr 7, 2017
1 parent d3e0a32 commit b066edb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/components/widgets/NumberWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default class NumberWidget extends React.Component {
min: -Infinity,
max: Infinity,
value: 0,
precision: 2,
precision: 3,
step: 1
};

Expand Down Expand Up @@ -45,10 +45,10 @@ export default class NumberWidget extends React.Component {
this.distance += delta;

// Add minimum tolerance to reduce unintentional drags when clicking on input.
if (Math.abs(delta) <= 2) { return; }
//if (Math.abs(delta) <= 2) { return; }

let value = this.onMouseDownValue + (this.distance / (event.shiftKey ? 5 : 50)) *
this.props.step;
this.props.step / 2;
value = Math.min(this.props.max, Math.max(this.props.min, value));
if (currentValue !== value) { this.setValue(value); }
this.prevPointer = [event.clientX, event.clientY];
Expand Down
2 changes: 1 addition & 1 deletion src/lib/utils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function getNumber (value) {
return parseFloat(value.toFixed(2));
return parseFloat(value.toFixed(3));
}

function getMajorVersion (version) {
Expand Down

0 comments on commit b066edb

Please sign in to comment.