diff --git a/crates/ui/src/docking/chrome.rs b/crates/ui/src/docking/chrome.rs index a9024e7d2..3d445e82b 100644 --- a/crates/ui/src/docking/chrome.rs +++ b/crates/ui/src/docking/chrome.rs @@ -17,7 +17,7 @@ pub const TITLE_HEIGHT: f32 = 14.0; /// Names of the resize handles, appended to the frame id: `id.with(name)`. pub const RESIZE_HANDLES: [&str; 5] = ["resize", "resize-left", "resize-right", "resize-bottom", "resize-bottom-left"]; -/// Colours and font of the frame and title bar. +/// Colors and font of the frame and title bar. #[derive(Clone, Debug)] pub struct ChromeStyle { /// Painted under the contents, so the window stays opaque when the contents are not. @@ -168,7 +168,7 @@ impl<'a> FloatingFrame<'a> { let mut started = None; let mut responses = Vec::new(); let limits = PanelLimits { min: self.limits.min.max(vec2(40.0, TITLE_HEIGHT + 20.0)).min(self.limits.max), ..self.limits }; - let cancelled = ui.input(|input| input.key_pressed(Key::Escape) || !input.focused); + let canceled = ui.input(|input| input.key_pressed(Key::Escape) || !input.focused); for (name, handle, direction) in handles(rect) { if !super::targets::usable(handle) { continue; @@ -226,12 +226,12 @@ impl<'a> FloatingFrame<'a> { None }; if response.enabled() - && !cancelled + && !canceled && let Some(next) = next.filter(|next| *next != rect) { resized = Some(next); } - if cancelled || !ui.input(|input| input.pointer.primary_down()) { + if canceled || !ui.input(|input| input.pointer.primary_down()) { ui.ctx().data_mut(|data| data.remove::(anchor_id)); } if name == "resize" && (response.hovered() || response.dragged() || (response.has_focus() && !quiet)) { @@ -387,7 +387,7 @@ pub enum MoveStep { /// The rect follows the pointer, inside the bounds. Moving(Rect), /// Escape or window focus loss ended the move: the rect it started from. - Cancelled(Rect), + Canceled(Rect), /// Released over `pointer`, with the rect where it was dropped. Dropped { rect: Rect, pointer: Pos2 }, } @@ -407,7 +407,7 @@ pub fn live_move(ctx: &Context, bar: &Response, rect: Rect, bounds: Rect) -> Opt let forget = || ctx.data_mut(|data| data.remove::<(Rect, Pos2)>(key)); if ctx.input(|input| input.key_pressed(Key::Escape) || !input.focused) { forget(); - return Some(MoveStep::Cancelled(start)); + return Some(MoveStep::Canceled(start)); } let pointer = ctx.pointer_latest_pos().unwrap_or(origin); let moved = clamp(start.translate(pointer - origin), bounds); diff --git a/crates/ui/src/docking/command.rs b/crates/ui/src/docking/command.rs index ad51a3af3..e377f256c 100644 --- a/crates/ui/src/docking/command.rs +++ b/crates/ui/src/docking/command.rs @@ -159,7 +159,7 @@ pub enum UiDock

{ } /// A `ui.dock` operation, tagged by `operation`. `move` takes `target` (the anchor), `zone` -/// (default `center`) and `before`, which only applies to a centre move. +/// (default `center`) and `before`, which only applies to a center move. #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[serde(tag = "operation", rename_all = "camelCase", bound(serialize = "P: Serialize", deserialize = "P: Deserialize<'de>"))] #[non_exhaustive] diff --git a/crates/ui/src/docking/group_tests.rs b/crates/ui/src/docking/group_tests.rs index e6f62fcda..cdcfab249 100644 --- a/crates/ui/src/docking/group_tests.rs +++ b/crates/ui/src/docking/group_tests.rs @@ -303,7 +303,7 @@ fn group_drop_on_a_frame_edge_splits_and_on_a_protected_canvas_floats() { assert_eq!(**first, tabs(&[2, 3], 1)); assert_eq!(**second, tabs(&[1], 0)); - // A protected canvas takes nothing, at its centre or its edge: no join, no split, no + // A protected canvas takes nothing, at its center or its edge: no join, no split, no // preview; the group floats there. for at in [pos2(150.0, 300.0), pos2(20.0, 300.0)] { let mut d = Driver::with(frames(), canvas(), area); diff --git a/crates/ui/src/docking/hits.rs b/crates/ui/src/docking/hits.rs index baff65088..053732bb0 100644 --- a/crates/ui/src/docking/hits.rs +++ b/crates/ui/src/docking/hits.rs @@ -73,7 +73,7 @@ fn key(area: Id) -> Id { impl DockArea<'_, P> { /// Every gesture source the area drew in its last frame, with its rect in points. Hosts /// return these from a `ui.docking` control method beside the layout and `focused`; tests - /// drag from their centres. + /// drag from their centers. pub fn hit_rects(ctx: &Context, id: Id) -> Vec<(Hit

, Rect)> { ctx.data(|d| d.get_temp::, Rect)>>(key(id))).unwrap_or_default() } diff --git a/crates/ui/src/docking/model.rs b/crates/ui/src/docking/model.rs index f4a0471ae..3ca0c100c 100644 --- a/crates/ui/src/docking/model.rs +++ b/crates/ui/src/docking/model.rs @@ -563,7 +563,7 @@ impl Layout

{ if location.anchor.is_some() { return Ok(location); } - // Alone in its group: anchor to the neighbouring group, then the neighbouring column. + // Alone in its group: anchor to the neighboring group, then the neighboring column. let first = |g: Option<&Group

>| g.and_then(|g| g.panels.first()).cloned(); if let Some(anchor) = first(groups.get(group + 1)) { location.anchor = Some(anchor); diff --git a/crates/ui/src/docking/render/dock.rs b/crates/ui/src/docking/render/dock.rs index c2822cb67..3709d1694 100644 --- a/crates/ui/src/docking/render/dock.rs +++ b/crates/ui/src/docking/render/dock.rs @@ -1,7 +1,7 @@ //! [D] The dock profile: side docks of columns, each a column bar above stacked groups. //! //! Columns run from the window edge inwards. Every column's inner edge resizes it; the last -//! column's inner edge is the dock's inner edge. Behaviour follows VectorCraft `floating.rs` +//! column's inner edge is the dock's inner edge. Behavior follows VectorCraft `floating.rs` //! (column layout, drop geometry) and PhotoCraft `dock.rs` (group heights). use std::{fmt::Debug, hash::Hash}; diff --git a/crates/ui/src/docking/render/group.rs b/crates/ui/src/docking/render/group.rs index 0c01112e1..74a33b06d 100644 --- a/crates/ui/src/docking/render/group.rs +++ b/crates/ui/src/docking/render/group.rs @@ -176,7 +176,7 @@ impl Renderer<'_, P> { } let active = response.has_focus() || response.hovered(); if movable { - // A grip mark at rest, centred in the bar's reserved width beside the header. + // A grip mark at rest, centerd in the bar's reserved width beside the header. let grip = if self.style.right_to_left { Rect::from_min_max(hit.min, pos2((hit.left() + self.style.drag_bar_width).min(hit.right()), hit.bottom())) } else { diff --git a/crates/ui/src/docking/render/iconic.rs b/crates/ui/src/docking/render/iconic.rs index 1be3872f8..8949e334b 100644 --- a/crates/ui/src/docking/render/iconic.rs +++ b/crates/ui/src/docking/render/iconic.rs @@ -1,6 +1,6 @@ //! [D] Iconic columns: one icon per panel, groups apart, and the flyout an icon opens. //! -//! Behaviour follows VectorCraft `dock.rs` (icon column, flyouts beside it on the canvas side, +//! Behavior follows VectorCraft `dock.rs` (icon column, flyouts beside it on the canvas side, //! names when the column is widened) and PhotoCraft `dock.rs` (Auto-Collapse Iconic Panels). use std::{fmt::Debug, hash::Hash}; diff --git a/crates/ui/src/docking/render/preview.rs b/crates/ui/src/docking/render/preview.rs index 861e9afd7..aff38e957 100644 --- a/crates/ui/src/docking/render/preview.rs +++ b/crates/ui/src/docking/render/preview.rs @@ -77,7 +77,7 @@ impl Renderer<'_, P> { /// The valid target under the pointer for a whole group. A target holding the group /// itself is a no-op proposal; a target the model would reject is no target. A window - /// moving live looks through itself and does not split frames or join a body's centre. + /// moving live looks through itself and does not split frames or join a body's center. pub(super) fn group_proposal(&self, drag: &GroupDrag

, pointer: Pos2) -> Option> { let window = drag.gesture == GroupGesture::Window; let valid = |proposal: DropProposal

| { diff --git a/crates/ui/src/docking/surface.rs b/crates/ui/src/docking/surface.rs index 1a93cac24..36b037b3f 100644 --- a/crates/ui/src/docking/surface.rs +++ b/crates/ui/src/docking/surface.rs @@ -44,7 +44,7 @@ pub struct DockStyle { /// Minimum width of the drag bar left of the group header. Tabs overflow before the bar /// narrows. pub drag_bar_width: f32, - /// Painted under every floating window, so it stays opaque when the panel colours are not. + /// Painted under every floating window, so it stays opaque when the panel colors are not. pub floating_background: Color32, pub floating_stroke: Stroke, /// Dock: docks, columns and stacked groups. Frame: a split tree of tab frames, with @@ -454,7 +454,7 @@ pub(super) enum GroupGesture { pub(super) struct GroupDrag

{ /// The first member; identifies the gesture. pub(super) panel: P, - /// The floating window rect at the press, restored when a window move is cancelled. + /// The floating window rect at the press, restored when a window move is canceled. pub(super) original: [f32; 4], pub(super) gesture: GroupGesture, pub(super) members: Vec

, diff --git a/crates/ui/src/docking/trial_tests.rs b/crates/ui/src/docking/trial_tests.rs index 2afee3cbe..15b4535d7 100644 --- a/crates/ui/src/docking/trial_tests.rs +++ b/crates/ui/src/docking/trial_tests.rs @@ -121,7 +121,7 @@ fn galley_labels_stay_whole_and_only_an_over_wide_active_tab_ends_with_an_ellips } #[test] -fn drag_bar_shows_a_grip_at_rest_and_a_group_drag_paints_a_filled_labelled_ghost() { +fn drag_bar_shows_a_grip_at_rest_and_a_group_drag_paints_a_filled_labeled_ghost() { let mut d = Driver::new(frames()); let visuals = d.ctx.global_style().visuals.clone(); let bar = d.rect("drag-bar", 2); @@ -248,7 +248,7 @@ fn right_to_left_mirrors_the_tab_strip_and_its_insertion_slots() { assert!(second.right() <= first.left() + 0.5, "{first:?} {second:?}"); assert!(bar.right() <= second.left() + 0.5 && bar.left() >= 304.0 + 30.0 - 0.5, "the bar sits between the tabs and the header: {bar:?}"); - // Just right of the first tab's centre is before it in a right-to-left strip. + // Just right of the first tab's center is before it in a right-to-left strip. let out = d.drag(d.tab(1).center(), pos2(first.center().x + 6.0, first.center().y)); assert!(out.actions.contains(&Action::Move { panel: 1, anchor: 3, placement: Placement::Tab { before: Some(2) } }), "{:?}", out.actions); diff --git a/crates/ui/src/docking/workspace.rs b/crates/ui/src/docking/workspace.rs index 81052e565..06cc91bc6 100644 --- a/crates/ui/src/docking/workspace.rs +++ b/crates/ui/src/docking/workspace.rs @@ -80,7 +80,7 @@ impl Workspace

{ } /// Apply one action. Closed panels record where they go back, so each one can be reopened - /// with [`Self::set_visible`]. Honours [`Self::locked`]. Returns the panels the action + /// with [`Self::set_visible`]. Honors [`Self::locked`]. Returns the panels the action /// closed, in group order, so the application can release their state. pub fn apply(&mut self, action: Action

, permissions: impl Fn(&P) -> Permissions) -> Result, DockError> { self.apply_all([action], permissions) diff --git a/crates/ui/src/panes/mod.rs b/crates/ui/src/panes/mod.rs index 9e2aeca4e..75b20ddd4 100644 --- a/crates/ui/src/panes/mod.rs +++ b/crates/ui/src/panes/mod.rs @@ -202,7 +202,7 @@ struct Memory { #[derive(Clone, Copy, Debug)] struct DragOut { pane: Id, - cancelled: bool, + canceled: bool, } struct Shown

{ @@ -556,11 +556,11 @@ impl PaneHost { requests: &mut Vec>, ) { if bar.drag_started() { - memory.drag_out = Some(DragOut { pane: s.id, cancelled: false }); + memory.drag_out = Some(DragOut { pane: s.id, canceled: false }); } let Some(mut drag) = memory.drag_out.filter(|d| d.pane == s.id) else { return }; if ctx.input(|input| input.key_pressed(Key::Escape) || !input.focused) { - drag.cancelled = true; + drag.canceled = true; } let near = rect.expand(DOCK_SNAP); let Some(pointer) = ctx.pointer_latest_pos() else { return }; @@ -570,7 +570,7 @@ impl PaneHost { let target = self.snap(pointer, bounds); if bar.drag_stopped() { memory.drag_out = None; - if drag.cancelled || !outside { + if drag.canceled || !outside { return; } match target { @@ -588,7 +588,7 @@ impl PaneHost { return; } memory.drag_out = Some(drag); - if drag.cancelled || !outside { + if drag.canceled || !outside { return; } let shape = match target.map(|t| self.side(t)) { @@ -635,7 +635,7 @@ impl PaneHost { } if content.movable(&s.pane) { match chrome::live_move(ctx, &shown.inner, shown.rect, bounds) { - Some(MoveStep::Moving(next) | MoveStep::Cancelled(next)) if next != shown.rect => { + Some(MoveStep::Moving(next) | MoveStep::Canceled(next)) if next != shown.rect => { requests.push(PaneRequest::FloatRect(s.pane.clone(), rect_array(next))); } Some(MoveStep::Dropped { rect, pointer }) => { diff --git a/crates/ui/src/panes/tests.rs b/crates/ui/src/panes/tests.rs index 16ea6dd04..e8ab8527b 100644 --- a/crates/ui/src/panes/tests.rs +++ b/crates/ui/src/panes/tests.rs @@ -1,4 +1,4 @@ -//! Behaviour tests for the pane host, driven by egui pointer and key events in an 800 × 600 +//! Behavior tests for the pane host, driven by egui pointer and key events in an 800 × 600 //! window. The harness's root ui has an 8 pt margin, so the host spans x 8..792, y 8..592. use std::collections::HashMap; diff --git a/docs/ui-docking.md b/docs/ui-docking.md index c971e8470..122f0bae8 100644 --- a/docs/ui-docking.md +++ b/docs/ui-docking.md @@ -64,7 +64,7 @@ layout.apply(Action::Move { preferred `height`), a new column, or a new frame on an outer edge. - Containers take different placements: a dock column takes groups and columns, not splits. `Placement::for_zone(layout, anchor, zone, right_to_left)` maps a left, right, top, bottom or - centre zone onto what the anchor's container takes: a split in the frame tree, a new column on + center zone onto what the anchor's container takes: a split in the frame tree, a new column on that side or a new group above or below in a dock, a group above or below in a floating window. - Other actions select, minimize, collapse to icons, resize splits, columns and groups, and move a floating window to its own OS window (`SetNative`, feature `native-windows`). diff --git a/docs/ui-panes.md b/docs/ui-panes.md index 43d6f5b5c..b9c859ab6 100644 --- a/docs/ui-panes.md +++ b/docs/ui-panes.md @@ -51,7 +51,7 @@ egui::CentralPanel::default().show(ui, |ui| { }); ``` -| Piece | Behaviour | +| Piece | Behavior | |---|---| | `Edge::{Start, End, Bottom}` | Logical edges. `Start` is left, or right with `.rtl(true)`. | | `SidePolicy::Columns` | Every docked pane shows; panes on one edge sit side by side in `open` order, the first outermost. | @@ -84,7 +84,7 @@ State: Accessibility, Alt Text, Restrict Editing and Comments at `End`. Default widths as today. - `Close(p)` runs the pane's existing command (`view.navigationPane {value: false}`, …). Command ids and `nav_pane` in `ui.json` stay as they are. -- Styles takes #2584's behaviour through the host: map `StylesPaneDock::{Left, Right, Floating}` +- Styles takes #2584's behavior through the host: map `StylesPaneDock::{Left, Right, Floating}` to `Place` (`Left` is `Docked(Start)` in left-to-right interfaces), run `view.stylesPaneDock` on `Place`, keep the float rect in UI prefs. #2584's own drag, snap and `float_rect` code goes. - Other panes return `None` from `states`; their widths stay session-only, as now.