mirror of
https://github.com/storytold/figcraft.git
synced 2026-10-31 07:39:20 +00:00
M12: stamps stick to the objects they land on, which are highlighted first (#1671)
* M12: stamps stick to the objects they land on A stamp sticks to the topmost object under its centre (BoardItem::Stamp gains an optional on, left out when empty so older files open with stamps on nothing) and the board's normalize pass carries it when that object moves or turns, once when both move together. A stamp dragged onto another object sticks to that one, off everything to nothing; one whose object is deleted stays where it is. Gap 24. * M12: the object a stamp will stick to is highlighted While the stamp tool is over an object, or a stamp is dragged over one, the object it will stick to is outlined with the canvas's hover outline (Overlay::stamp_target, found by the same stamp_target as board.stamp and settle_stamps). A drag no longer drops what it moves into the auto layout of a sticky, shape with text or table: board objects take no drops; a stamp already inside its sticky moves with it once. Builds on #1671. Gap 24.
This commit is contained in:
1 parent
87f3edbc7e
commit
e97961ba66
18 files changed
+205
-8
No files matched your search
+3
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
**Stage: alpha** · next: beta, ~26 points and ~162–292 h away (one Opus 5.5 agent; ~33–67 h wall-clock with 5 agents)
|
||||
|
||||
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (a server can list the files shared from it now for everyone who reaches it, Home ▸ Online shows them and their links carry no secret (`team_files`, part of #742); team library analytics count detached instances per component and file (gap 10); skipping the Open link notice by command is saved with the preferences at once (gap 15); a selected connector's bar on a board sets its start and end points, solid or dashed, its weight and any colour (#1596); cells copied from a spreadsheet paste onto a board as a table; a long layer name stays on one line in the Export button and the Dev Mode header, ending with an ellipsis, and no longer covers the Design panel (#1650); with hundreds of layers selected, the Design panel and the selection overlays stop going over the whole selection on every frame, so dragging 648 layers averages about 1.1 ms of UI per frame (#1571); plugin panels show pictures: an `image` control, base64 within 256 KB and 4,096 px a side, named by its label (gap 6); `.fig` connector labels without a saved snapshot are kept, centred on their line (gap 1); a drag moving many layers re-runs only what sits around them, not each layer's bindings, sizing, text and instance checks, on every move (#1571); damaged font tracking table offsets are checked instead of wrapping on 32-bit targets, and font indexing makes its existing offset bounds explicit (#1125); Bosnian (`bs`) draft catalog; text style dedupe is O(spans) via a last-two cache and fingerprint buckets (#1102); pasted layers whose image the clipboard lacks are named and show a placeholder that reads as missing (#1646); paint-style colours on layers pasted from another design app keep their style instead of turning black (#1638); progress docs cleaned of what merges left twice: rows merged into one, repeated status items removed, and `cargo xtask docs` (in `ci`) fails on a repeated table row or status item; a name typed for a variable or collection finds the one with that exact id before one named like it, and stored mode ids, font family variables and the panels' labels read exact ids (#1613); plugin widgets have hover styles: a layer's `hover` fill, stroke, opacity or text colour shows while the pointer is over it (gap 6); `.fig` elbowed and curved connectors without a saved path are routed like board connectors instead of drawn straight (gap 1); every file a command reads whole by path is a regular file within a cap that fits it: documents 16 GiB, placed images 256 MiB, CLI scripts 1 GiB; `figcraft-cli connect publish` publishes a code repository's code connect mappings to a design file (gap 16); while a drag only moves a large selection, its outlines, box, slots, spacing and Design panel values are worked out once and shifted, not rebuilt on every move (#1571); Shift+Cmd/Ctrl+Enter on a selected board shape adds the next shape already joined to it, and goes on typing (#1597); an imported or pasted file finds an installed family under the other names its fonts give it, and with other case and spacing, instead of reporting it missing (#1292); a development example generates figcraft-cli's shell completions and man pages from its clap definitions (part of #1396); `.fig` ZIP image reads share a total byte budget and count skipped images in the import warnings (#1076); German terminology corrections (M10): gradient stops, OpenType stylistic sets and the Home-screen preference; a component set's property rows fit the 240 px right panel: variant values wrap two to a line there and every + and − stays in view; the server key is checked by comparing SHA-256 hashes of the presented and the kept key, as the deployment guide says (#1130); opening a file contacts no team library server it names until you check it (#1097); a hostile server can no longer grow a client's memory with made-up people, and a session remembers a bounded number of deleted layer ids (#1121); `doc.list` gives AI agents and plugins the open files' names, not their paths (#1117); with a large selection, frames where nothing changed reuse the selection's outlines, box and slots and the Design panel's instance and position values instead of working them out again (#1571); team libraries and plugins larger than the 16 MiB download burst can be downloaded again, more slowly (#1089); a batch keeps one undo snapshot, not one per step (#1099); files nested 256 levels deep import on the browser's 1 MB stack (#1101); SVG and PDF exports count pattern sources and the renders they embed from the layer's depth, so one cap bounds a whole export (#1082); an explicit variables file path (`variable.import`, the `variables` of `file.open` and `file.import`) is refused past 256 MiB or when it isn't a regular file, as the sibling `variables.json` already was (part of #1114); joining and leaving a file nobody is editing reads and writes nothing on the server: it stays loaded a minute after everyone leaves (#1074); opLine truncated
|
||||
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (the object a stamp will stick to is outlined while the stamp tool is over it or a stamp is dragged over it, and board objects take no drops (gap 24); a server can list the files shared from it now for everyone who reaches it, Home ▸ Online shows them and their links carry no secret (`team_files`, part of #742); team library analytics count detached instances per component and file (gap 10); skipping the Open link notice by command is saved with the preferences at once (gap 15); a selected connector's bar on a board sets its start and end points, solid or dashed, its weight and any colour (#1596); cells copied from a spreadsheet paste onto a board as a table; a long layer name stays on one line in the Export button and the Dev Mode header, ending with an ellipsis, and no longer covers the Design panel (#1650); with hundreds of layers selected, the Design panel and the selection overlays stop going over the whole selection on every frame, so dragging 648 layers averages about 1.1 ms of UI per frame (#1571); plugin panels show pictures: an `image` control, base64 within 256 KB and 4,096 px a side, named by its label (gap 6); `.fig` connector labels without a saved snapshot are kept, centred on their line (gap 1); a drag moving many layers re-runs only what sits around them, not each layer's bindings, sizing, text and instance checks, on every move (#1571); damaged font tracking table offsets are checked instead of wrapping on 32-bit targets, and font indexing makes its existing offset bounds explicit (#1125); Bosnian (`bs`) draft catalog; text style dedupe is O(spans) via a last-two cache and fingerprint buckets (#1102); pasted layers whose image the clipboard lacks are named and show a placeholder that reads as missing (#1646); paint-style colours on layers pasted from another design app keep their style instead of turning black (#1638); progress docs cleaned of what merges left twice: rows merged into one, repeated status items removed, and `cargo xtask docs` (in `ci`) fails on a repeated table row or status item; a name typed for a variable or collection finds the one with that exact id before one named like it, and stored mode ids, font family variables and the panels' labels read exact ids (#1613); plugin widgets have hover styles: a layer's `hover` fill, stroke, opacity or text colour shows while the pointer is over it (gap 6); `.fig` elbowed and curved connectors without a saved path are routed like board connectors instead of drawn straight (gap 1); every file a command reads whole by path is a regular file within a cap that fits it: documents 16 GiB, placed images 256 MiB, CLI scripts 1 GiB; `figcraft-cli connect publish` publishes a code repository's code connect mappings to a design file (gap 16); while a drag only moves a large selection, its outlines, box, slots, spacing and Design panel values are worked out once and shifted, not rebuilt on every move (#1571); Shift+Cmd/Ctrl+Enter on a selected board shape adds the next shape already joined to it, and goes on typing (#1597); an imported or pasted file finds an installed family under the other names its fonts give it, and with other case and spacing, instead of reporting it missing (#1292); a development example generates figcraft-cli's shell completions and man pages from its clap definitions (part of #1396); `.fig` ZIP image reads share a total byte budget and count skipped images in the import warnings (#1076); German terminology corrections (M10): gradient stops, OpenType stylistic sets and the Home-screen preference; a component set's property rows fit the 240 px right panel: variant values wrap two to a line there and every + and − stays in view; the server key is checked by comparing SHA-256 hashes of the presented and the kept key, as the deployment guide says (#1130); opening a file contacts no team library server it names until you check it (#1097); a hostile server can no longer grow a client's memory with made-up people, and a session remembers a bounded number of deleted layer ids (#1121); `doc.list` gives AI agents and plugins the open files' names, not their paths (#1117); with a large selection, frames where nothing changed reuse the selection's outlines, box and slots and the Design panel's instance and position values instead of working them out again (#1571); team libraries and plugins larger than the 16 MiB download burst can be downloaded again, more slowly (#1089); a batch keeps one undo snapshot, not one per step (#1099); files nested 256 levels deep import on the browser's 1 MB stack (#1101); SVG and PDF exports count pattern sources and the renders they embed from the layer's depth, so one cap bounds a whole export (#1082); an explicit variables file path (`variable.import`, the `variables` of `file.open` and `file.import`) is refused past 256 MiB or when it isn't a regular file, as the sibling `variables.json` already was (part of #Line truncated
|
||||
|
||||
FigCraft is a clean-room, open-source, pure-Rust reimplementation of the Figma design workflow,
|
||||
native on macOS, Windows, Linux and FreeBSD and in the browser, fully drivable by agents through
|
||||
@@ -358,6 +358,8 @@ Ranked; detail and milestones in [`docs/roadmap.md`](docs/roadmap.md).
|
||||
|
||||
| Date | Change | Summary |
|
||||
|---|---|---|
|
||||
| 2026-10-30 | minor | M12, gap 24: while the stamp tool is over an object, or a stamp is dragged over one, that object is outlined (the canvas's hover outline): the one the stamp will stick to, found by the same rule as `board.stamp` and `settle_stamps`. Found while checking it: a drag dropped what it moved into the auto layout of a sticky or shape with text under the pointer, so a stamp dragged onto a sticky became part of its layout; board objects (stickies, shapes with text, tables, stamps, labels) now take no drops, which go to what is under them, and a stamp already inside its sticky from such a drop moves with it once. Checked in the app. Numbers unchanged. Tests: `board_connect_tests::the_object_a_stamp_will_stick_to_is_highlighted`, `board_tests::stamps_stick_to_what_they_land_on`. |
|
||||
| 2026-10-30 | minor | M12, gap 24: a stamp sticks to the object it lands on (the topmost layer under its centre other than stamps, connectors, their labels and ink) and moves with it, as the incumbent's stamps do: `BoardItem::Stamp` keeps it in `on` (left out when empty, so older files open with their stamps on nothing), and the board's normalize pass carries a stamp along when its object moves or turns, once when both move together. A stamp dragged onto another object sticks to that one and off everything to nothing; one whose object is deleted stays where it is, on nothing. Undo and live sessions go with the edit that moved the object. Checked in the app (two stickies moved with their stamps). No highlight while a stamp hovers yet. Numbers unchanged. Test: `board_tests::stamps_stick_to_what_they_land_on`. |
|
||||
| 2026-10-30 | minor | M9, part of #742: a team list on `figcraft-server`. With `team_files = "edit"` (or `comment`, `view`) everyone who reaches the server sees the files shared from it now (a link of theirs has a join code: Share ▸ Start sharing) and joins them by a team list link, `figcraft://join?server=…&file=…&team=1`, which carries no secret: the server hands out the file's team link while it stays shared (`ResolveTeam`, answered like a join code), and Stop sharing revokes it with the others, disconnecting whoever joined with it. Turning the list off or changing its access refuses the old team links at once. `collab.files {refresh}` asks the server in Preferences for its list (`Admin::Team`; not the public server FigCraft ships with), and Home ▸ Online shows it below your own files: a row joins its file, its menu copies the link for the app or, with the server's `web_url`, for the browser build (`<web_url>#join=…`). A browser build served beside its server names it with `<meta name="figcraft-server">`, the page's default for sharing, codes and the team list. No accounts: the list is for a server only your team reaches. Tests: `team_tests` (the server and apps over loopback), `code_tests` (links and the browser's driver), `online_tests` (the Online section), `query_tests` (the page's server). Percentages and hours unchanged |
|
||||
| 2026-10-30 | minor | M3, gap 10: team library analytics count detached instances. Detaching an instance of a library component counts it in the file (`libraries.detached`, saved with it, at most 1,000 components); the background library check reports the counts to the library's server after its fetch (`reportDetached`), which keeps them per file beside the file's usage report (same caps: 1,000 components, 200 files, names cleaned). **Show usage** and `library.usage` list detaches per component and per file (`detached`, `detachesKnown`); a component only detached shows just that. New request and reply variants appended to the library messages keep every older message's bytes, so older apps and servers are unaffected: an older server refuses the reports (ignored) and Show usage says it doesn't count detaches. Checked against a local figcraft-server with the app driven over the control channel. Numbers unchanged. Tests: `library_detach_tests` (server, end to end), `codec_tests::older_library_messages_keep_their_encoding`, `assets::library::tests::add_place_and_update_keep_overrides`, `cmd::library::detach_report_tests`. |
|
||||
| 2026-10-30 | patch | M5, gap 15: skipping the Open link notice with `proto.linkNotice` (the Actions palette, the control channel, MCP) changed the preference in memory only, so it was lost if the app crashed before quitting. A command can now mark the preferences to be kept at once (`Session::prefs_unsaved`), which the app saves at the end of the frame like installed plugins and live-session tokens; `proto.linkNotice` does, and the notice's own "Don't show this again" goes the same way. Numbers unchanged. Test: `present_links_tests::skipping_the_notice_by_command_is_saved_at_once`. |
|
||||
|
||||
@@ -49,11 +49,13 @@ pub enum BoardItem {
|
||||
Connector(Connector),
|
||||
/// The label in the middle of connector `connector` (a frame holding its text).
|
||||
Label { connector: NodeId },
|
||||
/// A stamp, and who placed it.
|
||||
/// A stamp, who placed it, and the object it sits on (it moves with it).
|
||||
Stamp {
|
||||
stamp: Stamp,
|
||||
#[serde(default, skip_serializing_if = "String::is_empty")]
|
||||
author: String,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
on: Option<NodeId>,
|
||||
},
|
||||
/// A marker or highlighter stroke (what the eraser takes).
|
||||
Ink,
|
||||
|
||||
@@ -194,7 +194,7 @@ fn stamps_and_ink_and_the_eraser() {
|
||||
s.prefs.user_name = "Grace".into();
|
||||
let st = id(&s.execute("board.stamp", &json!({"x": 100, "y": 100, "stamp": "heart"})).unwrap(), "id");
|
||||
let n = node(&s, st);
|
||||
assert_eq!(n.board, Some(BoardItem::Stamp { stamp: Stamp::Heart, author: "Grace".into() }));
|
||||
assert_eq!(n.board, Some(BoardItem::Stamp { stamp: Stamp::Heart, author: "Grace".into(), on: None }), "on the empty board: on nothing");
|
||||
assert_eq!(s.doc().unwrap().world_bounds(st).unwrap().center(), Point::new(100.0, 100.0));
|
||||
assert!(!n.children.is_empty());
|
||||
// Marker and highlighter strokes through the tools; the eraser takes what it touches.
|
||||
@@ -219,6 +219,58 @@ fn stamps_and_ink_and_the_eraser() {
|
||||
assert_eq!(s.tool.tool, ToolId::Eraser);
|
||||
}
|
||||
|
||||
/// A stamp sticks to the object it lands on and moves with it (as the incumbent's stamps do); one
|
||||
/// dragged onto another object sticks to that one, one dragged off sticks to nothing, and one
|
||||
/// whose object is deleted stays where it is.
|
||||
#[test]
|
||||
fn stamps_stick_to_what_they_land_on() {
|
||||
let mut s = board();
|
||||
let a = id(&s.execute("board.sticky", &json!({"x": 0, "y": 0})).unwrap(), "id");
|
||||
let b = id(&s.execute("board.sticky", &json!({"x": 400, "y": 0})).unwrap(), "id");
|
||||
let on = |s: &Session, st: NodeId| match node(s, st).board {
|
||||
Some(BoardItem::Stamp { on, .. }) => on,
|
||||
other => panic!("not a stamp: {other:?}"),
|
||||
};
|
||||
let centre = |s: &Session, st: NodeId| s.doc().unwrap().world_bounds(st).unwrap().center();
|
||||
let mv = |s: &mut Session, ids: &[NodeId], dx: f64, dy: f64| {
|
||||
s.execute("transform.move", &json!({"ids": ids, "dx": dx, "dy": dy})).unwrap();
|
||||
};
|
||||
let st = id(&s.execute("board.stamp", &json!({"x": 50, "y": 50, "stamp": "heart"})).unwrap(), "id");
|
||||
assert_eq!(on(&s, st), Some(a));
|
||||
// The sticky moves, the stamp with it; both moved together, once; undo takes both back.
|
||||
mv(&mut s, &[a], 30.0, 200.0);
|
||||
assert_eq!(centre(&s, st), Point::new(80.0, 250.0));
|
||||
mv(&mut s, &[a, st], 10.0, 0.0);
|
||||
assert_eq!((centre(&s, st), on(&s, st)), (Point::new(90.0, 250.0), Some(a)));
|
||||
s.execute("edit.undo", &json!({})).unwrap();
|
||||
assert_eq!(centre(&s, st), Point::new(80.0, 250.0));
|
||||
// Dragged onto the other sticky, it sticks to that one.
|
||||
mv(&mut s, &[st], 370.0, -200.0);
|
||||
assert_eq!(on(&s, st), Some(b));
|
||||
mv(&mut s, &[b], 0.0, 100.0);
|
||||
assert_eq!(centre(&s, st), Point::new(450.0, 150.0));
|
||||
mv(&mut s, &[a], 0.0, 300.0);
|
||||
assert_eq!(centre(&s, st), Point::new(450.0, 150.0), "the first sticky doesn't take it along any more");
|
||||
// Its sticky deleted, it stays where it is, on nothing; dragged off everything, on nothing.
|
||||
s.execute("edit.delete", &json!({"ids": [b]})).unwrap();
|
||||
assert_eq!((on(&s, st), centre(&s, st)), (None, Point::new(450.0, 150.0)));
|
||||
let other = id(&s.execute("board.stamp", &json!({"x": 130, "y": 600, "stamp": "star"})).unwrap(), "id");
|
||||
assert_eq!(on(&s, other), Some(a));
|
||||
mv(&mut s, &[other], 0.0, 1000.0);
|
||||
assert_eq!(on(&s, other), None);
|
||||
// One that sits inside its sticky (dropped into it before stickies stopped taking layers in)
|
||||
// moves with it once, as its child.
|
||||
let inside = id(&s.execute("board.stamp", &json!({"x": 100, "y": 600, "stamp": "check"})).unwrap(), "id");
|
||||
assert_eq!(on(&s, inside), Some(a));
|
||||
s.doc_mut().unwrap().reparent(inside, a, None).unwrap();
|
||||
let was = centre(&s, inside);
|
||||
mv(&mut s, &[a], 40.0, 0.0);
|
||||
assert_eq!(centre(&s, inside), Point::new(was.x + 40.0, was.y), "moved once");
|
||||
// A file from before stamps stuck opens with its stamps on nothing.
|
||||
let old: BoardItem = serde_json::from_value(json!({"type": "stamp", "stamp": "heart", "author": "Grace"})).unwrap();
|
||||
assert_eq!(old, BoardItem::Stamp { stamp: Stamp::Heart, author: "Grace".into(), on: None });
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_sticky_and_connector_tools() {
|
||||
let mut s = board();
|
||||
|
||||
@@ -31,7 +31,7 @@ pub(crate) use connectors::end_handle_at;
|
||||
pub use connectors::{END_HANDLE_PX, selected_connector_ends};
|
||||
use connectors::{connector_cmd, reattach};
|
||||
pub use derived::route;
|
||||
pub(crate) use derived::{settle_routes, settle_text};
|
||||
pub(crate) use derived::{settle_routes, settle_stamps, settle_text, stamp_target};
|
||||
pub use edit::label_of;
|
||||
pub(crate) use edit::{copied_items, copy_map, rejoin};
|
||||
use edit::{label_cmd, set_color, set_style};
|
||||
|
||||
@@ -81,6 +81,77 @@ pub(crate) fn settle_routes(doc: &mut Document, before: &Document, touched: &BTr
|
||||
}
|
||||
}
|
||||
|
||||
/// After layout: a stamp moves with the object it sits on; one moved by itself (a drag, a nudge)
|
||||
/// sits on whatever is under its centre now; one whose object is gone, or on another page, sits on
|
||||
/// nothing and stays where it is.
|
||||
pub(crate) fn settle_stamps(doc: &mut Document, before: &Document, touched: &BTreeSet<NodeId>) {
|
||||
if !is_board(doc) || touched.is_empty() {
|
||||
return;
|
||||
}
|
||||
let hit = |doc: &Document, id: NodeId| touched.contains(&id) || doc.ancestors(id).iter().any(|a| touched.contains(a));
|
||||
let stamps: Vec<(NodeId, Option<NodeId>)> = doc
|
||||
.nodes()
|
||||
.filter_map(|n| match &n.board {
|
||||
Some(BoardItem::Stamp { on, .. }) => Some((n.id, *on)),
|
||||
_ => None,
|
||||
})
|
||||
.collect();
|
||||
for (id, on) in stamps {
|
||||
let moved_itself = touched.contains(&id) && before.node(id).zip(doc.node(id)).is_some_and(|(b, n)| b.transform != n.transform);
|
||||
let gone = on.is_some_and(|t| !doc.contains(t) || doc.page_of(t) != doc.page_of(id));
|
||||
let now = if moved_itself {
|
||||
match (doc.page_of(id), doc.world_bounds(id)) {
|
||||
(Some(page), Some(b)) => stamp_target(doc, page, b.center(), Some(id)),
|
||||
_ => None,
|
||||
}
|
||||
} else if gone {
|
||||
None
|
||||
} else {
|
||||
if let Some(t) = on.filter(|t| hit(doc, *t)) {
|
||||
carry(doc, before, id, t);
|
||||
}
|
||||
on
|
||||
};
|
||||
if now != on
|
||||
&& let Some(BoardItem::Stamp { on: slot, .. }) = doc.node_mut(id).and_then(|n| n.board.as_mut())
|
||||
{
|
||||
*slot = now;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The object a stamp at `p` on `page` sits on: the topmost layer of the page whose box holds `p`,
|
||||
/// other than stamps, connectors and their labels, ink and `except`.
|
||||
pub(crate) fn stamp_target(doc: &Document, page: NodeId, p: Point, except: Option<NodeId>) -> Option<NodeId> {
|
||||
let top = doc.node(page)?.children.clone();
|
||||
top.into_iter().rev().filter(|c| Some(*c) != except).find(|c| {
|
||||
let takes = doc.node(*c).is_some_and(|n| {
|
||||
n.visible && !matches!(n.board, Some(BoardItem::Stamp { .. } | BoardItem::Connector(_) | BoardItem::Label { .. } | BoardItem::Ink))
|
||||
});
|
||||
takes && doc.world_bounds(*c).is_some_and(|b| b.contains(p))
|
||||
})
|
||||
}
|
||||
|
||||
/// Stamp `id` follows object `on` from where it was in `before`: its centre goes where the object's
|
||||
/// move takes it (the stamp itself neither turns nor scales).
|
||||
fn carry(doc: &mut Document, before: &Document, id: NodeId, on: NodeId) {
|
||||
// One inside its object (dropped into it before objects stopped taking layers in) already
|
||||
// moves with it.
|
||||
if before.node(on).is_none() || doc.is_ancestor(on, id) {
|
||||
return;
|
||||
}
|
||||
let (was, is) = (before.world_transform(on), doc.world_transform(on));
|
||||
let Some(c) = doc.world_bounds(id).map(|b| b.center()) else { return };
|
||||
let d = is * (was.inverse() * c) - c;
|
||||
if !(d.x.is_finite() && d.y.is_finite()) || d.hypot() <= 1e-9 {
|
||||
return;
|
||||
}
|
||||
let parent = doc.node(id).and_then(|n| n.parent).map_or(Affine::IDENTITY, |p| doc.world_transform(p));
|
||||
if let Some(n) = doc.node_mut(id) {
|
||||
n.transform = parent.inverse() * Affine::translate(d) * parent * n.transform;
|
||||
}
|
||||
}
|
||||
|
||||
/// The ends of connector `id` (as `c`) whose layer is gone or on another page stay where they are
|
||||
/// drawn, as points. Whether any did.
|
||||
fn detach_gone_ends(doc: &Document, id: NodeId, c: &mut Connector) -> bool {
|
||||
|
||||
@@ -315,12 +315,14 @@ pub(super) fn stamp_cmd(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
let page = s.page()?;
|
||||
let half = STAMP_SIZE / 2.0;
|
||||
let doc = s.doc_mut()?;
|
||||
// It sticks to the object it lands on (it moves with it).
|
||||
let on = super::derived::stamp_target(doc, page, figcraft_geom::Point::new(x, y), None);
|
||||
let id = add(doc, page, NodeKind::Frame, stamp.label(), (x - half, y - half), (STAMP_SIZE, STAMP_SIZE), |n| {
|
||||
n.fills = vec![Paint::solid(stamp.color())];
|
||||
n.corners.radii = [half; 4];
|
||||
n.effects = vec![soft_shadow()];
|
||||
n.clip = false;
|
||||
n.board = Some(BoardItem::Stamp { stamp, author });
|
||||
n.board = Some(BoardItem::Stamp { stamp, author, on });
|
||||
})?;
|
||||
for part in stamp.mark() {
|
||||
let path = figcraft_geom::BezPath::from_svg(part.d).map_err(|e| EngineError::Other(format!("stamp mark: {e}")))?;
|
||||
|
||||
@@ -122,6 +122,14 @@ impl Session {
|
||||
self.tool.overlay.drop_target = end.and_then(|e| e.node());
|
||||
}
|
||||
|
||||
/// A stamp among the layers `moving` (being dragged): the object it would stick to where it is
|
||||
/// now, under its centre (as [`super::settle_stamps`] decides when it is let go).
|
||||
pub(crate) fn dragged_stamp_target(&self, moving: &[NodeId], page: NodeId) -> Option<NodeId> {
|
||||
let doc = self.doc().ok().filter(|d| is_board(d))?;
|
||||
let stamp = moving.iter().copied().find(|id| matches!(doc.node(*id).and_then(|n| n.board.as_ref()), Some(BoardItem::Stamp { .. })))?;
|
||||
super::stamp_target(doc, page, doc.world_bounds(stamp)?.center(), Some(stamp))
|
||||
}
|
||||
|
||||
/// The pointer moving with the connector tool and no button down: the attach points under it.
|
||||
pub(crate) fn connector_hover(&mut self, ev: &PointerEvent) {
|
||||
let end = self.doc().is_ok_and(is_board).then(|| self.end_at(ev));
|
||||
|
||||
@@ -154,7 +154,9 @@ pub fn drop_parent(doc: &Document, page: NodeId, p: Point, exclude: &[NodeId]) -
|
||||
return None;
|
||||
}
|
||||
let n = doc.node(id)?;
|
||||
if !n.visible || n.locked {
|
||||
// Board objects (stickies, shapes with text, tables, stamps) never take other layers in: a
|
||||
// drop on one goes to what is under it.
|
||||
if !n.visible || n.locked || n.is_board_atom() {
|
||||
return None;
|
||||
}
|
||||
let container = n.kind.is_frame_like() || matches!(n.kind, NodeKind::Section { .. });
|
||||
|
||||
@@ -336,6 +336,9 @@ pub struct Overlay {
|
||||
pub rubber_handle: Option<[f64; 2]>,
|
||||
/// Frame/section the pointer is drawing or dropping into (highlighted).
|
||||
pub drop_target: Option<NodeId>,
|
||||
/// Boards: the object a stamp would stick to, under the stamp tool's pointer or a stamp being
|
||||
/// dragged (highlighted).
|
||||
pub stamp_target: Option<NodeId>,
|
||||
/// Connector tool: the attach points (side middles, page x, y) of the object under the pointer,
|
||||
/// and whether the connector end is at each.
|
||||
pub attach: Vec<([f64; 2], bool)>,
|
||||
|
||||
@@ -323,6 +323,7 @@ impl Session {
|
||||
});
|
||||
self.tool.overlay.drop_cell = drop_cell;
|
||||
self.tool.overlay.drop_target = drop_target;
|
||||
self.tool.overlay.stamp_target = self.dragged_stamp_target(&placed, page);
|
||||
self.tool.overlay.cursor = if self.refused(&placed, true) {
|
||||
Cursor::NotAllowed
|
||||
} else if dup {
|
||||
|
||||
@@ -113,6 +113,7 @@ impl Session {
|
||||
self.tool.overlay.measure_box = None;
|
||||
self.tool.overlay.insert_line = None;
|
||||
self.tool.overlay.drop_cell = None;
|
||||
self.tool.overlay.stamp_target = None;
|
||||
let drop_target = self.tool.overlay.drop_target.take();
|
||||
match g {
|
||||
Gesture::Move { ids, moved, duplicate, start, deselect, keep, .. } => {
|
||||
|
||||
@@ -11,6 +11,7 @@ impl Session {
|
||||
if !self.tool.busy() {
|
||||
self.tool.overlay.guides.clear();
|
||||
self.tool.overlay.measure_box = None;
|
||||
self.tool.overlay.stamp_target = None;
|
||||
}
|
||||
self.vector_pointer_left();
|
||||
self.follow_widget_hover(Vec::new());
|
||||
@@ -280,6 +281,9 @@ impl Session {
|
||||
if tool == ToolId::Connector {
|
||||
self.connector_hover(ev);
|
||||
}
|
||||
// The stamp tool: the object a click would stick the stamp to (as `board.stamp` finds it).
|
||||
self.tool.overlay.stamp_target =
|
||||
(tool == ToolId::Stamp && crate::board::is_board(&doc)).then(|| crate::board::stamp_target(&doc, page, ev.p(), None)).flatten();
|
||||
self.follow_widget_hover(widget_hover);
|
||||
let ds = self.ds_mut()?;
|
||||
if ds.hover != hover {
|
||||
|
||||
@@ -161,6 +161,7 @@ pub fn normalize(doc: &mut Document, before: &Document) {
|
||||
touched.extend(doc.take_dirty());
|
||||
// 4b. Board connectors follow the layers they join; their labels sit at their middles.
|
||||
board::settle_routes(doc, before, &touched);
|
||||
board::settle_stamps(doc, before, &touched);
|
||||
touched.extend(doc.take_dirty());
|
||||
// 5. Ready-for-dev layers whose contents changed show "Changed".
|
||||
mark_dev_changes(doc, before, &touched);
|
||||
|
||||
@@ -101,3 +101,42 @@ fn clicking_a_handle_adds_the_next_shape_joined_and_typing() {
|
||||
u.app.session.execute("edit.undo", &json!({})).unwrap();
|
||||
assert_eq!(u.app.session.doc().unwrap().ids().count(), before, "undo takes the shape and its connector away");
|
||||
}
|
||||
|
||||
/// While the stamp tool is over an object, or a stamp is dragged over one, that object is outlined:
|
||||
/// the one the stamp will stick to (the same rule `board.stamp` attaches by). Nothing off it, and
|
||||
/// nothing once the stamp is let go.
|
||||
#[test]
|
||||
fn the_object_a_stamp_will_stick_to_is_highlighted() {
|
||||
let (mut u, a) = board_with_shape();
|
||||
let target = |u: &Ui| u.app.session.tool.overlay.stamp_target;
|
||||
u.app.run("tool.stamp", json!({"stamp": "heart"}));
|
||||
let centre = screen_box(&u, a).center();
|
||||
let off = centre + egui::vec2(400.0, 0.0);
|
||||
u.frame(vec![Event::PointerMoved(centre)]);
|
||||
assert_eq!(target(&u), Some(a), "the stamp tool over the shape");
|
||||
u.frame(vec![Event::PointerMoved(off)]);
|
||||
assert_eq!(target(&u), None, "over the empty board");
|
||||
// Placed where the outline was: it sticks to that shape.
|
||||
click(&mut u, centre);
|
||||
let stamp = u.app.session.ds().unwrap().selection[0];
|
||||
let on = |u: &Ui| match &u.app.session.doc().unwrap().node(stamp).unwrap().board {
|
||||
Some(BoardItem::Stamp { on, .. }) => *on,
|
||||
other => panic!("not a stamp: {other:?}"),
|
||||
};
|
||||
assert_eq!(on(&u), Some(a));
|
||||
// Dragged with the Move tool: the shape outlined while the stamp is over it, nothing off it.
|
||||
u.app.run("tool.set", json!({"tool": "move"}));
|
||||
u.drag_to(centre, centre + egui::vec2(20.0, 10.0));
|
||||
assert_eq!(target(&u), Some(a), "a stamp dragged over the shape");
|
||||
// Let go there, it sticks to the shape and stays on the page, not in the shape's layout.
|
||||
let there = centre + egui::vec2(20.0, 10.0);
|
||||
u.button(there, false);
|
||||
let page = u.app.session.ds().unwrap().page;
|
||||
assert_eq!(u.app.session.doc().unwrap().node(stamp).unwrap().parent, Some(page), "a shape takes no layers in");
|
||||
assert_eq!((on(&u), target(&u)), (Some(a), None));
|
||||
u.drag_to(there, there + egui::vec2(10.0, 0.0));
|
||||
u.frame(vec![Event::PointerMoved(off)]);
|
||||
assert_eq!(target(&u), None, "dragged off it");
|
||||
u.button(off, false);
|
||||
assert_eq!((target(&u), on(&u)), (None, None), "let go off the shape: on nothing, and no outline");
|
||||
}
|
||||
@@ -77,6 +77,10 @@ pub(super) fn overlays(app: &FigApp, painter: &egui::Painter, t: &Tokens) -> Vec
|
||||
{
|
||||
quad(painter, q, stroke(if figcraft_engine::components::is_slot(&doc, d) { COMPONENT } else { accent(painter) }, 1.0));
|
||||
}
|
||||
// Boards: the object a stamp would stick to, outlined as a hovered layer is.
|
||||
if let Some(s) = ov.stamp_target {
|
||||
draw_outline(app, painter, &doc, s, stroke(outline_colour(&doc, s, accent(painter)), 1.5));
|
||||
}
|
||||
slot_badges(app, painter, &doc, &sel, ov.drop_target);
|
||||
attach_points(app, painter, &ov.attach);
|
||||
if let Some(t) = ov.swap_target {
|
||||
|
||||
@@ -43,7 +43,7 @@ all end with the same geometry.
|
||||
| Eraser | done | drag over marker and highlighter strokes to remove them, one undo step |
|
||||
| Pen colours and widths in the toolbar | partial | `tool.marker {color}`, `tool.highlighter {color}`; colour changes on a selected stroke from the contextual bar |
|
||||
| Stamps | done | thumbs up, heart, plus one, star, question, check: round badges drawn as vectors, the placer's name on hover |
|
||||
| Stamps sticking to the object they land on, the stamp wheel, emotes, stickers | missing | |
|
||||
| Stamps sticking to the object they land on, the stamp wheel, emotes, stickers | partial | a stamp sticks to the object it lands on (`on`) and moves with it; dragged onto another object it sticks to that one, dragged off it to nothing, and it stays where it is when its object is deleted. the object it will stick to is outlined while the stamp tool is over it or a stamp is dragged over it. No stamp wheel, emotes or stickers |
|
||||
| Text and sections | done | the existing Text tool and sections |
|
||||
| Live sessions: cursors, selections, cursor chat, spotlight | done | the existing sessions; board objects, connectors following moved objects, colours and stamps sync both ways (checked with two app instances) |
|
||||
| Timer | done | a pill at the top right of the board: presets (1, 3, 5, 10, 15 min) or any whole minutes, pause, resume, a minute more, stop; red at 0:00 until stopped; no sound. `board.timer {action, minutes?}`, `board.timerState`. Synced as its end time (or the time left while paused), so every client counts down on its own clock: nothing ticks over the network. Not an undo step |
|
||||
@@ -64,6 +64,8 @@ all end with the same geometry.
|
||||
|
||||
| Date | Change | Summary |
|
||||
|---|---|---|
|
||||
| 2026-10-30 | minor | The object a stamp will stick to is outlined while the stamp tool is over it and while a stamp is dragged over it, as the incumbent highlights it; a drag no longer drops anything into a sticky, shape with text or table (board objects take no layers in). Numbers unchanged |
|
||||
| 2026-10-30 | minor | Stamps stick to the object they land on and move with it, as the incumbent's help describes; dragged onto another object they stick to that one, and they stay put, on nothing, when their object is deleted (the incumbent's help doesn't say). Numbers unchanged |
|
||||
| 2026-10-30 | minor | The contextual bar row: a selected connector's bar sets its start and end points, solid or dashed, its weight and any colour, beside the line type and the board colours (#1596). Numbers unchanged |
|
||||
| 2026-10-30 | minor | M12, gap 24: cells copied from a spreadsheet paste onto a board as a table. The clipboard carries them as text: a row per line, a tab between cells, and a cell holding a tab, a line break or a quote in quotes. `board_table::spreadsheet_cells` reads that into `board.table`'s `cells`. The table is centred in the view, or with Paste here its top-left goes at the point. Up to 50 × 20 cells are kept, with a note when there were more. Text without tabs, comma-separated text and any paste into a design file stay a text layer, as before. Tests: `board_table_paste_tests`, `table_paste_tests`. |
|
||||
| 2026-10-30 | minor | #1597: Shift+Cmd/Ctrl+Enter on a selected shape adds the next shape joined by a connector and starts typing in it; on a sticky it still adds a sticky beside it. Numbers unchanged. |
|
||||
|
||||
+2
-1
@@ -563,7 +563,7 @@ No alpha blockers: the alpha gate in [`roadmap.md`](roadmap.md#alpha-gate) passe
|
||||
elbows that go around the objects they join.
|
||||
- **Missing:** timer music, board widgets, saving your own templates, table column resizing and
|
||||
cell colours, mind maps, washi tape, code blocks, audio and huddles, quick-create handles,
|
||||
connector waypoints placed by hand, stamps sticking to the objects they land on, `.jam` files
|
||||
connector waypoints placed by hand, the stamp wheel, emotes and stickers, `.jam` files
|
||||
([`boards-parity.md`](boards-parity.md)).
|
||||
- **User impact:** boards cover a brainstorm, a retrospective, a flow sketch and a timed, voted
|
||||
workshop round.
|
||||
@@ -573,6 +573,7 @@ No alpha blockers: the alpha gate in [`roadmap.md`](roadmap.md#alpha-gate) passe
|
||||
|
||||
| Date | Change | Summary |
|
||||
|---|---|---|
|
||||
| 2026-10-30 | minor | Gap 24: stamps stick to the objects they land on and move with them; that item leaves the missing list (the stamp wheel, emotes and stickers stay). Estimate unchanged. Test: `board_tests::stamps_stick_to_what_they_land_on` |
|
||||
| 2026-10-30 | minor | Gap 10: library analytics count detached instances per component and file (reported by the file that detached them, kept by the server beside its usage, shown in Show usage and `library.usage`); insertions and counts over time remain. Estimate unchanged. Tests: `library_detach_tests` (server), `codec_tests::older_library_messages_keep_their_encoding`, `assets::library::tests::add_place_and_update_keep_overrides`, `detach_report_tests` |
|
||||
| 2026-10-30 | patch | Gap 15: `proto.linkNotice` (the Actions palette, the control channel, MCP) is saved with the preferences at once, as the notice's own "Don't show this again" is, instead of only when the app quits; that note leaves the missing list. Estimate unchanged. Test: `present_links_tests::skipping_the_notice_by_command_is_saved_at_once` |
|
||||
| 2026-10-30 | minor | Gap 6: plugin panels show pictures: an `image` control (`data` base64, at most 256 KB and 4,096 px a side; panel specs up to 1 MB) drawn at its size up to a field's width, named by its label, which shows instead when the picture can't be decoded. "Images" leaves the missing list; estimate unchanged. Tests: `v2_tests::panels_are_validated_and_keep_entered_values`, `plugin_panel_tests::panel_images_show_named_or_fall_back_to_their_label` |
|
||||
|
||||
@@ -75,6 +75,8 @@ blockers.
|
||||
|
||||
| Date | Change | Summary |
|
||||
|---|---|---|
|
||||
| 2026-10-30 | minor | M12, gap 24: the object a stamp will stick to is outlined under the stamp tool and while a stamp is dragged; board objects take no drops. Tests: `board_connect_tests`, `board_tests` |
|
||||
| 2026-10-30 | minor | M12, gap 24: stamps stick to the objects they land on and move with them (re-attach when dragged, let go when the object is deleted). Test: `board_tests` |
|
||||
| 2026-10-30 | minor | M9, part of #742: a team list on `figcraft-server`. With `team_files = "edit"` (or `comment`, `view`) everyone who reaches the server sees the files shared from it now (a link of theirs has a join code: Share ▸ Start sharing) and joins them by a team list link, `figcraft://join?server=…&file=…&team=1`, which carries no secret: the server hands out the file's team link while it stays shared (`ResolveTeam`, answered like a join code), and Stop sharing revokes it with the others, disconnecting whoever joined with it. Turning the list off or changing its access refuses the old team links at once. `collab.files {refresh}` asks the server in Preferences for its list (`Admin::Team`; not the public server FigCraft ships with), and Home ▸ Online shows it below your own files: a row joins its file, its menu copies the link for the app or, with the server's `web_url`, for the browser build (`<web_url>#join=…`). A browser build served beside its server names it with `<meta name="figcraft-server">`, the page's default for sharing, codes and the team list. No accounts: the list is for a server only your team reaches. Tests: `team_tests` (the server and apps over loopback), `code_tests` (links and the browser's driver), `online_tests` (the Online section), `query_tests` (the page's server). Percentages and hours unchanged |
|
||||
| 2026-10-30 | minor | M3, gap 10: library analytics count detached instances per component and file (reported to the server beside usage; Show usage and `library.usage`). Tests: `library_detach_tests`, `codec_tests` |
|
||||
| 2026-10-30 | minor | M12, #1596: the bar over a selected connector on a board had the line type and one arrow button. It now has, beside the board colours and the line type, a colour wheel opening the colour picker for any colour (when only connectors are selected), menus for the start and end points (every line end the Design panel offers, each shown), and a line style menu (solid or dashed, weights 1, 2, 4 and 6), each control naming itself on hover. The arrow toggle gave way to the end point menu. UI only: `board.setStyle` caps and the stroke's dashes and weight, one undo step each. Tests: `board_line_tests.rs` (headless). |
|
||||
|
||||
Reference in new issue
Block a user