Mosaic_ui.SliderInteractive horizontal or vertical slider.
Slider with sub-cell precision thumb.
A slider maps a float value in [min;max] to a visual thumb position along a horizontal or vertical track. The thumb size is proportional to viewport_size relative to the total range, giving scrollbar-style display where the thumb represents the visible portion of content.
The slider handles left-button mouse events: clicking on the track jumps the thumb, clicking on the thumb initiates a drag, and releasing ends it.
The type for sliders. A slider owns a Renderable.t and manages its own rendering and mouse interaction.
val create :
parent:Renderable.t ->
?index:int ->
?id:string ->
?style:Toffee.Style.t ->
?visible:bool ->
?z_index:int ->
?opacity:float ->
?orientation:orientation ->
?value:float ->
?min:float ->
?max:float ->
?viewport_size:float ->
?track_color:Ansi.Color.t ->
?thumb_color:Ansi.Color.t ->
?on_change:(float -> unit) ->
unit ->
tcreate ~parent () is a slider attached to parent with:
orientation defaults to `Horizontal.min defaults to 0.0.max defaults to 100.0.value defaults to min. Clamped to [min;max].viewport_size controls thumb size relative to the range. Defaults to max (max -. min) *. 0.1, minimum 1.0.track_color defaults to dark gray (RGB 37 37 39).thumb_color defaults to medium gray (RGB 154 158 163).on_change is called when the clamped value changes, whether from mouse interaction or set_value.val node : t -> Renderable.tnode t is t's underlying renderable.
module Props : sig ... endapply_props t props replaces all properties at once and clamps the value to the new range. Always triggers a re-render. Does not fire on_change.
val value : t -> floatvalue t is the current value, always in [min;max].
val set_value : t -> float -> unitset_value t v sets the value to v clamped to [min;max]. Fires on_change if the clamped result differs from the current value.
val min : t -> floatmin t is the lower bound of the range.
val set_min : t -> float -> unitset_min t v sets the lower bound. If the current value is below v, it is clamped up, which may fire on_change. No effect if v equals the current minimum.
val max : t -> floatmax t is the upper bound of the range.
val set_max : t -> float -> unitset_max t v sets the upper bound. If the current value is above v, it is clamped down, which may fire on_change. No effect if v equals the current maximum.
val set_orientation : t -> orientation -> unitset_orientation t o sets the track direction. No effect if o equals the current orientation.
val set_viewport_size : t -> float -> unitset_viewport_size t v sets the visible portion size, clamped to [0.01;max -. min]. Controls thumb size relative to the range. No effect if the clamped result equals the current viewport size.
val set_track_color : t -> Ansi.Color.t -> unitset_track_color t c sets the track background color. No effect if c equals the current track color.
val set_thumb_color : t -> Ansi.Color.t -> unitset_thumb_color t c sets the thumb foreground color. No effect if c equals the current thumb color.
val set_on_change : t -> (float -> unit) option -> unitset_on_change t f replaces the change callback. None removes it.
val pp : Format.formatter -> t -> unitpp formats a slider for debugging.