struct mola::gui::SliderFloat

Overview

A floating-point slider in [min_value, max_value].

The displayed value beside the slider uses format_string (printf style, default “%.2f”).

If live_value is non-null the ImGui backend polls it every frame and updates the slider position whenever the user is not actively dragging, allowing the knob to track externally driven progress (e.g. dataset playback). The nanogui backend ignores live_value.

nanogui : nanogui::Slider (0-1 normalised internally) + adjacent Label. The backend maps [min_value, max_value] <-> [0,1] transparently. ImGui : ImGui::SliderFloat.

#include <GuiWidgetDescription.h>

struct SliderFloat
{
    // fields

    std::string label;
    float initial_value = 0.0f;
    float min_value = 0.0f;
    float max_value = 1.0f;
    std::string format_string = "%.2f";
    std::function<void(float)> on_change;
    int fixed_width = 0;
    LiveFloat::Ptr live_value;
};

Fields

int fixed_width = 0

0 = auto (nanogui: setFixedWidth on slider)

LiveFloat::Ptr live_value

optional; ImGui backend polls each frame