Place: Bounding Box measures only the art that shows

With crop "bounding", file.place measured the placed art by each
object's visual bounds, which include the hidden members of a group.
A group holding a 40 pt square and a hidden 170 x 42 pt rectangle was
measured as 251 x 123 pt: at, rect, the place cursor and
file.place.info all used that box. A group whose only part on the page
or artboard was a hidden member was also placed, and symbol instances
were measured as a 20 pt square.

The art's box now follows the rule exports use
(vectorcraft_render::encode::drawn_bounds, made public): hidden
objects, guides and template layers do not count; the reach of effects
such as a drop shadow now counts; symbol instances are measured by
their art. The same rule picks the objects on the page or artboard.
Hidden objects on the page or artboard are still placed, and stay
hidden. Replace and the width and height that file.place answers also
measure symbol instances by their art.

Docs: docs/mcp.md (Place), docs/target-app-parity.md.
This commit is contained in:
dotCooCoo
2026-10-18 12:34:29 +07:00
committed by bflatastic
parent 2fc47948d5
commit b27b5b80ea
6 changed files with 192 additions and 13 deletions
+5 -1
View File
@@ -219,7 +219,11 @@ pub fn art_bounds_on(doc: &Document, rect: Rect) -> Option<Rect> {
doc.layers.iter().fold(None, |acc, l| vectorcraft_geom::union_opt(acc, on(&symbols, l, rect)))
}
fn drawn_bounds(symbols: &SymbolBoxes, n: &Node) -> Option<Rect> {
/// Bounds of what an export draws of object `n` ([`art_bounds`]): `None` when `n` is hidden, a
/// guide or a template layer. The hidden objects, guides and template layers in it are left out,
/// except in a group or layer with effects of its own that keep all its members (`without_undrawn`
/// lists them). Symbol instances are measured by their art in `symbols`.
pub fn drawn_bounds(symbols: &SymbolBoxes, n: &Node) -> Option<Rect> {
if !n.visible {
return None;
}