File tree Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -239,16 +239,7 @@ $.widget( "ui.spinner", {
239
239
this . counter = 1 ;
240
240
}
241
241
242
- // TODO refactor, maybe figure out some non-linear math
243
- // x*x*x/50000 - x*x/500 + 17*x/200 + 1
244
- var newVal = this . value ( ) + step * ( this . options . incremental &&
245
- this . counter > 20
246
- ? this . counter > 100
247
- ? this . counter > 200
248
- ? 100
249
- : 10
250
- : 2
251
- : 1 ) ;
242
+ var newVal = this . value ( ) + step * this . _increment ( this . counter ) ;
252
243
253
244
// clamp the new value
254
245
newVal = this . _trimValue ( newVal ) ;
@@ -259,6 +250,12 @@ $.widget( "ui.spinner", {
259
250
}
260
251
} ,
261
252
253
+ _increment : function ( i ) {
254
+ return this . options . incremental ?
255
+ Math . floor ( i * i * i / 50000 - i * i / 500 + 17 * i / 200 + 1 ) :
256
+ 1 ;
257
+ } ,
258
+
262
259
_trimValue : function ( value ) {
263
260
var options = this . options ;
264
261
You can’t perform that action at this time.
0 commit comments