Support the AccessKit SetValue for DragValue; this is the only way for a Windows AT to programmatically adjust the value
This commit is contained in:
parent
b65fd40f8c
commit
599d147cf6
1 changed files with 12 additions and 0 deletions
|
@ -417,6 +417,16 @@ impl<'a> Widget for DragValue<'a> {
|
||||||
change
|
change
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#[cfg(feature = "accesskit")]
|
||||||
|
{
|
||||||
|
use accesskit::{Action, ActionData};
|
||||||
|
for request in ui.input().accesskit_action_requests(id, Action::SetValue) {
|
||||||
|
if let Some(ActionData::NumericValue(new_value)) = request.data {
|
||||||
|
value = new_value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if change != 0.0 {
|
if change != 0.0 {
|
||||||
value += speed * change;
|
value += speed * change;
|
||||||
value = emath::round_to_decimals(value, auto_decimals);
|
value = emath::round_to_decimals(value, auto_decimals);
|
||||||
|
@ -543,6 +553,8 @@ impl<'a> Widget for DragValue<'a> {
|
||||||
if clamp_range.end().is_finite() {
|
if clamp_range.end().is_finite() {
|
||||||
node.max_numeric_value = Some(*clamp_range.end());
|
node.max_numeric_value = Some(*clamp_range.end());
|
||||||
}
|
}
|
||||||
|
node.numeric_value_step = Some(speed);
|
||||||
|
node.actions |= Action::SetValue;
|
||||||
if value < *clamp_range.end() {
|
if value < *clamp_range.end() {
|
||||||
node.actions |= Action::Increment;
|
node.actions |= Action::Increment;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue