Skip to content

Sliders: replace Into<f64> with AsPrimitive<f64>#3260

Open
tritoke wants to merge 2 commits intoiced-rs:masterfrom
tritoke:tritoke/slider-as-primitive
Open

Sliders: replace Into<f64> with AsPrimitive<f64>#3260
tritoke wants to merge 2 commits intoiced-rs:masterfrom
tritoke:tritoke/slider-as-primitive

Conversation

@tritoke
Copy link

@tritoke tritoke commented Feb 22, 2026

This change is intended to allow the Slider and VerticalSlider structs to work with larger integer types such as u64 and usize.

I had a use case for this on a personal project and @edwloef suggested the change on the discord so I've put up this PR for it.

tritoke and others added 2 commits March 11, 2026 19:20
This change is intended to allow the Slider and VerticalSlider structs
to work with larger integer types such as u64 and usize.
@hecrj hecrj force-pushed the tritoke/slider-as-primitive branch from 4fe0960 to b1eeaed Compare March 11, 2026 18:20
@hecrj hecrj added this to the 0.15 milestone Mar 11, 2026
@hecrj hecrj added improvement An internal improvement widget change labels Mar 11, 2026
Copy link
Member

@hecrj hecrj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@hecrj hecrj enabled auto-merge March 11, 2026 18:21
@hecrj
Copy link
Member

hecrj commented Mar 11, 2026

Although on second thought, I'm not sure we want to pretend that slider can work with all ranges of u64 and usize.

@tritoke
Copy link
Author

tritoke commented Mar 11, 2026

Although on second thought, I'm not sure we want to pretend that slider can work with all ranges of u64 and usize.

Yeah this was a thought I had as well, I think it might be worth mentioning in the docs that it uses conversions to/from f64 internally so it can represent up to 52(iirc) bits losslessly and the rest is imprecise? From what I can tell if you have multiple ways to control the same value the slider will not overwrite it's value if you have another way to change it. In my case I have a +/- 1 button and. a text entry box which is based on the true value.

I'm not around tonight but I'm happy to add this to the relevant docs if you think it's a good idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change improvement An internal improvement widget

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants