mirror of
https://github.com/emilk/egui.git
synced 2026-09-02 23:00:04 -04:00
Same for Slider
This commit is contained in:
@@ -578,6 +578,19 @@ impl<'a> Slider<'a> {
|
|||||||
self.set_value(new_value);
|
self.set_value(new_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "accesskit")]
|
||||||
|
{
|
||||||
|
use accesskit::{Action, ActionData};
|
||||||
|
for request in ui
|
||||||
|
.input()
|
||||||
|
.accesskit_action_requests(response.id, Action::SetValue)
|
||||||
|
{
|
||||||
|
if let Some(ActionData::NumericValue(new_value)) = request.data {
|
||||||
|
self.set_value(new_value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Paint it:
|
// Paint it:
|
||||||
if ui.is_rect_visible(response.rect) {
|
if ui.is_rect_visible(response.rect) {
|
||||||
let value = self.get_value();
|
let value = self.get_value();
|
||||||
@@ -732,6 +745,8 @@ impl<'a> Slider<'a> {
|
|||||||
let mut node = ui.ctx().accesskit_node(response.id, None);
|
let mut node = ui.ctx().accesskit_node(response.id, None);
|
||||||
node.min_numeric_value = Some(*self.range.start());
|
node.min_numeric_value = Some(*self.range.start());
|
||||||
node.max_numeric_value = Some(*self.range.end());
|
node.max_numeric_value = Some(*self.range.end());
|
||||||
|
node.numeric_value_step = self.step;
|
||||||
|
node.actions |= Action::SetValue;
|
||||||
let clamp_range = self.clamp_range();
|
let clamp_range = self.clamp_range();
|
||||||
if value < *clamp_range.end() {
|
if value < *clamp_range.end() {
|
||||||
node.actions |= Action::Increment;
|
node.actions |= Action::Increment;
|
||||||
|
|||||||
Reference in New Issue
Block a user