Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

dbr
Copy link
Contributor

@dbr dbr commented Nov 16, 2021

I've updated the slider example to use the limited range, however the pointlessly-giant range slider doesn't seem to work correctly:

sliderbug

Not too sure what this might be caused by - any idea @sanbox-irl ?

It might be an upstream ~problem, as the "Dear ImGui Demo" Widgets > Data types > Sliders section doesn't include a "slider float full" example (only a "high" which goes from 1e-10 to 1e10). If so we should probably just remove this full-range-f32 from teh example as it's a bit academic

Full range of slider is half the ::MIN/MAX for f32/f64
@dbr dbr requested a review from sanbox-irl November 16, 2021 02:08
@dbr
Copy link
Contributor Author

dbr commented Nov 19, 2021

I've tested the -FLT_MAX/2.0 .. FLT_MAX/2.0 ranged slider in Dear ImGui itself and it works fine, so something is amiss here

@dbr
Copy link
Contributor Author

dbr commented Nov 20, 2021

I've tested the -FLT_MAX/2.0 .. FLT_MAX/2.0 ranged slider in Dear ImGui itself and it works fine, so something is amiss here

Interestingly recreating the same basic example in imgui-rs also works completely fine:

use imgui::*;

mod support;

fn main() {
    let mut value: f32 = 0.0;
    let system = support::init(file!());
    system.main_loop(move |run, ui| {
        Slider::new("f32 value with range", -f32::MAX/2.0, f32::MAX/2.0)
            .build(ui, &mut value);
    });
}

Something about how the slider.rs example specifically is going wrong

@dbr
Copy link
Contributor Author

dbr commented Nov 20, 2021

🤦

I wrote -f32::MIN/2.0 which is "quite similar" to f32::MAX/2.0 so the slider in example is acting completely correctly (as far as can be expected for a slider to and from the same value). I think I meant to write -f32::MAX/2.0, f32::MAX/2.0, and then completely missed the difference been MIN and MAX when comparing to the working example above!

Good news being everything is working as expected!

@dbr dbr marked this pull request as ready for review November 20, 2021 08:23
@dbr dbr merged commit 83f72f6 into imgui-rs:main Nov 29, 2021
@dbr dbr deleted the sliderissue565 branch November 29, 2021 11:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant