mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-26 04:27:49 +00:00
Merge branch 'red/rf-number' into area/ribbon-fw
This commit is contained in:
@@ -291,6 +291,9 @@ impl Component for LabelLeaf {
|
||||
self.double_click = self.resettable && cx.press().double_pressed();
|
||||
self.dot_click = self.slot > 0.0 && self.differs && cx.part(DOT).press.phase.is_click();
|
||||
self.activated = cx.activation().is_some();
|
||||
if self.activated {
|
||||
eprintln!("DIAG rf-number leaf: activated, claimed {}", self.claimed);
|
||||
}
|
||||
}
|
||||
|
||||
fn paint(&mut self, ui: &mut PaintUi<'_>, cx: &Cx<'_, Self>) {
|
||||
|
||||
@@ -576,6 +576,14 @@ pub(crate) fn finish(ctx: &Context, container: Id, merged: Option<Merged>) {
|
||||
}
|
||||
// A click on a label, as on any form label, moves focus to its one control. A node that takes no focus
|
||||
// beside it (the unit text after a number field) is not a control the click could mean.
|
||||
if label.activated || label.text == "Unit after" {
|
||||
eprintln!(
|
||||
"DIAG rf-number finish: label {:?} activated {} nodes {:?}",
|
||||
label.text,
|
||||
label.activated,
|
||||
scope.nodes.iter().map(|node| (node.id, node.focusable, node.inner_stop.is_some(), node.disabled)).collect::<Vec<_>>()
|
||||
);
|
||||
}
|
||||
let mut controls = scope.nodes.iter().filter(|node| node.focusable || node.inner_stop.is_some());
|
||||
if let (true, Some(only), None) = (label.activated, controls.next(), controls.next())
|
||||
&& !only.disabled
|
||||
|
||||
Reference in New Issue
Block a user