开发者

Non-uniform snap interval on flex slider?

开发者 https://www.devze.com 2022-12-29 08:46 出处:网络
I\'m currently using the Flex HSlider control. I\'d like the slider to only al开发者_如何学编程low the user to pick the values: [0, .5, 1, 2]

I'm currently using the Flex HSlider control. I'd like the slider to only al开发者_如何学编程low the user to pick the values: [0, .5, 1, 2]

I can get it close to what I want by setting the snapInterval to .5 and by explicitly providing the tickValues. But that still allows the value 1.5 to be selected. Is there a way to provide explicit snapValues or to only allow entries in tickValues to be selected? Or do I have to roll my own slider?

Thanks in advance,

-- Breck


You need to extend spark.components.HSlider. You would have to set the snapInterval to 0 and override nearestValidValue function. In your implementation you should "round" the value to one of your your snap values (i.e. 0.5,1,2)

Thanks,

--- Dmitry

0

精彩评论

暂无评论...
验证码 换一张
取 消