1
0
mirror of https://github.com/emilk/egui.git synced 2026-06-28 07:23:13 -04:00

Fix typos

This commit is contained in:
Emil Ernerfeldt
2023-05-04 10:04:14 +02:00
parent e2b1438977
commit f5301b1761
5 changed files with 15 additions and 15 deletions

View File

@@ -38,9 +38,9 @@ pub struct Grid {
pub locations: HashMap<NodeId, GridLoc>,
/// Share of the avilable width assigned to each column.
/// Share of the available width assigned to each column.
pub col_shares: Vec<f32>,
/// Share of the avilable height assigned to each row.
/// Share of the available height assigned to each row.
pub row_shares: Vec<f32>,
}

View File

@@ -327,7 +327,7 @@ fn linear_drop_zones<Leaf>(
.iter()
.position(|&child| is_being_dragged(egui_ctx, child));
let afer_rect = |rect: Rect| match dir {
let after_rect = |rect: Rect| match dir {
LinearDir::Horizontal => Rect::from_min_max(
rect.right_top() - vec2(preview_thickness, 0.0),
rect.right_bottom(),
@@ -345,7 +345,7 @@ fn linear_drop_zones<Leaf>(
dir,
|node_id| nodes.rect(node_id),
add_drop_drect,
afer_rect,
after_rect,
);
}
@@ -356,7 +356,7 @@ pub fn drop_zones(
dir: LinearDir,
get_rect: impl Fn(NodeId) -> Rect,
mut add_drop_drect: impl FnMut(Rect, usize),
afer_rect: impl Fn(Rect) -> Rect,
after_rect: impl Fn(Rect) -> Rect,
) {
let before_rect = |rect: Rect| match dir {
LinearDir::Horizontal => Rect::from_min_max(
@@ -380,7 +380,7 @@ pub fn drop_zones(
};
let mut prev_rect: Option<Rect> = None;
let mut insertion_index = 0; // skips over drag-source, if any, beacuse it will be removed before its re-inserted
let mut insertion_index = 0; // skips over drag-source, if any, because it will be removed before its re-inserted
for (i, &child) in children.iter().enumerate() {
let rect = get_rect(child);
@@ -407,6 +407,6 @@ pub fn drop_zones(
if let Some(last_rect) = prev_rect {
// Suggest dropping after the last child:
add_drop_drect(afer_rect(last_rect), insertion_index + 1);
add_drop_drect(after_rect(last_rect), insertion_index + 1);
}
}

View File

@@ -85,7 +85,7 @@ impl Tabs {
}
let preview_thickness = 6.0;
let afer_rect = |rect: Rect| {
let after_rect = |rect: Rect| {
let dragged_size = if let Some(dragged_index) = dragged_index {
// We actually know the size of this thing
button_rects[&self.children[dragged_index]].size()
@@ -107,7 +107,7 @@ impl Tabs {
drop_context
.suggest_rect(InsertionPoint::new(node_id, LayoutInsertion::Tabs(i)), rect);
},
afer_rect,
after_rect,
);
});
@@ -118,7 +118,7 @@ impl Tabs {
nodes.node_ui(behavior, drop_context, ui, self.active);
}
// We have only layed out the active tab, so we need to switch active tab after the ui pass:
// We have only laid out the active tab, so we need to switch active tab after the ui pass:
self.active = next_active;
}
}

View File

@@ -39,7 +39,7 @@ impl std::fmt::Debug for NodeId {
}
}
/// The top level type. Contains all peristent state, including layouts and sizes.
/// The top level type. Contains all persistent state, including layouts and sizes.
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct Dock<Leaf> {
pub root: NodeId,

View File

@@ -537,24 +537,24 @@ impl Rect {
pos2(self.right(), self.bottom())
}
/// Split rectangle in left and right halfs. `t` is expected to be in the (0,1) range.
/// Split rectangle in left and right halves. `t` is expected to be in the (0,1) range.
pub fn split_left_right_at_fraction(&self, t: f32) -> (Rect, Rect) {
self.split_left_right_at_x(lerp(self.min.x..=self.max.x, t))
}
/// Split rectangle in left and right halfs at the given `x` coordinate.
/// Split rectangle in left and right halves at the given `x` coordinate.
pub fn split_left_right_at_x(&self, split_x: f32) -> (Rect, Rect) {
let left = Rect::from_min_max(self.min, Pos2::new(split_x, self.max.y));
let right = Rect::from_min_max(Pos2::new(split_x, self.min.y), self.max);
(left, right)
}
/// Split rectangle in top and bottom halfs. `t` is expected to be in the (0,1) range.
/// Split rectangle in top and bottom halves. `t` is expected to be in the (0,1) range.
pub fn split_top_bottom_at_fraction(&self, t: f32) -> (Rect, Rect) {
self.split_top_bottom_at_y(lerp(self.min.y..=self.max.y, t))
}
/// Split rectangle in top and bottom halfs at the given `y` coordinate.
/// Split rectangle in top and bottom halves at the given `y` coordinate.
pub fn split_top_bottom_at_y(&self, split_y: f32) -> (Rect, Rect) {
let top = Rect::from_min_max(self.min, Pos2::new(self.max.x, split_y));
let bottom = Rect::from_min_max(Pos2::new(self.min.x, split_y), self.max);