Format merged follow-up changes

This commit is contained in:
Dylan M. Taylor
2026-11-20 05:49:24 -05:00
parent 7051995425
commit 43c6ca52f2
10 changed files with 37 additions and 20 deletions
+8 -1
View File
@@ -307,7 +307,14 @@ pub fn resolve_mapped<O: Copy>(shapes: &[Shape<O>], point: Pos2, what: ResolveFo
.then_with(|| distance(b).partial_cmp(&distance(a)).unwrap_or(Ordering::Equal))
.then(ia.cmp(ib))
})
.map(|(index, shape)| Winner { index, owner: shape.owner, part: shape.part, sense: shape.sense, local: shape.local, drag_to_root: shape.drag_to_root })
.map(|(index, shape)| Winner {
index,
owner: shape.owner,
part: shape.part,
sense: shape.sense,
local: shape.local,
drag_to_root: shape.drag_to_root,
})
}
#[cfg(test)]
+3 -1
View File
@@ -126,7 +126,9 @@ pub struct CommentMessage {
pub deletable: bool,
}
fn message_deletable() -> bool { true }
fn message_deletable() -> bool {
true
}
/// A comment and its replies.
#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)]
+4 -2
View File
@@ -497,8 +497,10 @@ struct NoteWindow {
impl NoteWindow {
fn new(label: Label, overlay: Overlay, look: NoteLook, close_label: Label, allowed: bool, anchor: Option<(Rect, bool)>, selected: bool) -> Self {
let props =
ContainerProps::new().mount(Mount::Layer(overlay)).surface(SurfaceKind::Floating).header(HeaderRegion::new().band(DragBand::Move).trailing(true));
let props = ContainerProps::new()
.mount(Mount::Layer(overlay))
.surface(SurfaceKind::Floating)
.header(HeaderRegion::new().band(DragBand::Move).trailing(true));
NoteWindow {
common: Common::new(),
props,
+6 -2
View File
@@ -27,7 +27,9 @@ fn a_locked_comment_still_offers_reply_actions() {
item.messages.push(message("Bo", "Reply"));
let mut state = CommentsPanelState::default();
state.selected = Selection::single(ThreadId(1));
let mut fixture = Fixture::new(move |ui| { let _ = CommentsPanel::new("Comments", std::slice::from_ref(&item), &mut state).show(ui); });
let mut fixture = Fixture::new(move |ui| {
let _ = CommentsPanel::new("Comments", std::slice::from_ref(&item), &mut state).show(ui);
});
fixture.settle();
let more = fixture.by_label("More").expect("the reply menu");
fixture.click(&more).settle();
@@ -40,7 +42,9 @@ fn a_locked_comment_still_offers_reply_actions() {
item.messages.push(reply);
let mut state = CommentsPanelState::default();
state.selected = Selection::single(ThreadId(2));
let mut fixture = Fixture::new(move |ui| { let _ = CommentsPanel::new("Comments", std::slice::from_ref(&item), &mut state).show(ui); });
let mut fixture = Fixture::new(move |ui| {
let _ = CommentsPanel::new("Comments", std::slice::from_ref(&item), &mut state).show(ui);
});
fixture.settle();
let menus = fixture.by_role(Role::BUTTON);
let reply_menu = menus.into_iter().filter(|target| fixture.tree().name_of(target.node) == Some("More")).last().expect("the reply menu");
+5 -7
View File
@@ -53,13 +53,11 @@ fn pad(draft: SignatureDraft) -> Rc<RefCell<Pad>> {
fn clearing_a_scan_does_not_let_the_scan_restore_the_image() {
let pad = pad(SignatureDraft { tab: SignatureTab::Scan, ..SignatureDraft::default() });
let mut pending = true;
pad.borrow_mut().dialog = SignaturePadDialog::new(SignatureDraft { tab: SignatureTab::Scan, ..SignatureDraft::default() })
.scan(move |_, draft, event| {
match event {
ScanEvent::Clear => pending = false,
ScanEvent::Show(_) if pending => draft.image = Some(SignatureImage::new(5, 1, PHOTO.to_vec())),
ScanEvent::Show(_) => {}
}
pad.borrow_mut().dialog =
SignaturePadDialog::new(SignatureDraft { tab: SignatureTab::Scan, ..SignatureDraft::default() }).scan(move |_, draft, event| match event {
ScanEvent::Clear => pending = false,
ScanEvent::Show(_) if pending => draft.image = Some(SignatureImage::new(5, 1, PHOTO.to_vec())),
ScanEvent::Show(_) => {}
});
let shown = pad.clone();
let mut fx = Fixture::new(move |ui| show(&shown, ui));
+2 -1
View File
@@ -320,7 +320,8 @@ fn rotate(state: &mut ArenaState, pass_nr: u64) {
}
fn own_part_shape(part: &PartDecl, root: Id, position: u32, target: f32) -> Shape<Id> {
let mut shape = Shape::new(part.shape.clone(), part.sense, root, Some(part.part_ref()), part.priority, position).stacking(part.stacking).min_across(target);
let mut shape =
Shape::new(part.shape.clone(), part.sense, root, Some(part.part_ref()), part.priority, position).stacking(part.stacking).min_across(target);
shape.drag_to_root = part.drag_to_root;
shape
}
+1 -1
View File
@@ -37,11 +37,11 @@ pub(crate) use intents::lent_taken;
pub use intents::settle;
#[doc(hidden)]
pub use intents::take_submit;
pub use intents::{with_canvas_window_intents, with_window_intents};
pub(crate) use intents::{
Lent, context_part, context_request, give_back, lend, request_context, route_whole_reset, scope_escape, take_cancel, take_every_escape,
take_window_cancel,
};
pub use intents::{with_canvas_window_intents, with_window_intents};
pub(crate) use nodes::{redirect_node, register_expanded, register_node};
pub use route::focus_holds;
pub(crate) use route::{activated_member, begin, focus_in_dialog, layout_of, owner_at, pasted, pasted_text, queue_edit, routed_to, take_shortcuts};
@@ -292,9 +292,8 @@ fn offer_window_intents(ctx: &Context, rtl: bool, take: impl FnOnce(&mut Intents
let focused = focus::focused_rec(ctx).map(|rec| rec.stop.id);
let mut window = intents_of(ctx, None, rtl);
// The focused stop's leftover Escape stays in its slot until taken.
let lent_cancel = focused
.filter(|id| !window.items.iter().any(|(item, _)| *item == Intent::Cancel) && holds(ctx, Some(*id), &Intent::Cancel))
.map(|id| {
let lent_cancel =
focused.filter(|id| !window.items.iter().any(|(item, _)| *item == Intent::Cancel) && holds(ctx, Some(*id), &Intent::Cancel)).map(|id| {
window.items.push((Intent::Cancel, false));
(id, window.items.len() - 1)
});
+2 -1
View File
@@ -790,7 +790,8 @@ fn find_under(ctx: &Context, viewport: ViewportId, at: Pos2, targets: PressTarge
.copied()
.filter(|&index| {
let shape = &entry.shapes[index];
index != winner.index && shape.sense.contains(craft_behavior::Sense::DRAG)
index != winner.index
&& shape.sense.contains(craft_behavior::Sense::DRAG)
&& (!winner.drag_to_root || (shape.owner == root && shape.part.is_none()))
})
.collect();
+4 -1
View File
@@ -494,7 +494,10 @@ fn insert<T: Clone>(mut out: Vec<ToolSlot<T>>, tool: RailTool<T>, at: DropAt) ->
}
DropAt::NewSlot { before } => {
let id = match out.iter().map(|slot| slot.id).max() {
Some(max) => match max.checked_add(1) { Some(id) => id, None => return original },
Some(max) => match max.checked_add(1) {
Some(id) => id,
None => return original,
},
None => 0,
};
out.insert(before.min(out.len()), ToolSlot::new(id, vec![tool]));