mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-02 22:20:50 -06:00
Text: leave out the bottom-handle Auto Size double-click until its behaviour is settled (#1947)
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
//! mode (Double Click To Isolate), Cmd/Ctrl-click to select the object behind (Command Click to Select Objects Behind),
|
||||
//! click or drag a ruler guide ([`crate::rulerguide`]), drag the brackets of type on a path
|
||||
//! ([`crate::pathtype`]), double-click the type widget to convert point type to area type and back
|
||||
//! ([`crate::typewidget`]), double-click area type's bottom middle handle to turn on Auto Size.
|
||||
//! ([`crate::typewidget`]).
|
||||
//! The bounding box stands at the selection's own angle after a rotation, so its handles scale
|
||||
//! along the objects' axes. A handle drag resizes area type's frame (the type area) instead of
|
||||
//! scaling its type: the text reflows at its size.
|
||||
@@ -268,9 +268,7 @@ impl Tool for SelectionTool {
|
||||
match (ev.kind, self.state.clone()) {
|
||||
(PointerKind::DoubleClick, _) => {
|
||||
self.state = State::Idle;
|
||||
if let Some(a) =
|
||||
corners::double_click(cx, p, false).or_else(|| typewidget::double_click(cx, p)).or_else(|| typewidget::auto_size(cx, p))
|
||||
{
|
||||
if let Some(a) = corners::double_click(cx, p, false).or_else(|| typewidget::double_click(cx, p)) {
|
||||
return vec![a];
|
||||
}
|
||||
if crate::rulerguide::guide_at(cx, p).is_some() {
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
//! The type widget: a small circle beside the right side of a selected type object's bounding
|
||||
//! box, hollow on point type and filled on area type. Double-clicking it converts the type to the
|
||||
//! other kind (Type › Convert To Area Type / Convert To Point Type), keeping its text and styles.
|
||||
//! The Selection tool hits it and the canvas draws it from the same geometry. A double-click on
|
||||
//! area type's bottom middle handle turns on Auto Size.
|
||||
//! The Selection tool hits it and the canvas draws it from the same geometry.
|
||||
|
||||
use serde_json::json;
|
||||
use vectorcraft_doc::{Document, NodeId, NodeKind, OrientedBox, Selection, TextKind};
|
||||
@@ -79,28 +78,11 @@ pub fn double_click(cx: &ToolContext, p: Point) -> Option<Action> {
|
||||
Some(Action::Exec(w.command().into(), json!({ "ids": [w.id.0] })))
|
||||
}
|
||||
|
||||
/// A double-click on the bottom middle handle of one selected area type object turns on Auto Size
|
||||
/// (the frame's height follows the text), as a double-click on Illustrator's auto-size widget there
|
||||
/// does (<https://community.adobe.com/t5/illustrator-discussions/fit-bounding-box-to-text-in-illustrator/m-p/10013340>).
|
||||
pub fn auto_size(cx: &ToolContext, p: Point) -> Option<Action> {
|
||||
if !cx.show_bbox {
|
||||
return None;
|
||||
}
|
||||
let [id] = cx.selection.objects[..] else { return None };
|
||||
if !cx.doc.is_editable(id) || !cx.doc.node(id).is_some_and(crate::select::is_area_type) {
|
||||
return None;
|
||||
}
|
||||
let bx = selection_box(cx)?;
|
||||
(crate::bbox::hit_handle(bx.rect, bx.to_local(p), cx.tol(5.0)) == Some(crate::bbox::Handle::Bottom))
|
||||
.then(|| Action::Exec("text.areaOptions".into(), json!({ "ids": [id.0], "fit": "autoHeight" })))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use vectorcraft_doc::{Node, TextObject};
|
||||
|
||||
use super::*;
|
||||
use crate::bbox::Handle;
|
||||
use crate::select::SelectionTool;
|
||||
use crate::testutil::*;
|
||||
use crate::{Cursor, Mods, PointerEvent, PointerKind, Tool};
|
||||
@@ -150,40 +132,4 @@ mod tests {
|
||||
s.add(path_type);
|
||||
assert!(TypeWidget::for_tool(&cx(&pd, &s, &p)).is_none());
|
||||
}
|
||||
|
||||
/// A double-click on the bottom middle handle of area type's bounding box turns on Auto Size,
|
||||
/// as a double-click on Illustrator's auto-size widget there does (#1940).
|
||||
#[test]
|
||||
fn a_double_click_on_area_types_bottom_handle_turns_on_auto_size() {
|
||||
let (mut d, area) = doc_with_area_type();
|
||||
let point = d.alloc_id();
|
||||
let l = d.layers[0].id;
|
||||
let t = TextObject::point(Point::new(100.0, 300.0), "Point", Default::default());
|
||||
d.insert(Some(l), 0, Node::new(point, NodeKind::Text(Box::new(t)))).unwrap();
|
||||
let p = paint();
|
||||
let fit = Action::Exec("text.areaOptions".into(), json!({ "ids": [area.0], "fit": "autoHeight" }));
|
||||
let mut s = Selection::default();
|
||||
s.add(area);
|
||||
let c = cx(&d, &s, &p);
|
||||
let bx = selection_box(&c).unwrap();
|
||||
let mut t = SelectionTool::default();
|
||||
let at = |h: Handle| bx.to_doc() * h.pos(bx.rect);
|
||||
let double_click = |t: &mut SelectionTool, c: &ToolContext, q: Point| t.pointer(c, &ev(PointerKind::DoubleClick, q));
|
||||
assert_eq!(double_click(&mut t, &c, at(Handle::Bottom) + vectorcraft_geom::Vec2::new(2.0, -2.0)), vec![fit.clone()]);
|
||||
// The other handles, and the bottom handle of point type, don't.
|
||||
for h in [Handle::Top, Handle::BottomLeft, Handle::Right] {
|
||||
assert!(!double_click(&mut t, &c, at(h)).contains(&fit), "{h:?}");
|
||||
}
|
||||
let mut s = Selection::default();
|
||||
s.add(point);
|
||||
let c = cx(&d, &s, &p);
|
||||
let bx = selection_box(&c).unwrap();
|
||||
let a = double_click(&mut t, &c, bx.to_doc() * Handle::Bottom.pos(bx.rect));
|
||||
assert!(!a.iter().any(|a| matches!(a, Action::Exec(id, _) if id == "text.areaOptions")), "{a:?}");
|
||||
// Hidden bounding box: no handle.
|
||||
let mut s = Selection::default();
|
||||
s.add(area);
|
||||
let c = ToolContext { show_bbox: false, ..cx(&d, &s, &p) };
|
||||
assert!(!double_click(&mut t, &c, at(Handle::Bottom)).contains(&fit));
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
+2
-1
@@ -1,6 +1,6 @@
|
||||
# Type parity
|
||||
|
||||
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-14 · **Change:** minor (Cmd+Shift+C aligns centre off the Mac, a double-click on area type's bottom handle turns on Auto Size, #1940; MCP `add_text` exposes the existing `vertical` option for point, area and path type; horizontal remains the default; scores and hours unchanged; Vertical fullwidth question and exclamation marks keep their nominal glyph upright when the font has no vertical alternate; scores and hours unchanged. tab leaders are drawn in the tab's gap, #1877; type in symbols, pattern tiles, graph designs and opacity masks gets its layout bounds back on opening a native file, #1738; score unchanged; Escape while typing ends the edit, #1686; Select › Same on type, #1737; `justify` when creating point type, #1748; scores unchanged; OpenType stylistic sets, alternates, figure styles, superscript and subscript as character features, #1607; a wide word in non-rectangular area type moves down, #1615; scores unchanged; Character Styles New/Redefine capture the first selected character at run boundaries and end prior typing before capture; boundary and typing-history input tests and full workspace CI pass; scores and hours unchanged; Character styles retain explicit Auto leading, propagate resets and preserve local leading overrides; scores and hours unchanged; Linux font folders from fontconfig, #1529; commands and MCP `add_text` report area type that does not fit its frame, #1471; Tabs panel stop drags, #1458; Fit Headline in a frame one line tall, #1444; frames and paths beyond a billion points hold no text, #1451; scores unchanged; missing glyphs are looked for again after a font rescan, #1376; scores unchanged; Full-name font matching (#1258); Windows font-service QA pending; scores unchanged; Middle Eastern digit types: Character panel menu › Digits, `{digits}`; the font menu's script filter lists Thai fonts; Thai, Lao, Khmer and Myanmar lines break between words; the caret steps over whole clusters such as Thai consonants with their marks; Thai typed in a font without Thai falls back to a font made for Thai; earlier: Proportional Metrics in vertical type, `vpal`, #966) · **Target:** Adobe Illustrator 2026 (30.x)
|
||||
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-14 · **Change:** minor (Cmd+Shift+C aligns centre off the Mac, #1940; tab leaders are drawn in the tab's gap, #1877; type in symbols, pattern tiles, graph designs and opacity masks gets its layout bounds back on opening a native file, #1738; score unchanged; Escape while typing ends the edit, #1686; Select › Same on type, #1737; `justify` when creating point type, #1748; scores unchanged; OpenType stylistic sets, alternates, figure styles, superscript and subscript as character features, #1607; a wide word in non-rectangular area type moves down, #1615; scores unchanged; Character Styles New/Redefine capture the first selected character at run boundaries and end prior typing before capture; boundary and typing-history input tests and full workspace CI pass; scores and hours unchanged; Character styles retain explicit Auto leading, propagate resets and preserve local leading overrides; scores and hours unchanged; Linux font folders from fontconfig, #1529; commands and MCP `add_text` report area type that does not fit its frame, #1471; Tabs panel stop drags, #1458; Fit Headline in a frame one line tall, #1444; frames and paths beyond a billion points hold no text, #1451; scores unchanged; missing glyphs are looked for again after a font rescan, #1376; scores unchanged; Full-name font matching (#1258); Windows font-service QA pending; scores unchanged; Middle Eastern digit types: Character panel menu › Digits, `{digits}`; the font menu's script filter lists Thai fonts; Thai, Lao, Khmer and Myanmar lines break between words; the caret steps over whole clusters such as Thai consonants with their marks; Thai typed in a font without Thai falls back to a font made for Thai; earlier: Proportional Metrics in vertical type, `vpal`, #966; Cmd+Shift+C aligns centre off the Mac, a double-click on area type's bottom handle turns on Auto Size, #1940; MCP `add_text` exposes the existing `vertical` option for point, area and path type; horizontal remains the default; scores and hours unchanged; Vertical fullwidth question and exclamation marks keep their nominal glyph upright when the font has no vertical alternate; scores and hours unchanged. tab leaders are drawn in the tab's gap, #1877; type in symbols, pattern tiles, graph designs and opacity masks gets its layout bounds back on opening a native file, #1738; score unchanged; Escape while typing ends the edit, #1686; Select › Same on type, #1737; `justify` when creating point type, #1748; scores unchanged; OpenType stylistic sets, alternates, figure styles, superscript and subscript as character features, #1607; a wide word in non-rectangular area type moves down, #1615; scores unchanged; Character Styles New/Redefine capture the first selected character at run boundaries and end prior typing before capture; boundary and typing-history input tests and full workspace CI pass; scores and hours unchanged; Character styles retain explicit Auto leading, propagate resets and preserve local leading overrides; scores and hours unchanged; Linux font folders from fontconfig, #1529; commands and MCP `add_text` report area type that does not fit its frame, #1471; Tabs panel stop drags, #1458; Fit Headline in a frame one line tall, #1444; frames and paths beyond a billion points hold no text, #1451; scores unchanged; missing glyphs are looked for again after a font rescan, #1376; scores unchanged; Full-name font matching (#1258); Windows font-service QA pending; scores unchanged; Middle Eastern digit types: Character panel menu › Digits, `{digits}`; the font menu's script filter lists Thai fonts; Thai, Lao, Khmer and Myanmar lines break between words; the caret steps over whole clusters such as Thai consonants with their marks; Thai typed in a font without Thai falls back to a font made for Thai; earlier: Proportional Metrics in vertical type, `vpal`, #966) · **Target:** Adobe Illustrator 2026 (30.x)
|
||||
|
||||
Type is Illustrator's largest single area by use (weight 13 of 105 across "Type core" and "Type advanced" in
|
||||
[target-app-parity.md](target-app-parity.md)). This checklist lists the features one by one. Status is from the
|
||||
@@ -58,6 +58,7 @@ Character Styles menu New/Redefine and footer New capture the first selected cha
|
||||
|
||||
| Date | Change | Summary |
|
||||
|---|---|---|
|
||||
| 2026-10-14 | minor | Cmd+Shift+C (Align center) works on Windows and Linux too, where egui reported it as a copy (#1940); scores and hours unchanged |
|
||||
| 2026-10-14 | minor | Cmd+Shift+C (Align center) works on Windows and Linux too, where egui reported it as a copy; a double-click on area type's bottom middle handle turns on Auto Size (#1940); scores and hours unchanged |
|
||||
| 2026-10-14 | minor | MCP `add_text` exposes the existing `vertical` option for point, area and path type; horizontal remains the default; scores and hours unchanged. |
|
||||
| 2026-10-14 | minor | Vertical fullwidth question and exclamation marks keep their nominal glyph upright when the font has no vertical alternate; scores and hours unchanged. |
|
||||
|
||||
Reference in New Issue
Block a user