mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-03 01:00:48 +00:00
docking: clippy, a type for a split's children and one argument for a node and its rect
This commit is contained in:
1 parent
cb352b39ff
commit
2cad4d2bec
2 files changed
+6
-3
No files matched your search
@@ -143,7 +143,7 @@ impl<P: Clone + Eq + Hash + Debug + Send + Sync + 'static> Renderer<'_, P> {
|
||||
let actions = self.divider_actions(root, path, response.delta);
|
||||
self.output.actions.extend(actions);
|
||||
}
|
||||
self.intersections(ui, node, rect, path, split.divider, mark, root);
|
||||
self.intersections(ui, (node, rect), path, split.divider, mark, root);
|
||||
if self.dividers.len() < crate::docking::model::MAX_NODES {
|
||||
self.dividers.push(DrawnDivider { path: path.clone(), axis: *axis, divider: split.divider });
|
||||
}
|
||||
@@ -285,7 +285,7 @@ impl<P: Clone + Eq + Hash + Debug + Send + Sync + 'static> Renderer<'_, P> {
|
||||
|
||||
/// Four-way handles where a divider drawn inside the split `node` (since `mark`) ends on
|
||||
/// the split's own divider: dragging one moves both dividers.
|
||||
fn intersections(&mut self, ui: &mut Ui, node: &Node<P>, rect: Rect, path: &[bool], divider: Rect, mark: usize, root: (&Node<P>, Rect)) {
|
||||
fn intersections(&mut self, ui: &mut Ui, (node, rect): (&Node<P>, Rect), path: &[bool], divider: Rect, mark: usize, root: (&Node<P>, Rect)) {
|
||||
let Node::Split { axis, .. } = node else { return };
|
||||
let side = (self.style.gap * 3.0).max(12.0);
|
||||
let mut found = Vec::new();
|
||||
|
||||
@@ -15,6 +15,9 @@ use super::{dock::dock_rects, node_limits, split_bounds};
|
||||
use crate::docking::{DockContent, DockStyle, Node, PanelLimits};
|
||||
use crate::layout::{SplitAxis, SplitLayout, SplitSize, split_rect};
|
||||
|
||||
/// A split's two children with the rects they are drawn in.
|
||||
type Children<'n, P> = [(&'n Node<P>, Rect); 2];
|
||||
|
||||
/// Room a group keeps above its minimum after a drop, so each of its dividers can still
|
||||
/// travel both ways.
|
||||
pub(in crate::docking) const DROP_MARGIN: f32 = 1.0;
|
||||
@@ -169,7 +172,7 @@ impl<P> Sizer<'_, P> {
|
||||
/// The ancestors that continue the line of the split at the end of `chain` along `axis`:
|
||||
/// each with its children and whether the line runs through its second child, nearest first.
|
||||
/// The line ends at a split across the axis or beside a dock.
|
||||
fn line<'n>(&self, chain: &[(&'n Node<P>, Rect)], path: &[bool], axis: SplitAxis) -> Vec<(usize, [(&'n Node<P>, Rect); 2], bool)> {
|
||||
fn line<'n>(&self, chain: &[(&'n Node<P>, Rect)], path: &[bool], axis: SplitAxis) -> Vec<(usize, Children<'n, P>, bool)> {
|
||||
let mut line = Vec::new();
|
||||
for depth in (0..path.len()).rev() {
|
||||
let Some(&(node, rect)) = chain.get(depth) else { break };
|
||||
|
||||
Reference in new issue
Block a user