From 57b885f8d5d405c639f7cacadd875fee1ab277b2 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Thu, 12 Nov 2026 02:04:58 -0500 Subject: [PATCH] M12: Boards: a sticky's text-size menu (Small 16 to Huge 96), remembered for new stickies Measured in FigJam's web app on 2026-11-12: a sticky's own toolbar has a text-size menu (Small 16, Medium 24, Large 40, Extra large 64, Huge 96), a fresh sticky is Small = 16 (the 18 of 2026-11-09 did not reproduce), the note grows taller at Huge and shrinks back, a size chosen with two stickies selected sets both, and the sticky tool remembers the last size. STICKY_TEXT_SIZE is 16 and STICKY_SIZES holds the table. board.setStyle {fontSize} sizes stickies' notes and sets the sticky tool's size (BoardTool.sticky_size); board.sticky takes the tool's size or a fontSize (1 to 1000). The contextual bar shows a size menu (the current name or number, a check on the current entry) when only stickies carry text; shapes keep S/M/L/XL. Docs: boards-parity rows, revision history and status line. Co-Authored-By: Claude Sonnet 5.5 Model-Effort: Opus 5.5 drove; Opus 5.5 briefed; Sonnet 5.5 wrote at medium --- crates/engine/src/board_tests.rs | 68 +++++++++++++++++++++---- crates/engine/src/board_tools_tests.rs | 2 +- crates/engine/src/boards/board.rs | 9 +++- crates/engine/src/boards/board/edit.rs | 15 ++++-- crates/engine/src/boards/board/items.rs | 26 ++++++---- crates/ui-egui/locales/en.toml | 5 ++ crates/ui-egui/src/board_ui_tests.rs | 26 ++++++++++ crates/ui-egui/src/canvas/board_bar.rs | 58 ++++++++++++++++++++- docs/boards-parity.md | 9 ++-- 9 files changed, 187 insertions(+), 31 deletions(-) diff --git a/crates/engine/src/board_tests.rs b/crates/engine/src/board_tests.rs index 6dc1e28f8..dfcb28d32 100644 --- a/crates/engine/src/board_tests.rs +++ b/crates/engine/src/board_tests.rs @@ -88,7 +88,7 @@ fn a_sticky_is_a_square_frame_whose_note_grows_taller_as_it_fills() { assert_eq!(n.fills[0].solid_color(), board_color("blue")); assert!(n.layout.is_some() && !n.effects.is_empty()); assert_eq!(n.children.len(), 2, "the note and its author"); - assert_eq!(node(&s, note).kind.text().unwrap().style.font_size, 18.0); + assert_eq!(node(&s, note).kind.text().unwrap().style.font_size, 16.0); // A click on the note picks the sticky whole. let doc = s.doc().unwrap(); assert_eq!(figcraft_doc::geometry::select_target(doc, note, &[], false), st); @@ -99,19 +99,69 @@ fn a_sticky_is_a_square_frame_whose_note_grows_taller_as_it_fills() { assert!(node(&s, st).width == 200.0 && node(&s, st).height >= 200.0); // Undo puts the short note back. s.execute("edit.undo", &json!({})).unwrap(); - assert_eq!(node(&s, note).kind.text().unwrap().style.font_size, 18.0); + assert_eq!(node(&s, note).kind.text().unwrap().style.font_size, 16.0); } #[test] -fn a_new_sticky_starts_at_18() { +fn a_new_sticky_is_small_16() { let mut s = board(); for (cmd, p) in [("board.sticky", json!({"x": 0, "y": 0, "text": "Hi"})), ("board.sticky", json!({"x": 300, "y": 0}))] { let note = id(&s.execute(cmd, &p).unwrap(), "text"); - assert_eq!(node(&s, note).kind.text().unwrap().style.font_size, 18.0); + assert_eq!(node(&s, note).kind.text().unwrap().style.font_size, 16.0); } let next = id(&s.execute("board.nextSticky", &json!({})).unwrap(), "text"); - assert_eq!(node(&s, next).kind.text().unwrap().style.font_size, 18.0); - assert_eq!(STICKY_TEXT_SIZE, 18.0); + assert_eq!(node(&s, next).kind.text().unwrap().style.font_size, 16.0); + assert_eq!(STICKY_TEXT_SIZE, 16.0); +} + +#[test] +fn the_sticky_sizes_are_figjams() { + let table = [("Small", 16.0), ("Medium", 24.0), ("Large", 40.0), ("Extra large", 64.0), ("Huge", 96.0)]; + assert_eq!(crate::board::STICKY_SIZES, table); +} + +fn note_size(s: &Session, note: NodeId) -> f64 { + node(s, note).kind.text().unwrap().style.font_size +} + +#[test] +fn set_style_font_size_sizes_every_selected_sticky() { + let mut s = board(); + let a = s.execute("board.sticky", &json!({"x": 0, "y": 0, "text": "A"})).unwrap(); + let b = s.execute("board.sticky", &json!({"x": 400, "y": 0, "text": "B"})).unwrap(); + let ids = json!([id(&a, "id").0, id(&b, "id").0]); + s.execute("board.setStyle", &json!({"ids": ids, "fontSize": 24})).unwrap(); + assert_eq!(note_size(&s, id(&a, "text")), 24.0); + assert_eq!(note_size(&s, id(&b, "text")), 24.0); + let bad = s.execute("board.setStyle", &json!({"ids": ids, "fontSize": 0})); + assert!(bad.is_err()); +} + +#[test] +fn the_sticky_tool_remembers_the_last_size() { + let mut s = board(); + let a = s.execute("board.sticky", &json!({"x": 0, "y": 0, "text": "A"})).unwrap(); + s.execute("board.setStyle", &json!({"ids": [id(&a, "id").0], "fontSize": 40})).unwrap(); + let b = s.execute("board.sticky", &json!({"x": 400, "y": 0, "text": "B"})).unwrap(); + assert_eq!(note_size(&s, id(&b, "text")), 40.0); + let c = s.execute("board.sticky", &json!({"x": 800, "y": 0, "fontSize": 64})).unwrap(); + assert_eq!(note_size(&s, id(&c, "text")), 64.0); + assert!(s.execute("board.sticky", &json!({"x": 0, "y": 400, "fontSize": 5000})).is_err()); +} + +#[test] +fn a_huge_sticky_grows_taller_and_shrinks_back() { + figcraft_text::scan_system_fonts(); + let mut s = board(); + let r = s.execute("board.sticky", &json!({"x": 0, "y": 0, "text": "Alpha"})).unwrap(); + let st = id(&r, "id"); + let ids = json!([st.0]); + let (w, h16) = (node(&s, st).width, node(&s, st).height); + s.execute("board.setStyle", &json!({"ids": ids, "fontSize": 96})).unwrap(); + assert_eq!(node(&s, st).width, w, "the width stays"); + assert!(node(&s, st).height > h16, "Huge is taller than Small"); + s.execute("board.setStyle", &json!({"ids": ids, "fontSize": 40})).unwrap(); + assert_eq!(node(&s, st).height, h16, "Large is square again"); } #[test] @@ -131,7 +181,7 @@ fn a_sticky_keeps_its_text_size_as_text_is_added() { } let ten = node(&s, note).kind.text().unwrap().clone(); assert_eq!(ten.characters.matches('\n').count(), 9, "ten lines"); - assert_eq!(ten.style.font_size, 18.0); + assert_eq!(ten.style.font_size, 16.0); assert!(node(&s, note).height > text_height, "ten lines make the text taller"); assert!(node(&s, st).height > height, "and the note"); assert_eq!(node(&s, st).child_layout.sizing_v, figcraft_doc::Sizing::Hug, "the note hugs its text"); @@ -140,8 +190,8 @@ fn a_sticky_keeps_its_text_size_as_text_is_added() { crate::textedit::end(&mut s).unwrap(); let t = node(&s, note).kind.text().unwrap().clone(); assert!(t.characters.chars().count() >= 250); - assert_eq!(t.style.font_size, 18.0); - assert!(t.runs.iter().all(|r| r.style.font_size == 18.0)); + assert_eq!(t.style.font_size, 16.0); + assert!(t.runs.iter().all(|r| r.style.font_size == 16.0)); assert_eq!(node(&s, st).width, w, "the note keeps its width"); assert!(node(&s, st).height > h10, "and grows taller"); } diff --git a/crates/engine/src/board_tools_tests.rs b/crates/engine/src/board_tools_tests.rs index 1e306a7d9..f36503edc 100644 --- a/crates/engine/src/board_tools_tests.rs +++ b/crates/engine/src/board_tools_tests.rs @@ -166,9 +166,9 @@ fn styles_labels_and_their_refusals() { assert!(s.execute("board.label", &json!({"id": c, "text": ""})).unwrap()["label"].is_null()); assert!(!s.doc().unwrap().contains(l)); // What doesn't take a style or colour says so. - assert!(s.execute("board.setStyle", &json!({"ids": [a], "fontSize": 30})).is_err(), "stickies size their own text"); assert!(s.execute("board.setStyle", &json!({"ids": [c], "fontSize": 0})).is_err()); let st = id(&s.execute("board.stamp", &json!({"x": 0, "y": 0, "stamp": "check"})).unwrap(), "id"); + assert!(s.execute("board.setStyle", &json!({"ids": [st], "fontSize": 30})).is_err(), "a stamp has no text to size"); assert!(s.execute("board.setColor", &json!({"ids": [st], "color": "blue"})).is_err()); assert!(s.execute("board.setColor", &json!({"ids": [a]})).is_err()); assert!(s.execute("board.label", &json!({"id": a, "text": "x"})).is_err()); diff --git a/crates/engine/src/boards/board.rs b/crates/engine/src/boards/board.rs index d87b82914..ddee2d823 100644 --- a/crates/engine/src/boards/board.rs +++ b/crates/engine/src/boards/board.rs @@ -100,12 +100,16 @@ const HIGHLIGHTER: (f64, f32) = (20.0, 0.45); const ERASER_PX: f64 = 8.0; /// The text sizes the contextual bar offers. pub const TEXT_SIZES: [(&str, f64); 4] = [("S", 12.0), ("M", 16.0), ("L", 24.0), ("XL", 36.0)]; +/// The text sizes a sticky's menu offers (FigJam's, measured 2026-11-12): name and size. +pub const STICKY_SIZES: [(&str, f64); 5] = [("Small", 16.0), ("Medium", 24.0), ("Large", 40.0), ("Extra large", 64.0), ("Huge", 96.0)]; /// The board tools' choices: the colour new stickies get, the shape and stamp the tools place, /// how new connectors run and the marker's and highlighter's colours. #[derive(Clone, Debug)] pub struct BoardTool { pub sticky: Color, + /// The text size new stickies get (the last one chosen on a sticky). + pub sticky_size: f64, pub shape: BoardShape, pub stamp: Stamp, pub routing: Routing, @@ -118,6 +122,7 @@ impl Default for BoardTool { let first = BOARD_COLORS.first().map_or(Color::WHITE, |c| c.1); Self { sticky: first, + sticky_size: STICKY_TEXT_SIZE, shape: BoardShape::Rectangle, stamp: Stamp::ThumbsUp, routing: Routing::Elbow, @@ -132,7 +137,7 @@ pub fn specs() -> Vec { spec!( "board.sticky", "Sticky note", - "{x, y (its top-left, in the parent), text?, color? (yellow|orange|red|pink|violet|blue|green|gray or hex; default the sticky tool's), author? (a name, or false for none; default yours), parent?} → {id, text}", + "{x, y (its top-left, in the parent), text?, color? (yellow|orange|red|pink|violet|blue|green|gray or hex; default the sticky tool's), fontSize? (1 to 1000; default the sticky tool's, 16 at first), author? (a name, or false for none; default yours), parent?} → {id, text}", true, sticky_cmd ), @@ -217,7 +222,7 @@ pub fn specs() -> Vec { spec!( "board.setStyle", "Board style", - "{ids?, shape? (shapes with text), fontSize? (their text), style?: straight|elbow|curved, startCap?, endCap? (connectors)}", + "{ids?, shape? (shapes with text), fontSize? (the text of stickies, shapes, labels and mind nodes; stickies remember it for new ones), style?: straight|elbow|curved, startCap?, endCap? (connectors)}", true, set_style ), diff --git a/crates/engine/src/boards/board/edit.rs b/crates/engine/src/boards/board/edit.rs index 88a38d438..61a3c5659 100644 --- a/crates/engine/src/boards/board/edit.rs +++ b/crates/engine/src/boards/board/edit.rs @@ -130,9 +130,12 @@ impl Restyle { BoardItem::Connector(ref c) => self.restyle_connector(doc, id, c.clone())?, _ => false, }; - // Text sizes: shapes' and labels' text (stickies size theirs to fit). + // Text sizes: the text of stickies, shapes, labels and mind nodes (a sticky's note grows taller + // when its text no longer fits, by its auto layout). let sized = match (self.size, &item) { - (Some(size), BoardItem::Shape { .. } | BoardItem::Label { .. } | BoardItem::MindNode) => resize_text(doc, id, size), + (Some(size), BoardItem::Sticky { .. } | BoardItem::Shape { .. } | BoardItem::Label { .. } | BoardItem::MindNode) => { + resize_text(doc, id, size) + } _ => false, }; Ok(changed || sized) @@ -191,13 +194,19 @@ pub(super) fn set_style(s: &mut Session, p: &Value) -> Result { let restyle = Restyle::of(cmd, p)?; let doc = s.doc_mut()?; let mut changed = Vec::new(); + let mut sticky_sized = false; for (id, item) in items(doc, &ids) { + let sticky = matches!(item, BoardItem::Sticky { .. }); if restyle.apply(doc, id, item)? { changed.push(id); + sticky_sized |= sticky && restyle.size.is_some(); } } if changed.is_empty() { - return Err(bad(cmd, "nothing selected takes these (shapes with text, connectors, labels)")); + return Err(bad(cmd, "nothing selected takes these (stickies, shapes with text, connectors, labels)")); + } + if let (true, Some(size)) = (sticky_sized, restyle.size) { + s.tool.board.sticky_size = size; } Ok(json!({"ids": changed})) } diff --git a/crates/engine/src/boards/board/items.rs b/crates/engine/src/boards/board/items.rs index c70952695..431a27cf9 100644 --- a/crates/engine/src/boards/board/items.rs +++ b/crates/engine/src/boards/board/items.rs @@ -57,12 +57,13 @@ pub(crate) fn add_text(doc: &mut Document, parent: NodeId, text: &str, size: f64 Ok(id) } -/// The text size of a new sticky's note, FigJam's "Small" default (measured in the web app, -/// 2026-11-09): it never changes as the note fills, the note grows taller instead. -pub const STICKY_TEXT_SIZE: f64 = 18.0; +/// The text size of a new sticky's note, FigJam's "Small" default: 16, measured twice in the web +/// app on 2026-11-12 from the size field's value (an earlier reading of 18 did not reproduce). It +/// never changes as the note fills, the note grows taller instead. +pub const STICKY_TEXT_SIZE: f64 = 16.0; /// A sticky note's layers: the frame, the note and (when known) its author. -fn make_sticky(doc: &mut Document, parent: NodeId, at: (f64, f64), text: &str, color: Color, author: &str) -> Result<(NodeId, NodeId)> { +fn make_sticky(doc: &mut Document, parent: NodeId, at: (f64, f64), text: &str, color: Color, author: &str, size: f64) -> Result<(NodeId, NodeId)> { let id = add(doc, parent, NodeKind::Frame, "Sticky", at, (STICKY, STICKY), |n| { n.fills = vec![Paint::solid(color)]; n.corners.radii = [2.0; 4]; @@ -80,7 +81,7 @@ fn make_sticky(doc: &mut Document, parent: NodeId, at: (f64, f64), text: &str, c n.board = Some(BoardItem::Sticky { author: author.to_string() }); })?; let inner = STICKY - 2.0 * STICKY_PAD; - let note = add_text(doc, id, text, STICKY_TEXT_SIZE, INK, TextAlignH::Left, inner)?; + let note = add_text(doc, id, text, size, INK, TextAlignH::Left, inner)?; if !author.is_empty() { let a = add_text(doc, id, author, 10.0, AUTHOR_INK, TextAlignH::Left, inner)?; if let Some(n) = doc.node_mut(a) { @@ -102,7 +103,12 @@ pub(super) fn sticky_cmd(s: &mut Session, p: &Value) -> Result { let parent = parent_of(cmd, s, p)?; let text = string(p, "text").unwrap_or_default(); let at = (num_or(p, "x", 0.0), num_or(p, "y", 0.0)); - let (id, note) = make_sticky(s.doc_mut()?, parent, at, &text, color, &author)?; + let size = match num(p, "fontSize") { + None => s.tool.board.sticky_size, + Some(v) if v.is_finite() && (1.0..=1000.0).contains(&v) => v, + Some(_) => return Err(bad(cmd, "`fontSize` is from 1 to 1000")), + }; + let (id, note) = make_sticky(s.doc_mut()?, parent, at, &text, color, &author, size)?; s.set_selection(vec![id]); Ok(json!({"id": id, "text": note})) } @@ -155,11 +161,11 @@ pub(super) fn next_sticky(s: &mut Session, p: &Value) -> Result { "above" => (0.0, -(STICKY + STICKY_GAP)), other => return Err(bad(cmd, format!("`side` is right, below, left or above, not `{other}`"))), }; - let author = author(s); + let (author, size) = (author(s), s.tool.board.sticky_size); if editing.is_some() { textedit::end(s)?; } - let (id, note) = make_sticky(s.doc_mut()?, parent, (at.x + dx, at.y + dy), "", color, &author)?; + let (id, note) = make_sticky(s.doc_mut()?, parent, (at.x + dx, at.y + dy), "", color, &author, size)?; s.set_selection(vec![id]); if boolean(p, "edit") == Some(true) { // Typing goes on in the new sticky once this step is recorded. @@ -227,13 +233,13 @@ pub(super) fn add_connected(s: &mut Session, p: &Value) -> Result { } None => (to_at, from_side, to_side), }; - let (routing, author, page) = (s.tool.board.routing, author(s), s.page()?); + let (routing, author, page, size) = (s.tool.board.routing, author(s), s.page()?, s.tool.board.sticky_size); if editing.is_some() { textedit::end(s)?; } let doc = s.doc_mut()?; let (id, text) = match shape { - None => make_sticky(doc, parent, to_at, "", color, &author)?, + None => make_sticky(doc, parent, to_at, "", color, &author, size)?, Some(shape) => make_shape(doc, parent, to_at, next, shape, "", color)?, }; let connector = Connector { diff --git a/crates/ui-egui/locales/en.toml b/crates/ui-egui/locales/en.toml index 71e6ff010..b0abc6b8e 100644 --- a/crates/ui-egui/locales/en.toml +++ b/crates/ui-egui/locales/en.toml @@ -1578,6 +1578,11 @@ name = "English" "Text content" = "Text content" "Text on a path" = "Text on a path" "Text size" = "Text size" +"Small" = "Small" +"Medium" = "Medium" +"Large" = "Large" +"Extra large" = "Extra large" +"Huge" = "Huge" "Text style" = "Text style" "Text styles" = "Text styles" "Texts" = "Texts" diff --git a/crates/ui-egui/src/board_ui_tests.rs b/crates/ui-egui/src/board_ui_tests.rs index 867ba139a..bd0a8b21f 100644 --- a/crates/ui-egui/src/board_ui_tests.rs +++ b/crates/ui-egui/src/board_ui_tests.rs @@ -398,3 +398,29 @@ fn cmd_while_moving_a_connector_end_places_it_on_the_object() { drag(&mut u, Modifiers::NONE); assert!(matches!(end(&u), figcraft_doc::End::Node { at: None, side: figcraft_doc::Side::Right, .. }), "{:?}", end(&u)); } + +#[test] +fn a_selected_sticky_has_a_size_menu_instead_of_the_size_cells() { + let mut u = board(); + let r = u.app.session.execute("board.sticky", &json!({"x": 0, "y": 0, "text": "Alpha"})).unwrap(); + let note = figcraft_engine::board::text_of(u.app.session.doc().unwrap(), id(&r)).unwrap(); + u.frame(vec![]); + u.frame(vec![]); + let shapes = flat(&u.frame_output(vec![]).shapes); + assert!(has_text(&shapes, "Small"), "the menu reads Small"); + assert!(!has_text(&shapes, "XL"), "no S/M/L/XL cells"); + // The menu sits after the 8 colours (208 from the bar's left edge). + let b = bar(&u).expect("the bar shows"); + click(&mut u, pos2(b.min.x + 208.0 + 40.0, b.center().y)); + let shapes = flat(&u.frame_output(vec![]).shapes); + // Each row is padded to line up with the check mark on the current one. + for name in ["✓ Small", " Medium", " Large", " Extra large", " Huge"] { + assert!(has_text(&shapes, name), "{name:?} in the menu"); + } + click(&mut u, text_center(&shapes, " Large")); + let size = |u: &Ui| u.app.session.doc().unwrap().node(note).unwrap().kind.text().unwrap().style.font_size; + assert_eq!(size(&u), 40.0); + u.frame(vec![]); + let shapes = flat(&u.frame_output(vec![]).shapes); + assert!(has_text(&shapes, "Large") && !has_text(&shapes, "Small"), "the menu reads Large"); +} diff --git a/crates/ui-egui/src/canvas/board_bar.rs b/crates/ui-egui/src/canvas/board_bar.rs index e75116b66..fa3d5e4e5 100644 --- a/crates/ui-egui/src/canvas/board_bar.rs +++ b/crates/ui-egui/src/canvas/board_bar.rs @@ -4,7 +4,7 @@ use egui::{Color32, CornerRadius, Pos2, Rect, Sense, Stroke, StrokeKind, Ui, pos2, vec2}; use figcraft_doc::{BOARD_COLORS, BoardItem, BoardShape, NodeId, NodeKind, Routing, Stamp, StrokeCap}; -use figcraft_engine::board::{BoardTool, TEXT_SIZES}; +use figcraft_engine::board::{BoardTool, STICKY_SIZES, TEXT_SIZES}; use figcraft_engine::board_grid::GridStyle; use serde_json::{Value, json}; @@ -96,6 +96,9 @@ struct Has { color: bool, shape: Option, text: bool, + /// The first selected sticky's text size: stickies take a size menu (not the S/M/L/XL cells) + /// when they are the only text-bearing objects selected. + sticky: Option, connector: Option, /// Every selected board object is a connector: the colour part offers any colour too. only_lines: bool, @@ -121,7 +124,15 @@ fn has(app: &FigApp) -> Option { for n in ds.selection.iter().filter_map(|id| ds.doc.node(*id)) { others |= n.board.is_some() && !matches!(n.board, Some(BoardItem::Connector(_))); match &n.board { - Some(BoardItem::Sticky { .. } | BoardItem::Ink) => h.color = true, + Some(BoardItem::Sticky { .. }) => { + h.color = true; + let size = figcraft_engine::board::text_of(&ds.doc, n.id) + .and_then(|t| ds.doc.node(t)) + .and_then(|t| t.kind.text()) + .map_or(figcraft_engine::board::STICKY_TEXT_SIZE, |t| t.style.font_size); + h.sticky.get_or_insert(size); + } + Some(BoardItem::Ink) => h.color = true, Some(BoardItem::Shape { shape }) => { h.color = true; h.text = true; @@ -154,6 +165,8 @@ const SWATCH: f32 = 20.0; const GAP: f32 = 4.0; /// The room each part takes after its controls (the divider and the gap around it). const PART_END: f32 = 8.0; +/// The sticky size menu's width: its name ("Extra large") and the chevron. +const STICKY_W: f32 = 96.0; impl Has { /// The bar's width for these parts. @@ -168,6 +181,9 @@ impl Has { if self.shape.is_some() { w += CELL + 12.0 + GAP + PART_END; } + if self.sticky.is_some() && !self.text { + w += STICKY_W + PART_END; + } if self.text { w += TEXT_SIZES.len() as f32 * (CELL + 2.0) + PART_END; } @@ -226,6 +242,8 @@ pub fn show(app: &mut FigApp, ctx: &egui::Context) { } if h.text { x = size_part(app, ui, x, cy, &t); + } else if let Some(size) = h.sticky { + x = sticky_size_part(app, ui, size, pos2(x, cy), &t); } if h.table { x = crate::board_picker::table_part(app, ui, x, cy, &t); @@ -338,6 +356,42 @@ fn size_part(app: &mut FigApp, ui: &mut Ui, mut x: f32, cy: f32, t: &Tokens) -> divider(ui, t, x, cy) } +/// A sticky size's name as the UI says it (`None` when no entry has that size). +fn sticky_size_label(size: f64) -> Option<&'static str> { + STICKY_SIZES.iter().find(|(_, s)| (*s - size).abs() < 0.01).map(|(name, _)| match *name { + "Small" => tr_noop("Small"), + "Medium" => tr_noop("Medium"), + "Large" => tr_noop("Large"), + "Extra large" => tr_noop("Extra large"), + _ => tr_noop("Huge"), + }) +} + +/// The sticky text size menu at `at` (its left edge and middle), showing `size` by name, or as a +/// number when no entry has it; `board.setStyle {fontSize}`; where the next part starts. +fn sticky_size_part(app: &mut FigApp, ui: &mut Ui, size: f64, at: Pos2, t: &Tokens) -> f32 { + let r = Rect::from_min_size(pos2(at.x, at.y - CELL / 2.0), vec2(STICKY_W, CELL)); + let tip = tr("Text size"); + let resp = ui.interact(r, ui.scope_id().with("bb_sticky_size"), Sense::click()).on_hover_text(tip); + a11y::menu_button(&resp, tip, a11y::menu_open(&resp)); + if resp.hovered() { + ui.painter().rect_filled(r, CornerRadius::same(5), t.hover); + } + let name = sticky_size_label(size).map_or_else(|| format!("{}", (size * 100.0).round() / 100.0), |l| tr(l).to_string()); + ui.painter().text(pos2(r.min.x + 8.0, at.y), egui::Align2::LEFT_CENTER, name, semibold(11.0), t.text); + icons::paint(ui.painter(), Rect::from_center_size(pos2(r.max.x - 9.0, at.y), vec2(12.0, 12.0)), Icon::Chevron, t.icon_secondary); + crate::right::menu_popup(&resp).show(|ui| { + for (name, value) in STICKY_SIZES { + let label = sticky_size_label(value).unwrap_or(name); + if crate::right::menu_check(ui, (value - size).abs() < 0.01, tr(label), "") { + app.run("board.setStyle", json!({"fontSize": value})); + ui.close(); + } + } + }); + divider(ui, t, at.x + STICKY_W, at.y) +} + /// A start or end point menu's width: the end's picture and the menu's chevron. const CAP_W: f32 = 62.0; /// The line style menu's width. diff --git a/docs/boards-parity.md b/docs/boards-parity.md index 04cb832bc..139461500 100644 --- a/docs/boards-parity.md +++ b/docs/boards-parity.md @@ -1,6 +1,6 @@ # Boards parity -> **Last reviewed:** 2026-10-24 · **Last updated:** 2026-11-10 · **Change:** minor (resizing a board table by height changes its rows, not blank space below them: a bottom or top edge grows the last row, a corner shares the change over every row, and a table keeps at least 40 per cell, measured in FigJam's web app, 2026-11-09 (#2172); a `.jam` file's stickies come in as native board stickies, with their colour, text and author kept and the size as saved (#1808); a sticky's text stays 18 and the note grows taller instead of the text shrinking, as measured in FigJam's web app (#2157); mind maps, first step: a first node with three children on curved branches, laid out again after every edit (`board.mindMap`, `board.mindMapAdd`, #2226); a `.jam` elbowed connector saved with its path keeps it on import instead of being routed again (#1910); a "+" handle dragged carries the preview: the next shape is made where it is let go, or a connector joins the object it is let go on (#1919); a connector attached to a side starts 4 pt outside the border, so its stroke never lies on the fill (#1916); a connector end moved with Cmd/Ctrl held goes on any part of an object, and stays there as the object moves or resizes; a connector end dropped along a side of a shape attaches to that side (#1708); a board connector's path can be reshaped by dragging its path handles (#1710); boards have 16 more shapes (arrows, polygons, star, plus and flowchart symbols), in pickers that lay them out in a grid; a board keeps earlier votes' results, listed newest first in Results and deleted one at a time; a connector's bar sets its start and end points, dashes, weight and any colour (#1596); cells copied from a spreadsheet paste onto a board as a table; Shift+Cmd/Ctrl+Enter on a selected board shape adds the next shape already joined to it, and goes on typing (#1597); "+" handles beside a selected sticky or shape make the next one, joined by a connector (#1597); a FigJam `.jam` file opens as a board (#1342); board grid settings: dots, lines, graph paper or none, spacing, size and contrast; the connector tool shows the connector it will make while dragging, ends snapping to attach points (#1387); templates and tables; facilitation: a shared timer and voting sessions; the dot grid, dragging a connector's end to re-attach it, curved connectors, elbows that go around what they join) · **Target:** the incumbent's whiteboard product (behaviour from its public help centre) +> **Last reviewed:** 2026-10-24 · **Last updated:** 2026-11-12 · **Change:** minor (a sticky has a text-size menu in the contextual bar, Small 16, Medium 24, Large 40, Extra large 64 and Huge 96, with Small the default (an earlier reading of 18 did not reproduce); `board.setStyle {fontSize}` sizes stickies and the sticky tool remembers the last size for new ones; the note grows taller at Huge and shrinks back, as measured in FigJam's web app, 2026-11-12; resizing a board table by height changes its rows, not blank space below them: a bottom or top edge grows the last row, a corner shares the change over every row, and a table keeps at least 40 per cell, measured in FigJam's web app, 2026-11-09 (#2172); a `.jam` file's stickies come in as native board stickies, with their colour, text and author kept and the size as saved (#1808); a sticky's text stays 18 and the note grows taller instead of the text shrinking, as measured in FigJam's web app (#2157); mind maps, first step: a first node with three children on curved branches, laid out again after every edit (`board.mindMap`, `board.mindMapAdd`, #2226); a `.jam` elbowed connector saved with its path keeps it on import instead of being routed again (#1910); a "+" handle dragged carries the preview: the next shape is made where it is let go, or a connector joins the object it is let go on (#1919); a connector attached to a side starts 4 pt outside the border, so its stroke never lies on the fill (#1916); a connector end moved with Cmd/Ctrl held goes on any part of an object, and stays there as the object moves or resizes; a connector end dropped along a side of a shape attaches to that side (#1708); a board connector's path can be reshaped by dragging its path handles (#1710); boards have 16 more shapes (arrows, polygons, star, plus and flowchart symbols), in pickers that lay them out in a grid; a board keeps earlier votes' results, listed newest first in Results and deleted one at a time; a connector's bar sets its start and end points, dashes, weight and any colour (#1596); cells copied from a spreadsheet paste onto a board as a table; Shift+Cmd/Ctrl+Enter on a selected board shape adds the next shape already joined to it, and goes on typing (#1597); "+" handles beside a selected sticky or shape make the next one, joined by a connector (#1597); a FigJam `.jam` file opens as a board (#1342); board grid settings: dots, lines, graph paper or none, spacing, size and contrast; the connector tool shows the connector it will make while dragging, ends snapping to attach points (#1387); templates and tables; facilitation: a shared timer and voting sessions; the dot grid, dragging a connector's end to re-attach it, curved connectors, elbows that go around what they join) · **Target:** the incumbent's whiteboard product (behaviour from its public help centre) **Breadth ~47%, ready ~29% (estimated, erring low).** A board is a FigCraft file of its own kind (`file.newBoard`) with a dot grid on the page, sticky notes, shapes with text, connectors that @@ -28,10 +28,10 @@ all end with the same geometry. |---|---|---| | Board files: File ▸ New board, the home screen's New board card, a light page | done | `file.newBoard`; the kind shows in `inspect_document`, tabs and file rows (a note mark; design files a pen nib) | | Board toolbar at the bottom | done | Move/Hand, Marker/Highlighter/Eraser, Sticky (colour flyout), Shapes (flyout), Connector, Text, Section, Stamp (flyout), Comment, Actions, then the templates and the Design panel's buttons — on the same 32 pt grid as a design file's (no Resources button, as there) | -| Design panel hidden by default; a contextual bar above the selection | done | colour, shape, text size (S/M/L/XL); for connectors straight/elbow/curved, the start and end points (none, round, square, line arrow, triangle arrow, reversed triangle, circle, diamond), solid or dashed, the weight, and any colour in the colour picker beside the board colours (#1596); each control says what it is on hover; the Design panel opens with its button or View ▸ Design panel | +| Design panel hidden by default; a contextual bar above the selection | done | colour, shape, text size (S/M/L/XL for shapes and labels; a size menu, Small to Huge, for stickies); for connectors straight/elbow/curved, the start and end points (none, round, square, line arrow, triangle arrow, reversed triangle, circle, diamond), solid or dashed, the weight, and any colour in the colour picker beside the board colours (#1596); each control says what it is on hover; the Design panel opens with its button or View ▸ Design panel | | Prototyping and Developer Mode refuse on boards | done | `proto.*`, `dev.*`, `view.prototype`, `view.devMode` say why | -| Sticky notes | done | a square frame (200 wide, growing taller through auto layout), 8 soft colours, a soft shadow, the note's text 18 by default and fixed (FigJam's "Small"): the note grows taller as it fills and never shrinks its text, measured in FigJam's web app, 2026-11-09; stickies saved with another size keep it, and there is no size menu yet (#2157), the author's name at the bottom; a click places one and starts typing; Enter or a double-click edits; Shift+Cmd/Ctrl+Enter adds the next one beside it | -| Sticky options: hide the author, change size presets, sticky stacks | partial | `board.sticky {author: false}`; no size presets or stacks | +| Sticky notes | done | a square frame (200 wide, growing taller through auto layout), 8 soft colours, a soft shadow, the note's text 16 by default (FigJam's "Small", read twice from its size field, 2026-11-12) and fixed as it fills: the note grows taller and never shrinks its text (2026-11-09, #2157); a size menu in the contextual bar (Small 16, Medium 24, Large 40, Extra large 64, Huge 96; a number when the size matches none) sets every selected sticky, the note grows taller when Huge no longer fits and shrinks back to square at Large, and the sticky tool remembers the last size for new stickies, all measured in FigJam's web app, 2026-11-12; stickies saved with another size keep it, the author's name at the bottom; a click places one and starts typing; Enter or a double-click edits; Shift+Cmd/Ctrl+Enter adds the next one beside it | +| Sticky options: hide the author, change size presets, sticky stacks | partial | `board.sticky {author: false}`; size presets done (the bar's menu, `board.setStyle {fontSize}`, `board.sticky {fontSize}`); no stacks | | Shapes with text | done | rectangle, rounded rectangle, ellipse, diamond, triangle, speech bubble, chevron; text centred and wrapping inside the outline; shape type and text size from the contextual bar | | Shape auto-fit to its text, more shapes (cylinder, cross, star…), shape libraries | missing | | | Connectors | done | from a layer's side (the facing one, or one named) to another layer or a free point, straight, elbow or curved, arrowheads (the stroke's caps), a label in the middle of the route by length (double-click to add); while one is dragged out it shows as it will be made (route, line and arrowhead), the object under the pointer outlined with its four attach points (side middles), the one the end goes to ringed; an end dropped on the outer half of an object takes the side it is towards (a drop along a whole edge chooses that edge), one in the middle takes the facing side; re-routed when either end moves or resizes; a deleted end stays where it was; an end attached to a side starts 4 pt outside the border (`board_route::END_GAP`), so the stroke never lies on the fill; elbows leaving one side share their first run along its normal and curves leave tangent to it (#1916) | @@ -72,6 +72,7 @@ all end with the same geometry. | Date | Change | Summary | |---|---|---| +| 2026-11-12 | minor | M12: a sticky's text-size menu. Measured in FigJam's web app, 2026-11-12: the menu lists Small 16, Medium 24, Large 40, Extra large 64 and Huge 96 (typing 40 shows Large), a fresh sticky is Small = 16 (read twice from the size field; the 18 of 2026-11-09 did not reproduce), the note stays square to Extra large and grows taller at Huge with the same width and shrinks back at Large, choosing a size with two stickies selected sets both, and the sticky tool remembers the last size. `STICKY_TEXT_SIZE` is 16, `STICKY_SIZES` holds the table, `board.setStyle {fontSize}` sizes stickies and sets the tool's size, `board.sticky` takes `fontSize`, and the contextual bar shows a size menu when only stickies carry text (shapes keep S/M/L/XL, unmeasured). Stacks are still missing. Tests: `a_new_sticky_is_small_16`, `the_sticky_sizes_are_figjams`, `set_style_font_size_sizes_every_selected_sticky`, `the_sticky_tool_remembers_the_last_size`, `a_huge_sticky_grows_taller_and_shrinks_back`, `a_selected_sticky_has_a_size_menu_instead_of_the_size_cells` | | 2026-11-09 | minor | M12, #2172: a board table's height change goes into its rows. Measured in FigJam's web app, 2026-11-09 (a table has no lock-proportions control and never scales proportionally): a bottom-edge drag grows only the last row, a corner drag shares the change equally over every row and column, text keeps its size, and a table stops shrinking at about 52 per cell with a row never shorter than its wrapped text. FigCraft already split a width change equally (every cell fills); the bug was height: a bottom or corner resize turned the table from hugging to fixed height, so the rows stayed at 40 with blank space below them (or were clipped when shrunk) and typing no longer grew the table. `board_table::settle_resize`, called first in the normalize pass, finds a table left at a fixed height, puts the change into the rows' minimum height (the last row, or every row when both axes changed), raises a width that is too narrow to `columns x 40`, and returns the table to hugging, so every route (drag, `node.set`, `transform.resize`, MCP, live-session peers) gives the same result, in one undo step. FigCraft's floor is 40 (FigJam's is about 52) and there are no per-column widths yet: a side drag of the right edge still splits equally where FigJam grows only the last column. Numbers unchanged. Tests: `board_tables_tests` (the bottom, corner and side drags, the floor, typing after a resize and undo, live sessions, junk). | | 2026-11-09 | patch | M12, #2157: a sticky's text is 18 and stays 18 (measured in FigJam's web app: ten lines, then a long paragraph, never changed it; the note kept its width and grew taller). The normalize pass no longer resets a sticky's text to a size by its length (24 down to 11 before), so stickies in saved files keep their size. Size presets (Small to Huge) are still missing. Tests: `a_new_sticky_starts_at_18`, `a_sticky_keeps_its_text_size_as_text_is_added`, `a_sticky_saved_with_another_text_size_keeps_it` | | 2026-11-10 | minor | M12, #2226 (step 1 of 4): mind maps in the document and engine. A mind map node is a board object of its own (`BoardItem::MindNode`: text with no box) and a branch is a connector marked `branch`; the map's shape is read from its branches. `board.mindMap` places a first node with three children and `board.mindMapAdd` adds a child or a sibling, each one undo step. The normalize pass lays a touched map out again from its first node (`board::settle_mind_maps`, `figcraft_doc::mind_layout`): 88 between columns, 48 between siblings, each stack centred on its parent, numbers from a FigJam file saved and decoded. Tests: `board_mindmap_tests` in doc (five) and engine (eight). Numbers unchanged (no toolbar entry yet). |