@@ -14,7 +14,8 @@ function SliderControlCreate(
14
14
name : string ,
15
15
value : string ,
16
16
lo : string ,
17
- hi : string
17
+ hi : string ,
18
+ is_int : boolean
18
19
) : HTMLElement {
19
20
const el = document . createElement ( "control" )
20
21
@@ -27,7 +28,7 @@ function SliderControlCreate(
27
28
inputEl . setAttribute ( "type" , "range" )
28
29
inputEl . setAttribute ( "min" , lo )
29
30
inputEl . setAttribute ( "max" , hi )
30
- const step = 0.001
31
+ const step = is_int ? 1.0 : 0.001
31
32
inputEl . setAttribute ( "step" , step + "" )
32
33
inputEl . setAttribute ( "value" , value )
33
34
// TODO: compute this based on slider width
@@ -71,7 +72,7 @@ export class UIState{
71
72
floatSlider ( name : string , prevValue : number , lo : number , hi : number ) : number {
72
73
const control = this . control ( "float" , name )
73
74
if ( ! control . el ) {
74
- control . el = SliderControlCreate ( name , prevValue + "" , lo + "" , hi + "" )
75
+ control . el = SliderControlCreate ( name , prevValue + "" , lo + "" , hi + "" , false )
75
76
this . controlsEl . append ( control . el )
76
77
}
77
78
@@ -87,7 +88,7 @@ export class UIState{
87
88
intSlider ( name : string , prevValue : number , lo : number , hi : number ) : number {
88
89
const control = this . control ( "float" , name )
89
90
if ( ! control . el ) {
90
- control . el = SliderControlCreate ( name , prevValue + "" , lo + "" , hi + "" )
91
+ control . el = SliderControlCreate ( name , prevValue + "" , lo + "" , hi + "" , true )
91
92
this . controlsEl . append ( control . el )
92
93
}
93
94
0 commit comments