mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-11 16:33:22 -06:00
Artboards: Artboard Options' Show Center Mark and Show Cross Hairs draw on the canvas
The Artboard Options help pages describe two display options (https://helpx.adobe.com/illustrator/desktop/create-manage-artboards/organize-manage-artboards/modify-display-settings-of-artboards.html, .../set-video-display-options-for-artboards.html): a mark at the artboard's center, and lines from the middle of each side through the center. The document already had show_center_mark and show_cross_hairs on Artboard, but nothing set or drew them. artboard.setProps (each `artboards` entry too) and artboard.new take showCenterMark and showCrossHairs as true/false, in the same single undo step as the other fields; a locked artboard can still change them. Artboard Options has both checkboxes, filled in from the artboard whether it opens from the panel or a double-click with the Artboard tool, and its New Artboard form passes them to artboard.new. The canvas draws them in the new theme token artboard_mark, 1 point wide on screen at any zoom: a cross 12 points across at the center whose arms follow the artboard's sides, and the two cross hairs. They are screen-only like the edges; exports and print never read the fields. inspect_document reports them when on. Saved files are unchanged: the two keys were already always written, so a document that never shows them saves byte for byte as before, and a file without the keys opens with both off. Video safe areas, video rulers and the pixel aspect ratio are not part of this change. Verification: artboard_display_marks_are_set_and_cleared_in_one_undo_step, artboard_display_marks_round_trip_through_the_native_format, artboard_display_marks_stay_out_of_exports (SVG and PDF identical with the marks on and off), an_artboard_shows_its_center_mark_and_cross_hairs (positions, screen-constant size under zoom, rotated view) and artboard_options_show_center_mark_and_cross_hairs. cargo xtask ci: all 10 steps passed.
This commit is contained in:
committed by
bflatastic
parent
08cfb45561
commit
64f6d2db50
@@ -128,15 +128,18 @@ pub fn document(s: &Session) -> Value {
|
||||
document_opts(s, SummaryOpts::default())
|
||||
}
|
||||
|
||||
/// An artboard's name and rectangle, its background color (`#rrggbb`) when it has one, and
|
||||
/// `locked: true` when it is locked.
|
||||
/// An artboard's name and rectangle, its background color (`#rrggbb`) when it has one,
|
||||
/// `locked: true` when it is locked, and `showCenterMark: true` and `showCrossHairs: true` when
|
||||
/// it shows them.
|
||||
fn artboard_summary(a: &vectorcraft_doc::Artboard) -> Value {
|
||||
let mut v = json!({"name": a.name, "x": a.rect.x0, "y": a.rect.y0, "width": a.rect.width(), "height": a.rect.height()});
|
||||
if let Some(c) = a.color {
|
||||
v["color"] = json!(c.to_hex());
|
||||
}
|
||||
if a.locked {
|
||||
v["locked"] = json!(true);
|
||||
for (key, on) in [("locked", a.locked), ("showCenterMark", a.show_center_mark), ("showCrossHairs", a.show_cross_hairs)] {
|
||||
if on {
|
||||
v[key] = json!(true);
|
||||
}
|
||||
}
|
||||
v
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user