tools-w16: net change of 9 commits
- tools-w16: written by an agent - tools-w16: finished by an agent - tools-w16: finished by an agent - tools-w16: review fixes (review-1.md) - tools-w16: review fixes (review-1.md): placed_in keeps no clamp - tools-w16: placed rects keep inside their bounds (T3) - Integration: icons keep framework-01-w12's dash-align drawings in stroke_drawings and dialogs-w17's circle-filled in the attribution - tools-w16: the task bar trial's frame lies high on the 360-point story canvas, so the bar has room below it after each move and drop (tools run round) - Integration: measure_layer keeps dialogs-w17's family tier beside Overlay::full_window
@@ -1,4 +1,5 @@
|
||||
//! The canvas controls: leaves a `Canvas` body shows (`#[component(canvas_control)]`).
|
||||
//! The canvas controls: leaves a `Canvas` body shows (`#[component(canvas_control)]`), and the contextual task bar
|
||||
//! (`TaskBar`), a pattern a canvas body shows over its document.
|
||||
|
||||
mod words;
|
||||
|
||||
|
||||
@@ -1,10 +1,27 @@
|
||||
//! `TaskBar`: the contextual task bar over a canvas, hung below its anchor until the user moves it.
|
||||
|
||||
use crate::contract::{Bind, Inner};
|
||||
use crate::runtime::env::Label;
|
||||
#[cfg(feature = "testing")]
|
||||
mod stories;
|
||||
|
||||
use super::CanvasControlWords;
|
||||
use crate::bars::{Bar, BarKind};
|
||||
use crate::buttons::IconButton;
|
||||
use crate::canvas::canvas_space;
|
||||
use crate::contract::overlay::{Anchor, Place, PlacementChange, PlacementKind};
|
||||
use crate::contract::{
|
||||
Bind, BindMut, BodyCx, Common, Component, Container, ContainerProps, Cx, DragBand, HeaderRegion, Inner, Mount, NoValue, Outcome, Overlay,
|
||||
Pad, PopupKind, Props as _, Role, Show as _, ShowContainer as _, Sizing, Trigger,
|
||||
};
|
||||
use crate::display::Icon;
|
||||
use crate::menu::{Menu, MenuItem};
|
||||
use crate::primitives::IconSpec;
|
||||
use crate::runtime::env::{Env, Label};
|
||||
use crate::style::{ComponentStyle, StyleCx, SurfaceKind};
|
||||
use craft_behavior::kurbo::Point;
|
||||
use egui::{Rect, Response, Ui};
|
||||
use std::marker::PhantomData;
|
||||
use craft_behavior::overlay::{Align, Side};
|
||||
use craft_behavior::{EditEvent, IconId, Metrics, Mixed, Sense};
|
||||
use egui::{Pos2, Rect, Response, Ui};
|
||||
use std::sync::Arc;
|
||||
|
||||
/// Where the task bar sits: pinned or following its anchor, and where the user moved it. The one owner of the bar's
|
||||
/// place; the serde shape is PhotoCraft's, so saved preferences load unchanged, and a non-finite `at` counts as unset.
|
||||
@@ -18,17 +35,34 @@ pub struct TaskBarPlace {
|
||||
pub at: Option<[f32; 2]>,
|
||||
}
|
||||
|
||||
impl TaskBarPlace {
|
||||
/// The bar's top left in `area` while it has a place; `None` while it follows its anchor. A non-finite `at`
|
||||
/// counts as unset.
|
||||
fn placed_in(&self, area: Rect) -> Option<Pos2> {
|
||||
let [x, y] = self.at.filter(|at| at.iter().all(|v| v.is_finite()))?;
|
||||
Some(Pos2::new(area.min.x + x, area.min.y + y))
|
||||
}
|
||||
}
|
||||
|
||||
/// The contextual task bar: a movable modeless layer hung below the screen bounds of `anchor` while its place is
|
||||
/// unset, with a body of members and a More menu (Hide, Reset, Pin). One place, pin and Hide setting for Crop and
|
||||
/// Frame.
|
||||
///
|
||||
/// - Place: centred under the anchor's bounds on screen, a section gap below them, following the anchor each pass.
|
||||
/// Dragged by its grip (any free point of the bar), it stays where it is dropped and keeps its left edge while the
|
||||
/// anchor moves or the bar grows; a press with no drag changes nothing. Pinned, it stays where it shows.
|
||||
/// - Area: the bar shows inside `area` (the canvas rect): a move stays inside it, and a stored place outside it comes
|
||||
/// back inside, its left and top edges winning where the bar does not fit.
|
||||
/// - Menu: Hide bar reports `hide`; Reset bar position clears the place, so the bar follows its anchor again; Pin bar
|
||||
/// position keeps it where it shows.
|
||||
/// - Nothing shows outside a canvas, or while the anchor's bounds or `area` is not finite or `area` has no size.
|
||||
/// - `place` is the caller's value (`Bind::bound`): the bar reads it before it shows and writes the pass's change
|
||||
/// after.
|
||||
#[must_use = "show the task bar with `show`"]
|
||||
#[derive(crate::contract::Pattern, crate::contract::Props)]
|
||||
pub struct TaskBar<'a> {
|
||||
#[allow(dead_code)] // P3(tools-w16): tl.T49
|
||||
label: Label,
|
||||
#[allow(dead_code)] // P3(tools-w16): tl.T49
|
||||
anchor: &'a [Point],
|
||||
#[allow(dead_code)] // P3(tools-w16): tl.T49
|
||||
place: Bind<'a, TaskBarPlace>,
|
||||
}
|
||||
|
||||
@@ -44,17 +78,64 @@ pub struct TaskBarOutput {
|
||||
pub rect: Rect,
|
||||
}
|
||||
|
||||
impl Outcome for TaskBarOutput {
|
||||
type Value = NoValue;
|
||||
|
||||
fn response(&self) -> &Response {
|
||||
&self.response
|
||||
}
|
||||
}
|
||||
|
||||
/// The context the task bar's body gets.
|
||||
pub struct TaskBarCx<'a> {
|
||||
marker: PhantomData<&'a mut ()>,
|
||||
menu: &'a mut MoreMenu,
|
||||
}
|
||||
|
||||
impl TaskBarCx<'_> {
|
||||
/// Places the More menu button here, before the members that follow it (the Crop bar puts Cancel and Done after
|
||||
/// it); without the call the button comes after the body.
|
||||
pub fn more_menu(&mut self, ui: &mut Ui) {
|
||||
let _ = ui;
|
||||
todo!("tl.T49")
|
||||
self.menu.place(ui);
|
||||
}
|
||||
}
|
||||
|
||||
/// A row of the More menu.
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
enum MenuPick {
|
||||
Hide,
|
||||
Reset,
|
||||
Pin,
|
||||
}
|
||||
|
||||
/// The More button and its menu, placed once per run of the bar's body.
|
||||
struct MoreMenu {
|
||||
words: Arc<CanvasControlWords>,
|
||||
placed: bool,
|
||||
pick: Option<MenuPick>,
|
||||
}
|
||||
|
||||
impl MoreMenu {
|
||||
/// Shows the button and its menu here unless this run of the body showed them already.
|
||||
fn place(&mut self, ui: &mut Ui) {
|
||||
if std::mem::replace(&mut self.placed, true) {
|
||||
return;
|
||||
}
|
||||
let words = Arc::clone(&self.words);
|
||||
let more = IconButton::new(IconId::new("more")).popup(PopupKind::Menu).label(words.task_bar_more.clone()).show(ui);
|
||||
let mut pick = None;
|
||||
let rows = [
|
||||
(MenuPick::Hide, "eye_off", &words.task_bar_hide),
|
||||
(MenuPick::Reset, "reset", &words.task_bar_reset),
|
||||
(MenuPick::Pin, "pin", &words.task_bar_pin),
|
||||
];
|
||||
let _ = Menu::new(words.task_bar_more.clone()).opened_by(&more, Trigger::Click).show(ui, |ui, _| {
|
||||
for (row, icon, name) in rows {
|
||||
if MenuItem::new(name.clone()).icon(IconSpec::svg(IconId::new(icon))).show(ui).ran {
|
||||
pick = Some(row);
|
||||
}
|
||||
}
|
||||
});
|
||||
self.pick = pick.or(self.pick);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,8 +146,179 @@ impl<'a> TaskBar<'a> {
|
||||
}
|
||||
|
||||
/// Shows the bar inside `area`; `body` fills its members.
|
||||
pub fn show<R>(self, ui: &mut Ui, area: Rect, body: impl FnOnce(&mut Ui, &mut TaskBarCx<'_>) -> R) -> Inner<TaskBarOutput, R> {
|
||||
let _ = (ui, area, body);
|
||||
todo!("tl.T49")
|
||||
pub fn show<R>(self, ui: &mut Ui, area: Rect, mut body: impl FnMut(&mut Ui, &mut TaskBarCx<'_>) -> R) -> Inner<TaskBarOutput, R> {
|
||||
let TaskBar { label, anchor, mut place } = self;
|
||||
let env = Env::of(ui);
|
||||
let words = env.words::<CanvasControlWords>();
|
||||
// The anchor maps through this pass's view, so the bar follows a scroll or zoom in the same pass.
|
||||
let bounds = canvas_space(&env.view()).map_or(Rect::NOTHING, |space| {
|
||||
anchor.iter().fold(Rect::NOTHING, |mut bounds, point| {
|
||||
bounds.extend_with(space.view.to_screen(*point));
|
||||
bounds
|
||||
})
|
||||
});
|
||||
let shows = bounds.is_finite() && area.is_finite() && area.is_positive();
|
||||
let held = match place.reborrow().get() {
|
||||
Some(Mixed::Same(held)) => held,
|
||||
_ => TaskBarPlace::default(),
|
||||
};
|
||||
let hang = shows.then(|| hang_rect(bounds, env.tokens.space.gap.section));
|
||||
let layer = TaskBarLayer::new(label, words.task_bar_move.clone(), layer_overlay(&held, hang, area), shows);
|
||||
let mut menu = MoreMenu { words: Arc::clone(&words), placed: false, pick: None };
|
||||
let mut shown = layer.show(ui, |ui, _| {
|
||||
Bar::new(Label::Empty, BarKind::Tool).show(ui, |ui, _| {
|
||||
menu.placed = false;
|
||||
let inner = body(ui, &mut TaskBarCx { menu: &mut menu });
|
||||
menu.place(ui);
|
||||
inner
|
||||
})
|
||||
});
|
||||
let rect = shown.output.response.rect;
|
||||
let pick = menu.pick;
|
||||
if shows {
|
||||
let moved = shown.output.moved.filter(|moved| moved.min != rect.min);
|
||||
let next = settled(held, rect, area, moved, pick);
|
||||
if next != held {
|
||||
let word = match pick {
|
||||
Some(MenuPick::Reset) => &words.task_bar_reset,
|
||||
Some(MenuPick::Pin) => &words.task_bar_pin,
|
||||
_ => &words.task_bar_move,
|
||||
};
|
||||
let event = EditEvent::set(Mixed::Same(held), next, Arc::from(word.as_str()), None);
|
||||
let _ = shown.settle(|cx, _| place.reborrow().write(cx, &event));
|
||||
}
|
||||
}
|
||||
let output = TaskBarOutput { response: shown.output.response, hide: pick == Some(MenuPick::Hide), rect };
|
||||
match shown.inner {
|
||||
Some(bar) => Inner { output, inner: bar.inner, settle: bar.settle },
|
||||
None => Inner { output, inner: None, settle: None },
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The rect the bar hangs below: the anchor's screen `bounds` grown by `gap` at the bottom. The overlay host keeps the
|
||||
/// layer inside `Overlay::bounds`.
|
||||
fn hang_rect(bounds: Rect, gap: f32) -> Rect {
|
||||
Rect::from_min_max(bounds.min, Pos2::new(bounds.max.x, bounds.max.y + gap))
|
||||
}
|
||||
|
||||
/// The layer the bar shows in: hung below `hang` while `held` has no place, at its place once it has one. A move stays
|
||||
/// inside `area`. A bar that does not show (`hang` is `None`) gets a closed layer with no place.
|
||||
fn layer_overlay(held: &TaskBarPlace, hang: Option<Rect>, area: Rect) -> Overlay {
|
||||
let overlay = Overlay::floating().modeless().movable(true).body_scroll(false);
|
||||
let Some(hang) = hang else { return overlay };
|
||||
let overlay = overlay.bounds(area);
|
||||
match held.placed_in(area) {
|
||||
Some(at) => overlay.placed_at(at),
|
||||
None => overlay.place(Place::anchored(Anchor::Rect(hang), Side::Below, Align::Center)),
|
||||
}
|
||||
}
|
||||
|
||||
/// The place after a pass that showed the bar at `shown`. A move (`moved`, a rect other than `shown`) keeps the bar
|
||||
/// where it was dropped; Reset clears the place; Pin, and a pinned bar with no place, keep the bar at `shown`. A
|
||||
/// non-finite place is cleared. With no move and no pick, the place stays unchanged; the overlay host keeps the layer
|
||||
/// inside the area.
|
||||
fn settled(held: TaskBarPlace, shown: Rect, area: Rect, moved: Option<Rect>, pick: Option<MenuPick>) -> TaskBarPlace {
|
||||
let offset = |rect: Rect| -> [f32; 2] { (rect.min - area.min).into() };
|
||||
let placed = held.placed_in(area).is_some();
|
||||
let mut next = TaskBarPlace { at: held.at.filter(|_| placed), ..held };
|
||||
if let Some(moved) = moved {
|
||||
next.at = Some(offset(moved));
|
||||
}
|
||||
match pick {
|
||||
Some(MenuPick::Reset) => next = TaskBarPlace::default(),
|
||||
Some(MenuPick::Pin) => next = TaskBarPlace { pinned: true, at: Some(offset(shown)) },
|
||||
Some(MenuPick::Hide) | None => {}
|
||||
}
|
||||
if next.pinned && next.at.is_none() {
|
||||
next.at = Some(offset(shown));
|
||||
}
|
||||
next
|
||||
}
|
||||
|
||||
/// The style of the task bar's layer: the surface comes from the container.
|
||||
#[derive(Clone, Debug, Default, PartialEq, ComponentStyle)]
|
||||
#[non_exhaustive]
|
||||
pub struct TaskBarLayerStyle {
|
||||
#[style(metrics)]
|
||||
metrics: Metrics,
|
||||
}
|
||||
|
||||
/// What the task bar's layer reports: its response and the last move of this pass.
|
||||
#[derive(Debug)]
|
||||
struct TaskBarLayerOutput {
|
||||
response: Response,
|
||||
moved: Option<Rect>,
|
||||
}
|
||||
|
||||
impl Outcome for TaskBarLayerOutput {
|
||||
type Value = NoValue;
|
||||
|
||||
fn response(&self) -> &Response {
|
||||
&self.response
|
||||
}
|
||||
}
|
||||
|
||||
/// The task bar's layer: a floating surface whose line starts with the grip and holds the bar. The move band lies
|
||||
/// under the whole line, so the grip and every free point between the members move the layer.
|
||||
#[derive(crate::contract::Component)]
|
||||
#[component(container, unregistered)]
|
||||
struct TaskBarLayer {
|
||||
#[common]
|
||||
common: Common,
|
||||
#[container]
|
||||
props: ContainerProps,
|
||||
grip: Label,
|
||||
/// Open while the bar shows; the caller shows the bar again each pass it wants it.
|
||||
open: Bind<'static, bool>,
|
||||
moved: Option<Rect>,
|
||||
}
|
||||
|
||||
impl TaskBarLayer {
|
||||
fn new(label: Label, grip: Label, overlay: Overlay, open: bool) -> Self {
|
||||
let props = ContainerProps::new()
|
||||
.mount(Mount::Layer(overlay))
|
||||
.surface(SurfaceKind::Floating)
|
||||
.pad(Pad::None)
|
||||
.sizing(Sizing::Content)
|
||||
.header(HeaderRegion::new().band(DragBand::Move).inline(true));
|
||||
TaskBarLayer { common: Common::new(), props, grip, open: Bind::given(open), moved: None }.label(label).id_salt("task-bar")
|
||||
}
|
||||
}
|
||||
|
||||
impl Component for TaskBarLayer {
|
||||
const ROLE: Role = Role::GROUP;
|
||||
const PARTS: bool = false;
|
||||
const STOPS: bool = false;
|
||||
type Style = TaskBarLayerStyle;
|
||||
type Output = TaskBarLayerOutput;
|
||||
|
||||
fn style(_: &StyleCx<'_>, _: TaskBarLayerStyleKey) -> TaskBarLayerStyle {
|
||||
TaskBarLayerStyle::default()
|
||||
}
|
||||
|
||||
fn sense(&self) -> Sense {
|
||||
Sense::empty()
|
||||
}
|
||||
|
||||
fn finish(self, cx: Cx<'_, Self>) -> TaskBarLayerOutput {
|
||||
TaskBarLayerOutput { response: cx.response.clone(), moved: self.moved }
|
||||
}
|
||||
}
|
||||
|
||||
impl Container for TaskBarLayer {
|
||||
fn open(&mut self) -> Option<BindMut<'_, bool>> {
|
||||
Some(self.open.reborrow())
|
||||
}
|
||||
|
||||
/// The grip glyph, named for the move it offers.
|
||||
fn header(&mut self, ui: &mut Ui, _: &mut BodyCx<'_>) {
|
||||
let _ = Icon::new(IconSpec::svg(IconId::new("grip"))).label(self.grip.clone()).show(ui);
|
||||
}
|
||||
|
||||
fn placement_changed(&mut self, change: &PlacementChange) {
|
||||
if change.kind == PlacementKind::Move {
|
||||
self.moved = Some(change.rect);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
//! Stories of `TaskBar`.
|
||||
|
||||
use super::{TaskBar, TaskBarPlace};
|
||||
use crate::buttons::{Button, IconButton};
|
||||
use crate::canvas::testing::canvas_story::{StoryDocument, on_canvas};
|
||||
use crate::contract::{Bind, Props as _, Show as _};
|
||||
use crate::testing::{Drive, StoryData, StoryOutput, story};
|
||||
use craft_behavior::IconId;
|
||||
use craft_behavior::kurbo::{Point, Vec2};
|
||||
use egui::Ui;
|
||||
|
||||
/// The corners of a crop frame turned by a few degrees about the document's middle: the Crop tool hangs its bar from
|
||||
/// them, so the bar sits under the frame's lowest corner.
|
||||
fn turned_frame() -> [Point; 4] {
|
||||
let centre = StoryDocument::STANDARD.centre();
|
||||
let (sin, cos) = 0.2_f64.sin_cos();
|
||||
[(-220.0, -130.0), (220.0, -130.0), (220.0, 130.0), (-220.0, 130.0)].map(|(x, y)| centre + Vec2::new(x * cos - y * sin, x * sin + y * cos))
|
||||
}
|
||||
|
||||
/// The Crop tool's bar: three buttons, the More menu, then Cancel and Done after it.
|
||||
#[story(TaskBar<'static>, covers = [], drive = Drive::Never)]
|
||||
fn crop_bar(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
let corners = turned_frame();
|
||||
on_canvas(ui, |ui, area, _| {
|
||||
let place = data.value("place", TaskBarPlace::default());
|
||||
TaskBar::new("Crop", &corners, Bind::bound(place))
|
||||
.show(ui, area, |ui, cx| {
|
||||
for (icon, name) in [("rotate_ccw", "Rotate left"), ("rotate_cw", "Rotate right"), ("grid", "Overlay")] {
|
||||
let _ = IconButton::new(IconId::new(icon)).label(name).show(ui);
|
||||
}
|
||||
cx.more_menu(ui);
|
||||
let _ = Button::new("Cancel").show(ui);
|
||||
let _ = Button::new("Done").show(ui);
|
||||
})
|
||||
.output
|
||||
})
|
||||
}
|
||||
|
||||
/// A bar the user moved and pinned: it keeps its place near the canvas's top left while the frame stays where it is.
|
||||
#[story(TaskBar<'static>, covers = [], drive = Drive::Never)]
|
||||
fn placed_and_pinned(ui: &mut Ui, data: &mut StoryData) -> StoryOutput {
|
||||
let corners = turned_frame();
|
||||
on_canvas(ui, |ui, area, _| {
|
||||
let place = data.value("place", TaskBarPlace { pinned: true, at: Some([24.0, 24.0]) });
|
||||
TaskBar::new("Crop", &corners, Bind::bound(place))
|
||||
.show(ui, area, |ui, _| {
|
||||
let _ = Button::new("Done").show(ui);
|
||||
})
|
||||
.output
|
||||
})
|
||||
}
|
||||
@@ -7,3 +7,5 @@ mod grid;
|
||||
mod guides;
|
||||
|
||||
mod marquee;
|
||||
|
||||
mod task_bar;
|
||||
|
||||
@@ -0,0 +1,136 @@
|
||||
//! The contextual task bar (N6): hung centred under its anchor's screen bounds, following the anchor until the grip
|
||||
//! moves it, reset and pinned from its More menu, and kept inside the canvas area whatever place it is given.
|
||||
|
||||
use craft_behavior::kurbo::{Point, Vec2 as DocVec};
|
||||
use craft_ui::buttons::Button;
|
||||
use craft_ui::canvas_controls::{TaskBar, TaskBarPlace};
|
||||
use craft_ui::contract::{Bind, Show as _};
|
||||
use craft_ui::testing::canvas_story::on_canvas;
|
||||
use craft_ui::testing::{Fixture, trial};
|
||||
use egui::{Rect, Vec2};
|
||||
use std::cell::RefCell;
|
||||
use std::rc::Rc;
|
||||
|
||||
const SLACK: f32 = 1.5;
|
||||
|
||||
/// What the trial's canvas shows and what the bar reported in the last pass.
|
||||
#[derive(Clone)]
|
||||
struct Scene {
|
||||
/// The anchor, in document points: a crop frame's corners.
|
||||
anchor: Vec<Point>,
|
||||
place: TaskBarPlace,
|
||||
/// The anchor's bounds on screen.
|
||||
bounds: Rect,
|
||||
/// The canvas rect the bar is kept in.
|
||||
area: Rect,
|
||||
/// The bar's rect.
|
||||
rect: Rect,
|
||||
}
|
||||
|
||||
/// A frame of the story document, moved by `by` document points. It lies high on the story canvas (360 points tall),
|
||||
/// so the bar hangs below it after every move and drop the trial makes.
|
||||
fn frame(by: DocVec) -> Vec<Point> {
|
||||
[(120.0, 40.0), (520.0, 40.0), (520.0, 200.0), (120.0, 200.0)].into_iter().map(|(x, y)| Point::new(x, y) + by).collect()
|
||||
}
|
||||
|
||||
/// A canvas that shows the bar for the scene's anchor and place, with the More menu before a Done button.
|
||||
fn fixture(scene: &Rc<RefCell<Scene>>) -> Fixture {
|
||||
let shared = Rc::clone(scene);
|
||||
let mut fixture = Fixture::new(move |ui| {
|
||||
let _ = on_canvas(ui, |ui, area, view| {
|
||||
let mut held = shared.borrow_mut();
|
||||
let scene = &mut *held;
|
||||
scene.bounds = Rect::from_points(&scene.anchor.iter().map(|point| view.to_screen(*point)).collect::<Vec<_>>());
|
||||
scene.area = area;
|
||||
let shown = TaskBar::new("Crop", &scene.anchor, Bind::bound(&mut scene.place)).show(ui, area, |ui, cx| {
|
||||
cx.more_menu(ui);
|
||||
let _ = Button::new("Done").show(ui);
|
||||
});
|
||||
scene.rect = shown.output.rect;
|
||||
shown.output
|
||||
});
|
||||
});
|
||||
fixture.room(Vec2::new(1120.0, 720.0));
|
||||
fixture
|
||||
}
|
||||
|
||||
fn seen(scene: &Rc<RefCell<Scene>>) -> Scene {
|
||||
scene.borrow().clone()
|
||||
}
|
||||
|
||||
fn centred_under_anchor(scene: &Scene) -> bool {
|
||||
(scene.rect.center().x - scene.bounds.center().x).abs() < SLACK && scene.rect.top() > scene.bounds.bottom()
|
||||
}
|
||||
|
||||
fn inside_area(scene: &Scene) -> bool {
|
||||
scene.area.expand(SLACK).contains_rect(scene.rect)
|
||||
}
|
||||
|
||||
/// Opens the More menu and runs its row `row`.
|
||||
fn pick(fixture: &mut Fixture, row: &str) {
|
||||
let more = fixture.by_label("More options").expect("the bar has its More button");
|
||||
fixture.click(&more).settle();
|
||||
let row = fixture.by_label(row).expect("the More menu lists the row");
|
||||
fixture.click(&row).settle();
|
||||
}
|
||||
|
||||
#[trial]
|
||||
fn the_task_bar_follows_its_anchor_until_moved_and_stays_inside_the_area() {
|
||||
let scene = Rc::new(RefCell::new(Scene {
|
||||
anchor: frame(DocVec::ZERO),
|
||||
place: TaskBarPlace::default(),
|
||||
bounds: Rect::NOTHING,
|
||||
area: Rect::NOTHING,
|
||||
rect: Rect::NOTHING,
|
||||
}));
|
||||
let mut fixture = fixture(&scene);
|
||||
fixture.settle();
|
||||
let first = seen(&scene);
|
||||
assert!(first.rect.is_positive(), "the bar shows: {:?}", first.rect);
|
||||
assert!(centred_under_anchor(&first), "centred below the anchor {:?}: {:?}", first.bounds, first.rect);
|
||||
assert!(inside_area(&first), "inside the canvas {:?}: {:?}", first.area, first.rect);
|
||||
|
||||
scene.borrow_mut().anchor = frame(DocVec::new(40.0, 30.0));
|
||||
fixture.settle();
|
||||
let followed = seen(&scene);
|
||||
assert!(centred_under_anchor(&followed), "the bar follows the anchor {:?}: {:?}", followed.bounds, followed.rect);
|
||||
assert!(followed.rect.center().x > first.rect.center().x, "it moved with the anchor");
|
||||
|
||||
// A press on the grip that does not drag leaves the bar on its anchor.
|
||||
let grip = fixture.by_label("Move bar").expect("the grip is named");
|
||||
fixture.click(&grip).settle();
|
||||
assert_eq!(seen(&scene).place, TaskBarPlace::default(), "a click moves nothing");
|
||||
|
||||
let by = Vec2::new(-120.0, 60.0);
|
||||
fixture.drag(&grip, by).settle();
|
||||
let dropped = seen(&scene);
|
||||
assert!(dropped.place.at.is_some(), "the drag gave the bar a place");
|
||||
assert!((dropped.rect.min - (followed.rect.min + by)).length() < 2.0 * SLACK, "the bar stays where it was dropped: {:?}", dropped.rect);
|
||||
|
||||
scene.borrow_mut().anchor = frame(DocVec::new(90.0, 10.0));
|
||||
fixture.settle();
|
||||
let kept = seen(&scene);
|
||||
assert!((kept.rect.min - dropped.rect.min).length() < SLACK, "a moved bar keeps its left edge while the anchor moves: {:?}", kept.rect);
|
||||
|
||||
pick(&mut fixture, "Reset bar position");
|
||||
let reset = seen(&scene);
|
||||
assert_eq!(reset.place, TaskBarPlace::default(), "Reset clears the place");
|
||||
assert!(centred_under_anchor(&reset), "the bar follows its anchor again {:?}: {:?}", reset.bounds, reset.rect);
|
||||
|
||||
pick(&mut fixture, "Pin bar position");
|
||||
let pinned = seen(&scene);
|
||||
assert!(pinned.place.pinned && pinned.place.at.is_some(), "Pin keeps the place: {:?}", pinned.place);
|
||||
scene.borrow_mut().anchor = frame(DocVec::new(-60.0, -40.0));
|
||||
fixture.settle();
|
||||
assert!((seen(&scene).rect.min - pinned.rect.min).length() < SLACK, "a pinned bar stays while the anchor moves");
|
||||
|
||||
scene.borrow_mut().place = TaskBarPlace { pinned: false, at: Some([f32::NAN, 0.0]) };
|
||||
fixture.settle();
|
||||
let unset = seen(&scene);
|
||||
assert!(centred_under_anchor(&unset), "a non-finite place counts as unset: {:?}", unset.rect);
|
||||
|
||||
scene.borrow_mut().place = TaskBarPlace { pinned: false, at: Some([1.0e30, -1.0e30]) };
|
||||
fixture.settle();
|
||||
let far = seen(&scene);
|
||||
assert!(inside_area(&far), "a place far outside comes back inside {:?}: {:?}", far.area, far.rect);
|
||||
}
|
||||
@@ -11,7 +11,7 @@ Each folder holds only the files `icons.toml` lists, unchanged from the pinned s
|
||||
|
||||
Carbon's licence file is the repository's root `LICENSE` (the icons package has none of its own).
|
||||
|
||||
Every set folder's files come from the npm package of the version in the table (`@phosphor-icons/core` 2.0.8, `lucide-static` 1.63.0, `@carbon/icons` 11.91.0, `@tabler/icons` 3.50.0), the same releases as the tags above. Phosphor files are `regular` weight, except `star-filled.svg` and `circle-filled.svg`, which are Phosphor's `fill` weight (`star-fill.svg`, `circle-fill.svg`), and `panel-right.svg`, which is Phosphor's `sidebar-simple` mirrored.
|
||||
Every set folder's files come from the npm package of the version in the table (`@phosphor-icons/core` 2.0.8, `lucide-static` 1.63.0, `@carbon/icons` 11.91.0, `@tabler/icons` 3.50.0), the same releases as the tags above. Phosphor files are `regular` weight, except `star-filled.svg` and `circle-filled.svg`, which are Phosphor's `fill` weight (`star-fill.svg`, `circle-fill.svg`). `panel-left.svg` is Phosphor's `sidebar-simple` unchanged, and `panel-right.svg` is the same glyph mirrored.
|
||||
|
||||
`phosphor/` also holds drawings made for the suite, for glyphs the pinned Phosphor release lacks. They follow Phosphor's regular style (256 view box, 16-unit round-capped strokes, some converted to filled outlines), take their shapes from PhotoCraft's glyphs, and carry the suite's own licence:
|
||||
|
||||
@@ -23,3 +23,4 @@ Every set folder's files come from the npm package of the version in the table (
|
||||
- `sync-lock`, `mark-in`, `mark-out`, `insert-clip`, `overwrite-clip`, `lift-clip`, `extract-clip` (the timeline's lock and edit glyphs, after Premiere Pro's), `keyframe-linear`, `keyframe-bezier`, `keyframe-auto-bezier`, `keyframe-hold`, `keyframe-ease-in`, `keyframe-ease-out` (keyframe nodes after After Effects' shapes: diamond, square for Bezier, circle for Auto Bezier)
|
||||
- `key-linear`, `key-linear-filled`, `key-hold`, `key-bezier`, `key-auto-bezier`, `key-continuous-bezier`, `key-ease-in`, `key-ease-out`, `keyframe-easy-ease` (the timeline's single keyframe marks and the graph editor's Easy Ease button, after FilmCraft's diamond, square and circle and After Effects' keys; solid shapes except the outline diamond and the rings)
|
||||
- `font-variable`, `scaling`, `slice-select`, `square-dashed-mouse-pointer`, `text-warp`, `triangle-right`, `type-mask`, `type-mask-vertical`
|
||||
- `crop-overlay-*` (the crop overlay menu's glyphs), `text-align-top`, `text-align-middle`, `text-align-bottom` (the vertical type options), `dash-align-exact`, `dash-align-corners` (the dash alignment options)
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path d="M10 6H14V10H10z"/><path d="M18 6H22V10H18z"/><path d="M10 14H14V18H10z"/><path d="M18 14H22V18H18z"/><path d="M10 22H14V26H10z"/><path d="M18 22H22V26H18z"/></svg>
|
||||
|
After Width: | Height: | Size: 232 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path d="M28,4H4A2,2,0,0,0,2,6V26a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V6A2,2,0,0,0,28,4ZM4,6h6V26H4ZM28,26H12V6H28Z"/></svg>
|
||||
|
After Width: | Height: | Size: 178 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path d="M28.59,13.31,30,11.9,20,2,18.69,3.42,19.87,4.6,8.38,14.32,6.66,12.61,5.25,14l5.66,5.68L2,28.58,3.41,30l8.91-8.91L18,26.75l1.39-1.42-1.71-1.71L27.4,12.13ZM16.26,22.2,9.8,15.74,21.29,6,26,10.71Z"/></svg>
|
||||
|
After Width: | Height: | Size: 270 B |
@@ -30,8 +30,10 @@ kind = "fill"
|
||||
base = true
|
||||
drawing_stroke_width = 16.0
|
||||
stroke_drawings = [
|
||||
"adjustment-layer", "bandage-sparkle", "brush-replace", "clip-below", "clip-release", "convert-point", "dash-align-corners",
|
||||
"dash-align-exact", "direct-select", "distribute-bottom", "distribute-hcenter", "distribute-horizontal", "distribute-left",
|
||||
"adjustment-layer", "bandage-sparkle", "brush-replace", "clip-below", "clip-release", "convert-point",
|
||||
"crop-overlay-diagonal", "crop-overlay-golden-ratio", "crop-overlay-golden-spiral", "crop-overlay-grid",
|
||||
"crop-overlay-thirds", "crop-overlay-triangle", "dash-align-corners", "dash-align-exact",
|
||||
"direct-select", "distribute-bottom", "distribute-hcenter", "distribute-horizontal", "distribute-left",
|
||||
"distribute-right", "distribute-top", "distribute-vcenter", "distribute-vertical", "eraser-background",
|
||||
"eraser-magic", "extract-clip", "font-similar", "fx", "gradient-angle", "gradient-diamond", "gradient-linear",
|
||||
"gradient-radial", "gradient-reflected", "insert-clip", "key-auto-bezier", "key-bezier", "key-continuous-bezier",
|
||||
@@ -42,7 +44,8 @@ stroke_drawings = [
|
||||
"pen-curvature", "pen-delete-anchor", "pen-freeform", "quick-selection", "route-curved", "route-elbow",
|
||||
"route-straight", "stroke-align-center", "stroke-align-inside", "stroke-align-outside", "stroke-cap-butt",
|
||||
"stroke-cap-round", "stroke-cap-square", "stroke-join-bevel", "stroke-join-miter", "stroke-join-round",
|
||||
"symmetry-diagonal", "symmetry-dual", "symmetry-horizontal", "symmetry-vertical", "sync-lock"
|
||||
"symmetry-diagonal", "symmetry-dual", "symmetry-horizontal", "symmetry-vertical", "sync-lock",
|
||||
"text-align-bottom", "text-align-middle", "text-align-top"
|
||||
]
|
||||
|
||||
[[set]]
|
||||
@@ -666,6 +669,52 @@ phosphor = "crop"
|
||||
carbon = "crop"
|
||||
tabler = "crop"
|
||||
|
||||
[[icon]]
|
||||
name = "crop_overlay_thirds"
|
||||
directional = false
|
||||
phosphor = "crop-overlay-thirds" # drawn in Phosphor's style: no match in any set
|
||||
|
||||
[[icon]]
|
||||
name = "crop_overlay_grid"
|
||||
directional = false
|
||||
phosphor = "crop-overlay-grid" # drawn in Phosphor's style: no match in any set
|
||||
|
||||
[[icon]]
|
||||
name = "crop_overlay_diagonal"
|
||||
directional = false
|
||||
phosphor = "crop-overlay-diagonal" # drawn in Phosphor's style: no match in any set
|
||||
|
||||
[[icon]]
|
||||
name = "crop_overlay_triangle"
|
||||
directional = false
|
||||
phosphor = "crop-overlay-triangle" # drawn in Phosphor's style: no match in any set
|
||||
|
||||
[[icon]]
|
||||
name = "crop_overlay_golden_ratio"
|
||||
directional = false
|
||||
phosphor = "crop-overlay-golden-ratio" # drawn in Phosphor's style: no match in any set
|
||||
|
||||
[[icon]]
|
||||
name = "crop_overlay_golden_spiral"
|
||||
directional = false
|
||||
phosphor = "crop-overlay-golden-spiral" # drawn in Phosphor's style: no match in any set
|
||||
|
||||
[[icon]]
|
||||
name = "pin"
|
||||
directional = false
|
||||
lucide = "pin"
|
||||
phosphor = "push-pin"
|
||||
carbon = "pin"
|
||||
tabler = "pin"
|
||||
|
||||
[[icon]]
|
||||
name = "grip"
|
||||
directional = false
|
||||
lucide = "grip-vertical"
|
||||
phosphor = "dots-six-vertical"
|
||||
carbon = "draggable"
|
||||
tabler = "grip-vertical"
|
||||
|
||||
[[icon]]
|
||||
name = "diamond"
|
||||
directional = false
|
||||
@@ -1042,6 +1091,14 @@ phosphor = "panel-right"
|
||||
carbon = "open-panel--right"
|
||||
tabler = "layout-sidebar-right"
|
||||
|
||||
[[icon]]
|
||||
name = "panel_left"
|
||||
directional = false
|
||||
lucide = "panel-left"
|
||||
phosphor = "panel-left"
|
||||
carbon = "open-panel--left"
|
||||
tabler = "layout-sidebar"
|
||||
|
||||
[[icon]]
|
||||
name = "pen_add_anchor"
|
||||
directional = false
|
||||
@@ -1440,6 +1497,21 @@ lucide = "case-sensitive"
|
||||
phosphor = "text-t" # near: no capitals mark in Phosphor
|
||||
tabler = "letter-case"
|
||||
|
||||
[[icon]]
|
||||
name = "text_align_top"
|
||||
directional = false
|
||||
phosphor = "text-align-top" # drawn in Phosphor's style: no match in any set
|
||||
|
||||
[[icon]]
|
||||
name = "text_align_middle"
|
||||
directional = false
|
||||
phosphor = "text-align-middle" # drawn in Phosphor's style: no match in any set
|
||||
|
||||
[[icon]]
|
||||
name = "text_align_bottom"
|
||||
directional = false
|
||||
phosphor = "text-align-bottom" # drawn in Phosphor's style: no match in any set
|
||||
|
||||
[[icon]]
|
||||
name = "ligature"
|
||||
directional = false
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
<!-- @license lucide-static v1.63.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-grip-vertical"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<circle cx="9" cy="12" r="1" />
|
||||
<circle cx="9" cy="5" r="1" />
|
||||
<circle cx="9" cy="19" r="1" />
|
||||
<circle cx="15" cy="12" r="1" />
|
||||
<circle cx="15" cy="5" r="1" />
|
||||
<circle cx="15" cy="19" r="1" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 497 B |
@@ -0,0 +1,16 @@
|
||||
<!-- @license lucide-static v1.63.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-panel-left"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<rect width="18" height="18" x="3" y="3" rx="2" />
|
||||
<path d="M9 3v18" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 365 B |
@@ -0,0 +1,16 @@
|
||||
<!-- @license lucide-static v1.63.0 - ISC -->
|
||||
<svg
|
||||
class="lucide lucide-pin"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="M12 17v5" />
|
||||
<path d="M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 524 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256"><g transform="scale(10.6667)" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M5 5H19V19H5Z"/><path d="M9.67 2.8V5M14.33 2.8V5M9.67 19v2.2M14.33 19v2.2M2.8 9.67H5M2.8 14.33H5M19 9.67h2.2M19 14.33h2.2"/><path d="M5 5L19 19M19 5L5 19"/></g></svg>
|
||||
|
After Width: | Height: | Size: 368 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256"><g transform="scale(10.6667)" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M5 5H19V19H5Z"/><path d="M9.67 2.8V5M14.33 2.8V5M9.67 19v2.2M14.33 19v2.2M2.8 9.67H5M2.8 14.33H5M19 9.67h2.2M19 14.33h2.2"/><path d="M10.35 5V19M13.65 5V19M5 10.35H19M5 13.65H19"/></g></svg>
|
||||
|
After Width: | Height: | Size: 392 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256"><g transform="scale(10.6667)" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M5 5H19V19H5Z"/><path d="M9.67 2.8V5M14.33 2.8V5M9.67 19v2.2M14.33 19v2.2M2.8 9.67H5M2.8 14.33H5M19 9.67h2.2M19 14.33h2.2"/><path d="M15.31 10.14L15.33 10.26L15.33 10.38L15.30 10.52L15.23 10.65L15.14 10.77L15.01 10.87L14.85 10.96L14.67 11.00L14.46 11.01L14.25 10.98L14.04 10.89L13.83 10.75L13.65 10.56L13.51 10.32L13.41 10.04L13.37 9.72L13.40 9.38L13.52 9.03L13.71 8.70L13.99 8.39L14.35 8.13L14.79 7.94L15.29 7.85L15.83 7.86L16.39 8.00L16.95 8.27L17.46 8.68L17.91 9.22L18.25 9.89L18.46 10.67L18.50 11.52L18.35 12.42L17.98 13.33L17.40 14.19L16.59 14.96L15.57 15.58L14.37 15.99L13.03 16.15L11.58 16.01L10.11 15.54L8.68 14.71L7.38 13.52L6.29 11.99L5.50 10.14"/></g></svg>
|
||||
|
After Width: | Height: | Size: 870 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256"><g transform="scale(10.6667)" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M5 5H19V19H5Z"/><path d="M9.67 2.8V5M14.33 2.8V5M9.67 19v2.2M14.33 19v2.2M2.8 9.67H5M2.8 14.33H5M19 9.67h2.2M19 14.33h2.2"/><path d="M8.5 5V19M12 5V19M15.5 5V19M5 8.5H19M5 12H19M5 15.5H19"/></g></svg>
|
||||
|
After Width: | Height: | Size: 402 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256"><g transform="scale(10.6667)" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M5 5H19V19H5Z"/><path d="M9.67 2.8V5M14.33 2.8V5M9.67 19v2.2M14.33 19v2.2M2.8 9.67H5M2.8 14.33H5M19 9.67h2.2M19 14.33h2.2"/><path d="M9.67 5V19M14.33 5V19M5 9.67H19M5 14.33H19"/></g></svg>
|
||||
|
After Width: | Height: | Size: 390 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256"><g transform="scale(10.6667)" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M5 5H19V19H5Z"/><path d="M9.67 2.8V5M14.33 2.8V5M9.67 19v2.2M14.33 19v2.2M2.8 9.67H5M2.8 14.33H5M19 9.67h2.2M19 14.33h2.2"/><path d="M5 5L19 19M5 19L12 12"/></g></svg>
|
||||
|
After Width: | Height: | Size: 369 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M104,60A12,12,0,1,1,92,48,12,12,0,0,1,104,60Zm60,12a12,12,0,1,0-12-12A12,12,0,0,0,164,72ZM92,116a12,12,0,1,0,12,12A12,12,0,0,0,92,116Zm72,0a12,12,0,1,0,12,12A12,12,0,0,0,164,116ZM92,184a12,12,0,1,0,12,12A12,12,0,0,0,92,184Zm72,0a12,12,0,1,0,12,12A12,12,0,0,0,164,184Z"/></svg>
|
||||
|
After Width: | Height: | Size: 367 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM40,56H80V200H40ZM216,200H96V56H216V200Z"/></svg>
|
||||
|
After Width: | Height: | Size: 235 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M235.32,81.37,174.63,20.69a16,16,0,0,0-22.63,0L98.37,74.49c-10.66-3.34-35-7.37-60.4,13.14a16,16,0,0,0-1.29,23.78L85,159.71,42.34,202.34a8,8,0,0,0,11.32,11.32L96.29,171l48.29,48.29A16,16,0,0,0,155.9,224c.38,0,.75,0,1.13,0a15.93,15.93,0,0,0,11.64-6.33c19.64-26.1,17.75-47.32,13.19-60L235.33,104A16,16,0,0,0,235.32,81.37ZM224,92.69h0l-57.27,57.46a8,8,0,0,0-1.49,9.22c9.46,18.93-1.8,38.59-9.34,48.62L48,100.08c12.08-9.74,23.64-12.31,32.48-12.31A40.13,40.13,0,0,1,96.81,91a8,8,0,0,0,9.25-1.51L163.32,32,224,92.68Z"/></svg>
|
||||
|
After Width: | Height: | Size: 608 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256"><g transform="scale(10.6667)" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M3 20h18"/><path d="M17 4v12"/><path d="M12 10v6"/><path d="M7 7v9"/></g></svg>
|
||||
|
After Width: | Height: | Size: 281 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256"><g transform="scale(10.6667)" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M3 12h18"/><path d="M17 6v12"/><path d="M12 9v6"/><path d="M7 7v10"/></g></svg>
|
||||
|
After Width: | Height: | Size: 281 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256"><g transform="scale(10.6667)" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M3 4h18"/><path d="M17 8v12"/><path d="M12 8v6"/><path d="M7 8v9"/></g></svg>
|
||||
|
After Width: | Height: | Size: 279 B |
@@ -0,0 +1,20 @@
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
class="icon icon-tabler icons-tabler-outline icon-tabler-grip-vertical"
|
||||
>
|
||||
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
|
||||
<path d="M8 5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" />
|
||||
<path d="M8 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" />
|
||||
<path d="M8 19a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" />
|
||||
<path d="M14 5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" />
|
||||
<path d="M14 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" />
|
||||
<path d="M14 19a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 637 B |
@@ -0,0 +1,16 @@
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
class="icon icon-tabler icons-tabler-outline icon-tabler-layout-sidebar"
|
||||
>
|
||||
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
|
||||
<path d="M4 6a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2l0 -12" />
|
||||
<path d="M9 4l0 16" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 458 B |
@@ -0,0 +1,17 @@
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
class="icon icon-tabler icons-tabler-outline icon-tabler-pin"
|
||||
>
|
||||
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
|
||||
<path d="M15 4.5l-4 4l-4 1.5l-1.5 1.5l7 7l1.5 -1.5l1.5 -4l4 -4" />
|
||||
<path d="M9 15l-4.5 4.5" />
|
||||
<path d="M14.5 4l5.5 5.5" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 456 B |
@@ -28,7 +28,8 @@ impl Placement {
|
||||
|
||||
/// The placement the caller of `overlay` gives, when it places the layer.
|
||||
fn given(overlay: &crate::contract::Overlay) -> Option<Placement> {
|
||||
overlay.placed.map(Placement::at).or_else(|| overlay.placed_at.map(Placement::at_pos))
|
||||
let kept = |rect: Rect| overlay.bounds.map_or(rect, |bounds| super::window::keep_inside(rect, bounds));
|
||||
overlay.placed.map(|rect| Placement::at(kept(rect))).or_else(|| overlay.placed_at.map(Placement::at_pos))
|
||||
}
|
||||
|
||||
/// The rect it names, taking the position and size it lacks from `rect`.
|
||||
@@ -43,8 +44,9 @@ pub(crate) fn placement_id(id: Id) -> Id {
|
||||
|
||||
/// The one store of a layer's placement: the saved tier when `save` is set, else shown memory. A layer whose overlay
|
||||
/// is `placed` has the caller's rect instead: the slot reads it and writes nothing, since the caller owns the
|
||||
/// placement and learns of the user's changes from `PlacementChange` reports. A layer hung from its anchor that the
|
||||
/// user cannot move keeps only its size: each opening places it from its anchor at that size.
|
||||
/// placement and learns of the user's changes from `PlacementChange` reports. A layer hung from its anchor keeps only
|
||||
/// its size, whether or not the user can move it: each opening places it from its anchor at that size, and a caller
|
||||
/// that keeps a moved layer where it was dropped places it (`placed_at`) from the change it was told of.
|
||||
pub(super) struct PlacementSlot<'s> {
|
||||
stage: &'s mut MemoryStage,
|
||||
id: Id,
|
||||
@@ -55,7 +57,7 @@ pub(super) struct PlacementSlot<'s> {
|
||||
|
||||
impl<'s> PlacementSlot<'s> {
|
||||
pub(super) fn new(stage: &'s mut MemoryStage, id: Id, save: Option<&'s SaveKey>, overlay: &crate::contract::Overlay) -> Self {
|
||||
let anchored = matches!(overlay.place, Place::Anchored { .. }) && !overlay.movable;
|
||||
let anchored = matches!(overlay.place, Place::Anchored { .. });
|
||||
PlacementSlot { stage, id, save, controlled: Placement::given(overlay), anchored }
|
||||
}
|
||||
|
||||
@@ -115,8 +117,10 @@ pub(crate) fn shown_placement(
|
||||
let room = (screen.size() - Vec2::splat(2.0 * screen_inset)).max(Vec2::ZERO);
|
||||
let least = overlay.size_limits.min.min(room);
|
||||
let size = default.max(least).min(overlay.size_limits.max.unwrap_or(Vec2::INFINITY)).min(room);
|
||||
let pos = placement.pos.map(Pos2::from).or(float.pos).unwrap_or_else(|| screen.center() - size / 2.0);
|
||||
let pos = Pos2::new(pos.x.min(screen.right() - size.x).max(screen.left()), pos.y.min(screen.bottom() - size.y).max(screen.top()));
|
||||
// The layer centres, and is kept, inside the screen cut to `bounds`; bounds that miss the screen leave it whole.
|
||||
let region = overlay.bounds.map(|bounds| screen.intersect(bounds)).filter(|region| region.is_positive()).unwrap_or(screen);
|
||||
let pos = placement.pos.map(Pos2::from).or(float.pos).unwrap_or_else(|| region.center() - size / 2.0);
|
||||
let pos = super::window::keep_inside(Rect::from_min_size(pos, size), region).min;
|
||||
placement.pos = Some(pos.into());
|
||||
placement.size = Some(size.into());
|
||||
placement
|
||||
@@ -140,7 +144,7 @@ pub(super) fn measure_layer(props: &ContainerProps, id: Id, ui: &Ui) -> areas::L
|
||||
areas::layer_of(crate::runtime::overlay::layer_tier(ui.ctx(), overlay.rank), area)
|
||||
}
|
||||
Mount::FullWindow => {
|
||||
areas::layer_of(crate::runtime::overlay::layer_tier(ui.ctx(), crate::contract::mount::full_window_overlay(props.focus).rank), area)
|
||||
areas::layer_of(crate::runtime::overlay::layer_tier(ui.ctx(), crate::contract::Overlay::full_window(props.focus).rank), area)
|
||||
}
|
||||
_ => ui.layer_id(),
|
||||
}
|
||||
|
||||
@@ -9,9 +9,12 @@ use super::level::Surface::{self, Canvas, Chrome, Own};
|
||||
|
||||
/// `(crate target, type name, surface)`, sorted by crate target and name.
|
||||
pub(super) const SURFACES: &[(&str, &str, Surface)] = &[
|
||||
("craft_color", "ColorHud", Canvas),
|
||||
("craft_color", "ColorSamplerMarks", Canvas),
|
||||
("craft_color", "EyedropperBar", Chrome),
|
||||
("craft_color", "SampleSizeSelect", Chrome),
|
||||
("craft_draw", "AddBesideHandles", Canvas),
|
||||
("craft_draw", "ArrowheadsPopover", Chrome),
|
||||
("craft_draw", "ArtboardOverlay", Canvas),
|
||||
("craft_draw", "BezierOverlay", Canvas),
|
||||
("craft_draw", "ConnectorHandles", Canvas),
|
||||
@@ -19,20 +22,28 @@ pub(super) const SURFACES: &[(&str, &str, Surface)] = &[
|
||||
("craft_draw", "CropBar", Chrome),
|
||||
("craft_draw", "CropOptionsMenu", Chrome),
|
||||
("craft_draw", "CropOverlayMenu", Chrome),
|
||||
("craft_draw", "CropPresetList", Chrome),
|
||||
("craft_draw", "GradientOverlay", Canvas),
|
||||
("craft_draw", "PaintBar", Chrome),
|
||||
("craft_draw", "PathOptionsPopover", Canvas),
|
||||
("craft_draw", "PerspectiveCropBar", Chrome),
|
||||
("craft_draw", "PerspectiveCropQuad", Canvas),
|
||||
("craft_draw", "RulerOverlay", Canvas),
|
||||
("craft_draw", "ShapeMenu", Chrome),
|
||||
("craft_draw", "SliceOverlay", Canvas),
|
||||
("craft_draw", "StrokeCells", Chrome),
|
||||
("craft_draw", "SymmetryHandles", Canvas),
|
||||
("craft_draw", "SymmetryOverlay", Canvas),
|
||||
("craft_draw", "TransformBox", Canvas),
|
||||
("craft_draw", "TransformFields", Chrome),
|
||||
("craft_draw", "TransformOverlay", Canvas),
|
||||
("craft_draw", "VectorModeSelect", Chrome),
|
||||
("craft_imaging", "BlurPinsOverlay", Canvas),
|
||||
("craft_imaging", "ClippingOverlay", Canvas),
|
||||
("craft_imaging", "ColorRangeDialog", Own),
|
||||
("craft_imaging", "ConstraintLines", Canvas),
|
||||
("craft_imaging", "ContentAwareFillWorkspace", Canvas),
|
||||
("craft_imaging", "CylinderWarp", Canvas),
|
||||
("craft_imaging", "FillBar", Chrome),
|
||||
("craft_imaging", "FilterGalleryWorkspace", Own),
|
||||
("craft_imaging", "LassoLine", Canvas),
|
||||
@@ -42,6 +53,7 @@ pub(super) const SURFACES: &[(&str, &str, Surface)] = &[
|
||||
("craft_imaging", "OutlineTrace", Canvas),
|
||||
("craft_imaging", "PerspectiveWarp", Canvas),
|
||||
("craft_imaging", "PinWarp", Canvas),
|
||||
("craft_imaging", "RawDevelopWorkspace", Own),
|
||||
("craft_imaging", "SelectMaskBar", Chrome),
|
||||
("craft_imaging", "SelectMaskWorkspace", Canvas),
|
||||
("craft_imaging", "SelectionOverlay", Canvas),
|
||||
@@ -58,10 +70,13 @@ pub(super) const SURFACES: &[(&str, &str, Surface)] = &[
|
||||
("craft_pages", "PagePictures", Canvas),
|
||||
("craft_pages", "TextFrameMarks", Canvas),
|
||||
("craft_pages", "TextMarks", Canvas),
|
||||
("craft_print", "PrintDialog", Own),
|
||||
("craft_review", "AnnotationOverlay", Canvas),
|
||||
("craft_review", "CommentPins", Canvas),
|
||||
("craft_review", "RemoteCursor", Canvas),
|
||||
("craft_review", "RemoteCursors", Canvas),
|
||||
("craft_text", "PathTextMarkers", Canvas),
|
||||
("craft_text", "TypeBar", Chrome),
|
||||
("craft_ui", "AboutDialog", Own),
|
||||
("craft_ui", "Alert", Own),
|
||||
("craft_ui", "AppShell", Own),
|
||||
@@ -107,6 +122,7 @@ pub(super) const SURFACES: &[(&str, &str, Surface)] = &[
|
||||
("craft_ui", "NavigatorZoomRow", Canvas),
|
||||
("craft_ui", "NewGuideDialog", Own),
|
||||
("craft_ui", "NoticeCenter", Canvas),
|
||||
("craft_ui", "OpeningCard", Own),
|
||||
("craft_ui", "PaneArea", Own),
|
||||
("craft_ui", "PaneFrame", Own),
|
||||
("craft_ui", "Panel", Own),
|
||||
@@ -116,6 +132,7 @@ pub(super) const SURFACES: &[(&str, &str, Surface)] = &[
|
||||
("craft_ui", "PasswordDialog", Own),
|
||||
("craft_ui", "Pasteboard", Canvas),
|
||||
("craft_ui", "PixelGrid", Canvas),
|
||||
("craft_ui", "PresetManager", Own),
|
||||
("craft_ui", "PreviewPane", Own),
|
||||
("craft_ui", "PreviewZoom", Own),
|
||||
("craft_ui", "Prompt", Own),
|
||||
@@ -125,9 +142,11 @@ pub(super) const SURFACES: &[(&str, &str, Surface)] = &[
|
||||
("craft_ui", "ReportDialog", Own),
|
||||
("craft_ui", "RotateView", Canvas),
|
||||
("craft_ui", "Rulers", Canvas),
|
||||
("craft_ui", "ScreenModeButton", Chrome),
|
||||
("craft_ui", "SelectionOutline", Canvas),
|
||||
("craft_ui", "ShellRegion", Own),
|
||||
("craft_ui", "SmartGuides", Canvas),
|
||||
("craft_ui", "SourceMarker", Canvas),
|
||||
("craft_ui", "SplitArea", Own),
|
||||
("craft_ui", "SplitViews", Canvas),
|
||||
("craft_ui", "Splitter", Own),
|
||||
@@ -136,6 +155,8 @@ pub(super) const SURFACES: &[(&str, &str, Surface)] = &[
|
||||
("craft_ui", "StartScreen", Own),
|
||||
("craft_ui", "StatusReadout", Chrome),
|
||||
("craft_ui", "StraightLinePreview", Canvas),
|
||||
("craft_ui", "StrokeTrail", Canvas),
|
||||
("craft_ui", "TaskBar", Canvas),
|
||||
("craft_ui", "TipCell", Canvas),
|
||||
("craft_ui", "TitleBar", Chrome),
|
||||
("craft_ui", "ToolRail", Chrome),
|
||||
|
||||