mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-13 22:12:12 +00:00
ui: use US spelling
This commit is contained in:
1 parent
3600104e76
commit
ceb75f965e
16 files changed
+29
-29
No files matched your search
@@ -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::<AnchoredResize>(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);
|
||||
|
||||
@@ -159,7 +159,7 @@ pub enum UiDock<P> {
|
||||
}
|
||||
|
||||
/// 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]
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -73,7 +73,7 @@ fn key(area: Id) -> Id {
|
||||
impl<P: Clone + Eq + Hash + Debug + Send + Sync + 'static> 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<P>, Rect)> {
|
||||
ctx.data(|d| d.get_temp::<Vec<(Hit<P>, Rect)>>(key(id))).unwrap_or_default()
|
||||
}
|
||||
|
||||
@@ -563,7 +563,7 @@ impl<P: Clone + Eq + Hash> Layout<P> {
|
||||
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<P>>| g.and_then(|g| g.panels.first()).cloned();
|
||||
if let Some(anchor) = first(groups.get(group + 1)) {
|
||||
location.anchor = Some(anchor);
|
||||
|
||||
@@ -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};
|
||||
|
||||
@@ -176,7 +176,7 @@ impl<P: Clone + Eq + Hash + Debug + Send + Sync + 'static> 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 {
|
||||
|
||||
@@ -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};
|
||||
|
||||
@@ -77,7 +77,7 @@ impl<P: Clone + Eq + Hash + Debug + Send + Sync + 'static> 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<P>, pointer: Pos2) -> Option<DropProposal<P>> {
|
||||
let window = drag.gesture == GroupGesture::Window;
|
||||
let valid = |proposal: DropProposal<P>| {
|
||||
|
||||
@@ -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<P> {
|
||||
/// 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<P>,
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ impl<P: Clone + Eq + Hash> Workspace<P> {
|
||||
}
|
||||
|
||||
/// 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<P>, permissions: impl Fn(&P) -> Permissions) -> Result<Vec<P>, DockError> {
|
||||
self.apply_all([action], permissions)
|
||||
|
||||
@@ -202,7 +202,7 @@ struct Memory {
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
struct DragOut {
|
||||
pane: Id,
|
||||
cancelled: bool,
|
||||
canceled: bool,
|
||||
}
|
||||
|
||||
struct Shown<P> {
|
||||
@@ -556,11 +556,11 @@ impl PaneHost {
|
||||
requests: &mut Vec<PaneRequest<P>>,
|
||||
) {
|
||||
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 }) => {
|
||||
|
||||
@@ -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;
|
||||
|
||||
+1
-1
@@ -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`).
|
||||
|
||||
+2
-2
@@ -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.
|
||||
|
||||
Reference in new issue
Block a user