Skip to content

Commit 61875f8

Browse files
authored
Merge pull request #70 from BobHanson/master
fix for slider delivering 3.9999999996
2 parents abf8b14 + 0813b75 commit 61875f8

File tree

7 files changed

+6
-5
lines changed

7 files changed

+6
-5
lines changed
43 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20180811224521
1+
20180812000515
43 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20180811224521
1+
20180812000515
43 Bytes
Binary file not shown.

sources/net.sf.j2s.java.core/src/swingjs/jquery/jquery-ui-j2sslider.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@
628628
if (val <= this._valueMin()) {
629629
return this._valueMin();
630630
}
631-
var max = (this._valueMax() - this._valueMin()) * (1-this.handleFraction) + this._valueMin();
631+
var max = Math.round((this._valueMax() - this._valueMin()) * (1-this.handleFraction) + this._valueMin());
632632
if (val >= max) {
633633
return max;
634634
}
@@ -646,7 +646,8 @@
646646
// floats, round
647647
// the final value to 5 digits after the decimal
648648
// point (see #4124)
649-
return parseFloat(alignValue.toFixed(5));
649+
650+
return Math.round(alignValue);// parseFloat(alignValue.toFixed(5));
650651
},
651652

652653
_valueMin : function() {

sources/net.sf.j2s.java.core/src/swingjs/plaf/JSSliderUI.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ public void jqueryCallback(Object event, Object ui) {
184184
*/
185185
{}
186186

187-
jSlider.setValue(val = (value));
187+
jSlider.setValue(val = Math.round(value));
188188
}
189189

190190
@Override

0 commit comments

Comments
 (0)