mirror of
https://github.com/storytold/figcraft.git
synced 2026-10-29 21:06:50 -06:00
docs(ui): document the right-click label pick and its tests
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015wxxFg3gana4zaUKnyirTC
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
df6062d7fb
commit
38ab0eaa6b
@@ -243,7 +243,9 @@ fn send(app: &mut FigApp, kind: PointerKind, pos: Pos2, m: &egui::Modifiers) {
|
||||
}
|
||||
|
||||
/// Right-click at screen `pos`: select what's under the pointer (`deep`: the nested layer), then
|
||||
/// open the context menu there.
|
||||
/// open the context menu there. A frame's name label counts as the frame, as on a press, so a
|
||||
/// label drawn over its section picks the frame, not the section behind it. A layer that is
|
||||
/// already selected keeps the whole selection.
|
||||
pub fn open_context_menu(app: &mut FigApp, pos: Pos2, deep: bool) {
|
||||
let p = app.to_page(pos);
|
||||
if let Ok(ds) = app.session.ds() {
|
||||
|
||||
@@ -85,10 +85,10 @@ fn copying_a_link_with_nothing_selected_copies_nothing() {
|
||||
assert!(u.app.ui.toast.is_none());
|
||||
}
|
||||
|
||||
/// With a section selected, a right-click on either frame inside it links that frame, not the
|
||||
/// section that was selected before.
|
||||
#[test]
|
||||
fn copying_a_link_on_a_frame_inside_a_selected_section_links_that_frame() {
|
||||
// The section holds both frames; right-clicking each one must link that frame, not the section
|
||||
// that was selected before.
|
||||
let mut s = Session::new();
|
||||
let sec = id(&s.execute("node.create", &json!({"type": "section", "x": 0, "y": 0, "width": 800, "height": 400, "name": "Flow"})).unwrap());
|
||||
let a = id(&s.execute("frame.create", &json!({"x": 20, "y": 60, "width": 300, "height": 200, "name": "main", "parent": sec})).unwrap());
|
||||
@@ -107,10 +107,10 @@ fn copying_a_link_on_a_frame_inside_a_selected_section_links_that_frame() {
|
||||
}
|
||||
}
|
||||
|
||||
/// A frame inside a section has its label above it, inside the section: a right-click there picks
|
||||
/// the frame whose label it is, not the section behind the label.
|
||||
#[test]
|
||||
fn copying_a_link_from_a_frames_name_label_links_that_frame() {
|
||||
// A frame inside a section has its label above it, inside the section: a right-click there
|
||||
// must pick the frame whose label it is, not the section behind the label.
|
||||
let mut s = Session::new();
|
||||
let sec = id(&s.execute("node.create", &json!({"type": "section", "x": 0, "y": 0, "width": 800, "height": 400, "name": "Flow"})).unwrap());
|
||||
let a = id(&s.execute("frame.create", &json!({"x": 20, "y": 80, "width": 300, "height": 200, "name": "main", "parent": sec})).unwrap());
|
||||
|
||||
Reference in New Issue
Block a user