mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-13 22:12:12 +00:00
docking: rustfmt and clippy
This commit is contained in:
1 parent
5f48f1e1eb
commit
352a8308c5
4 files changed
+18
-11
No files matched your search
@@ -198,13 +198,12 @@ impl<'a> FloatingFrame<'a> {
|
||||
response.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, ui.is_enabled(), self.resize_label));
|
||||
let anchor_id = response.id.with("pointer-anchor");
|
||||
crate::layout::drag_focus(ui, &response);
|
||||
if response.drag_started() {
|
||||
if let Some(origin) = ui.input(|i| i.pointer.press_origin())
|
||||
&& let Some(anchor) = AnchoredResize::new(rect, origin, direction)
|
||||
{
|
||||
ui.ctx().data_mut(|data| data.insert_temp(anchor_id, anchor));
|
||||
started = Some(response.id);
|
||||
}
|
||||
if response.drag_started()
|
||||
&& let Some(origin) = ui.input(|i| i.pointer.press_origin())
|
||||
&& let Some(anchor) = AnchoredResize::new(rect, origin, direction)
|
||||
{
|
||||
ui.ctx().data_mut(|data| data.insert_temp(anchor_id, anchor));
|
||||
started = Some(response.id);
|
||||
}
|
||||
let mut delta = Vec2::ZERO;
|
||||
if response.has_focus() {
|
||||
|
||||
@@ -548,7 +548,8 @@ fn screen_reader_values_follow_the_column_width_on_either_edge() {
|
||||
d.ctx.enable_accesskit();
|
||||
d.settle();
|
||||
let id = DockArea::<u32>::hit_id(d.id, &Hit::Divider(Divider::Column(2)));
|
||||
let request = |action, data| Event::AccessKitActionRequest(ActionRequest { action, target_tree: TreeId::ROOT, target_node: id.accesskit_id(), data });
|
||||
let request =
|
||||
|action, data| Event::AccessKitActionRequest(ActionRequest { action, target_tree: TreeId::ROOT, target_node: id.accesskit_id(), data });
|
||||
let case = format!("{side:?}, right to left {right_to_left}");
|
||||
let out = d.frame(vec![request(A::SetValue, Some(ActionData::NumericValue(300.0)))]);
|
||||
assert_eq!(out.actions, vec![Action::ResizeColumn { panel: 2, width: 300.0 }], "{case}");
|
||||
|
||||
@@ -320,7 +320,10 @@ fn locked_workspace_rejects_structure_but_allows_activate_open_minimize_and_resi
|
||||
// Opening at a chosen place works too; moving a shown panel there does not.
|
||||
workspace.apply(Action::OpenAt { panel: 13, anchor: 11, placement: Placement::Split(Zone::Bottom) }, allow).unwrap();
|
||||
assert!(workspace.layout.contains(&13));
|
||||
assert_eq!(workspace.apply(Action::OpenAt { panel: 2, anchor: 11, placement: Placement::Split(Zone::Bottom) }, allow), Err(DockError::NotAllowed));
|
||||
assert_eq!(
|
||||
workspace.apply(Action::OpenAt { panel: 2, anchor: 11, placement: Placement::Split(Zone::Bottom) }, allow),
|
||||
Err(DockError::NotAllowed)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -493,7 +496,10 @@ mod serde_tests {
|
||||
root: Some(Node::Split {
|
||||
axis: SplitAxis::Horizontal,
|
||||
size: SplitSize::FixedFirst(240.0),
|
||||
first: Box::new(Node::Dock { side: Side::Start, columns: vec![Column::new(vec![Group::new(vec![s("layers"), s("pages")], 0)], 240.0)] }),
|
||||
first: Box::new(Node::Dock {
|
||||
side: Side::Start,
|
||||
columns: vec![Column::new(vec![Group::new(vec![s("layers"), s("pages")], 0)], 240.0)],
|
||||
}),
|
||||
second: Box::new(Node::Split {
|
||||
axis: SplitAxis::Horizontal,
|
||||
size: SplitSize::Ratio(0.75),
|
||||
|
||||
@@ -228,7 +228,8 @@ fn invalid_saved_layouts_reject_duplicates_selection_depth_and_nonfinite_geometr
|
||||
for empty in [tabs(&[], 0), Node::Stack { entries: Vec::new() }] {
|
||||
let root = Layout { root: Some(empty.clone()), floating: Vec::new() };
|
||||
assert_eq!(root.validate(), Err(DockError::InvalidGeometry));
|
||||
let beside = Node::Split { axis: SplitAxis::Horizontal, size: SplitSize::Ratio(0.5), first: Box::new(tabs(&[1], 0)), second: Box::new(empty) };
|
||||
let beside =
|
||||
Node::Split { axis: SplitAxis::Horizontal, size: SplitSize::Ratio(0.5), first: Box::new(tabs(&[1], 0)), second: Box::new(empty) };
|
||||
assert_eq!(Layout { root: Some(beside), floating: Vec::new() }.validate(), Err(DockError::InvalidGeometry));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user