Fill Area: in isolation mode only the isolated group's paths bound areas

With a group or layer isolated, the tool's hover and click and
shapeBuilder.copyRegion take only the paths inside it, and the new path
goes inside it, directly above the object in it that holds the
front-most path along the area. Before, a click on art outside the
isolated group added a path there.

No area is found while the isolated object is a path or compound path,
a group that makes, moves or combines its own art (Live Paint, compound
shapes, Shaper groups, graphs, Image Trace results, dimensions, flares,
Objects on Path), a layer or group with a live effect, a clipping mask,
or an object inside one of these or inside an envelope. An isolated
object that no longer exists counts as no isolation, for the tool as
for the command.
This commit is contained in:
dotCooCoo committed 2026-11-19 12:16:52 -08:00
1 parent 40430c3b72
commit efadb7ee0d
7 files changed
+243 -29

No files matched your search

+1 -1
View File
@@ -73,7 +73,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Fill Area",
[],
None,
"{point: [x,y], ids?|id?: [id…] (the objects or layers whose paths bound areas; default: every layer, nothing needs to be selected), gap?: pt (0–72; 0: Gap Detection off; out of range is an error), openFilledAsClosed?: true (as shapeBuilder.merge), fill?, stroke?: \"#rrggbb\" | {color|swatch|gradient|none} (default: the current fill and stroke, with the current stroke weight)} add a new closed path of the area under point that the visible, unlocked paths enclose (the region of shapeBuilder.regions holding it: areas a shape already fills and areas open paths bound count too), directly above the front-most object along the area (its outline touches the area's outline, or it covers the area; when a group, Live Paint group, Shaper group or clipping group holds that path, above the outermost group in its layer, never inside it), and select it; the paths around the area are not changed; a point in no enclosed area is an error and changes nothing (no undo step); when the paths together have more than 65,536 segments, only an area the paths near the point enclose is found → {id, above (the object the new path went above)}",
"{point: [x,y], ids?|id?: [id…] (the objects or layers whose paths bound areas; default: every layer, nothing needs to be selected), gap?: pt (0–72; 0: Gap Detection off; out of range is an error), openFilledAsClosed?: true (as shapeBuilder.merge), fill?, stroke?: \"#rrggbb\" | {color|swatch|gradient|none} (default: the current fill and stroke, with the current stroke weight)} add a new closed path of the area under point that the visible, unlocked paths enclose (the region of shapeBuilder.regions holding it: areas a shape already fills and areas open paths bound count too), directly above the front-most object along the area (its outline touches the area's outline, or it covers the area; when a group, Live Paint group, Shaper group or clipping group holds that path, above the outermost group in its layer, never inside it), and select it; in isolation mode only the paths of the isolated layer or group bound areas (with ids, only the paths of the listed objects that are in it), and the new path goes inside it, directly above the object in it that holds that path; no area is found while the isolated object is not a layer or group (a path or compound path), is a Live Paint group, compound shape, Shaper group, graph, Image Trace result, dimension, flare or Objects on Path group, is a layer or group with a live effect or a clipping mask, or lies inside one of these or inside an envelope; the paths around the area are not changed; a point in no enclosed area is an error and changes nothing (no undo step); when the paths together have more than 65,536 segments, only an area the paths near the point enclose is found → {id, above (the object the new path went above)}",
has_doc,
sb_copy_region
),
@@ -195,18 +195,22 @@ pub(super) fn sb_copy_region(s: &mut Session, p: &Value) -> Result<Value> {
let stroke = paint_param(s, p, "stroke", C)?.unwrap_or_else(|| s.paint.stroke.clone());
let look = s.new_art_look(fill, stroke, s.paint.stroke_width);
let area = {
let d = &s.doc()?.doc;
let roots = match named_ids(p)? {
let st = s.doc()?;
let d = &st.doc;
let named = match named_ids(p)? {
Some(ids) => {
if let Some(bad_id) = ids.iter().find(|i| d.node(**i).is_none()) {
return Err(EngineError::NoNode(*bad_id));
}
// An object listed with a layer or group that holds it counts once.
outermost(d, ids)
Some(outermost(d, ids))
}
None => b::every_layer(d),
None => None,
};
b::AreaFinder::new(d, &roots, gap, open_filled_as_closed).find(pt)
// In isolation mode only the isolated layer or group's paths bound areas, and the new path
// goes inside it.
b::fill_area_roots(d, st.isolation, named.as_deref())
.and_then(|(roots, scope)| b::AreaFinder::new(d, &roots, scope, gap, open_filled_as_closed).find(pt))
};
let Some(area) = area else { return Err(EngineError::Other("Fill Area: no enclosed area under the pointer".into())) };
let id = s.edit("Fill Area", |d, sel| {
+131
View File
@@ -189,6 +189,137 @@ fn fill_area_stacks_above_the_group_that_holds_the_paths() {
assert_eq!(members(&s, clip), before);
}
/// In isolation mode only the isolated group's paths bound areas, for the command and the tool: a
/// click in an area that art outside the group encloses adds nothing, and the new path goes inside
/// the group, above the path along the area.
#[test]
fn fill_area_stays_inside_the_isolated_group() {
let mut s = session();
let outside =
[line(&mut s, (200.0, 0.0), (300.0, 100.0)), line(&mut s, (300.0, 0.0), (200.0, 100.0)), line(&mut s, (190.0, 80.0), (310.0, 80.0))];
let lines = triangle(&mut s);
let ids: Vec<u64> = lines.iter().map(|l| l.0).collect();
s.execute("select.set", &json!({"ids": ids})).unwrap();
let g = id_of(&s.execute("object.group", &json!({})).unwrap());
s.execute("object.isolate", &json!({"id": g.0})).unwrap();
deselect(&mut s);
let members = |s: &Session| -> Vec<NodeId> { node(s, g).children().unwrap().iter().map(|n| n.id).collect() };
let (undo, kids) = (undo_len(&s), stack(&s));
assert!(s.execute("shapeBuilder.copyRegion", &json!({"point": [250, 70]})).is_err(), "art outside the isolated group");
let named: Vec<u64> = outside.iter().map(|l| l.0).collect();
assert!(s.execute("shapeBuilder.copyRegion", &json!({"point": [250, 70], "ids": named})).is_err(), "named art outside it");
assert_eq!((undo_len(&s), stack(&s), members(&s)), (undo, kids.clone(), lines.to_vec()));
let v = ViewInfo::default();
s.select_tool("fillArea", v).unwrap();
s.pointer(&PointerEvent::new(PointerKind::Move, 250.0, 70.0), v).unwrap();
assert!(
!s.overlays(v).iter().any(|o| matches!(o, Overlay::Path { color: [0xff, 0x2a, 0x2a], .. })),
"no area outside the isolated group is outlined"
);
s.pointer(&PointerEvent::new(PointerKind::Down, 250.0, 70.0), v).unwrap();
s.pointer(&PointerEvent::new(PointerKind::Up, 250.0, 70.0), v).unwrap();
assert_eq!((undo_len(&s), stack(&s), members(&s)), (undo, kids.clone(), lines.to_vec()));
s.pointer(&PointerEvent::new(PointerKind::Move, 50.0, 70.0), v).unwrap();
let red = s.overlays(v).into_iter().filter(|o| matches!(o, Overlay::Path { color: [0xff, 0x2a, 0x2a], .. })).count();
assert_eq!(red, 1, "the isolated group's area is outlined");
s.pointer(&PointerEvent::new(PointerKind::Down, 50.0, 70.0), v).unwrap();
s.pointer(&PointerEvent::new(PointerKind::Up, 50.0, 70.0), v).unwrap();
let new = s.doc().unwrap().selection.objects[0];
assert_eq!(s.doc().unwrap().doc.parent_of(new), Some(g));
assert_eq!(members(&s), [lines.as_slice(), &[new]].concat());
assert_eq!(stack(&s), kids);
assert!((area(&s, new) - 900.0).abs() < 1.0, "{}", area(&s, new));
// An isolated object that no longer exists counts as no isolation, for the tool as for the
// command: the area outside the group fills.
s.doc_mut().unwrap().isolation = Some(NodeId(999_999));
s.pointer(&PointerEvent::new(PointerKind::Move, 250.0, 70.0), v).unwrap();
let red = s.overlays(v).into_iter().filter(|o| matches!(o, Overlay::Path { color: [0xff, 0x2a, 0x2a], .. })).count();
assert_eq!(red, 1, "the area outside the group is outlined");
s.pointer(&PointerEvent::new(PointerKind::Down, 250.0, 70.0), v).unwrap();
s.pointer(&PointerEvent::new(PointerKind::Up, 250.0, 70.0), v).unwrap();
let new = s.doc().unwrap().selection.objects[0];
assert_eq!(s.doc().unwrap().doc.parent_of(new), s.doc().unwrap().doc.default_layer());
}
/// While a compound path is isolated, Fill Area finds no area, for the command and the tool, and
/// changes nothing: the compound path cannot hold the new path. The same goes for an isolated
/// Objects on Path group, a group with a Transform effect and a group that is a clipping mask.
#[test]
fn fill_area_finds_nothing_while_a_compound_path_is_isolated() {
let mut s = session();
let outer = rect(&mut s, 0.0, 0.0, 100.0, 100.0);
let inner = rect(&mut s, 25.0, 25.0, 50.0, 50.0);
s.execute("select.set", &json!({"ids": [outer.0, inner.0]})).unwrap();
let c = id_of(&s.execute("object.compoundPath.make", &json!({})).unwrap());
deselect(&mut s);
assert!(s.execute("shapeBuilder.copyRegion", &json!({"point": [10, 10]})).is_ok(), "the ring fills outside isolation");
s.execute("edit.undo", &json!({})).unwrap();
s.doc_mut().unwrap().isolation = Some(c);
let (undo, kids) = (undo_len(&s), stack(&s));
assert!(s.execute("shapeBuilder.copyRegion", &json!({"point": [10, 10]})).is_err());
let v = ViewInfo::default();
s.select_tool("fillArea", v).unwrap();
s.pointer(&PointerEvent::new(PointerKind::Move, 10.0, 10.0), v).unwrap();
assert!(!s.overlays(v).iter().any(|o| matches!(o, Overlay::Path { color: [0xff, 0x2a, 0x2a], .. })));
s.pointer(&PointerEvent::new(PointerKind::Down, 10.0, 10.0), v).unwrap();
s.pointer(&PointerEvent::new(PointerKind::Up, 10.0, 10.0), v).unwrap();
assert_eq!((undo_len(&s), stack(&s)), (undo, kids));
// An Objects on Path group moves its members along the path, so a new path in it would not
// stay where the area is.
let mut s = session();
let a = rect(&mut s, 0.0, 0.0, 40.0, 40.0);
let b = rect(&mut s, 100.0, 0.0, 40.0, 40.0);
let path = line(&mut s, (0.0, 200.0), (300.0, 200.0));
s.execute("select.set", &json!({"ids": [a.0, b.0]})).unwrap();
let g = id_of(&s.execute("object.objectsOnPath.attach", &json!({"path": path.0})).unwrap());
deselect(&mut s);
let c = s.doc().unwrap().doc.node(a).unwrap().geometric_bounds().unwrap().center();
assert!(s.execute("shapeBuilder.copyRegion", &json!({"point": [c.x, c.y]})).is_ok(), "the square fills outside isolation");
s.execute("edit.undo", &json!({})).unwrap();
s.doc_mut().unwrap().isolation = Some(g);
let (undo, kids) = (undo_len(&s), stack(&s));
assert!(s.execute("shapeBuilder.copyRegion", &json!({"point": [c.x, c.y]})).is_err());
assert_eq!((undo_len(&s), stack(&s)), (undo, kids));
// A group with a Transform effect moves what is in it, so a new path in it would not be drawn
// where the area is.
let mut s = session();
let lines = triangle(&mut s);
let ids: Vec<u64> = lines.iter().map(|l| l.0).collect();
s.execute("select.set", &json!({"ids": ids})).unwrap();
let g = id_of(&s.execute("object.group", &json!({})).unwrap());
s.execute("effect.apply", &json!({"effect": "distort.transform", "params": {"moveH": 100}, "ids": [g.0], "item": null})).unwrap();
deselect(&mut s);
s.doc_mut().unwrap().isolation = Some(g);
let (undo, kids) = (undo_len(&s), stack(&s));
assert!(s.execute("shapeBuilder.copyRegion", &json!({"point": [50, 70]})).is_err());
assert_eq!((undo_len(&s), stack(&s), node(&s, g).children().unwrap().len()), (undo, kids, 3));
// A group that is a clipping mask clips and is not painted, so it takes no new path.
let mut s = session();
let back = rect(&mut s, -20.0, -20.0, 140.0, 140.0);
let edge = rect(&mut s, 0.0, 0.0, 100.0, 100.0);
s.execute("select.set", &json!({"ids": [back.0, edge.0]})).unwrap();
let clip = id_of(&s.execute("object.clippingMask.make", &json!({})).unwrap());
s.execute("select.set", &json!({"ids": [edge.0]})).unwrap();
let mask = id_of(&s.execute("object.group", &json!({})).unwrap());
// A filled square drawn in the mask group bounds an area of its own.
s.doc_mut().unwrap().isolation = Some(mask);
let square = rect(&mut s, 10.0, 10.0, 80.0, 80.0);
assert_eq!(s.doc().unwrap().doc.parent_of(square), Some(mask));
deselect(&mut s);
let first = node(&s, clip).children().unwrap()[0].id;
assert_eq!(first, mask, "the group is the clipping mask");
let (undo, kids) = (undo_len(&s), stack(&s));
let members = node(&s, mask).children().unwrap().len();
assert!(s.execute("shapeBuilder.copyRegion", &json!({"point": [50, 70]})).is_err());
assert_eq!((undo_len(&s), stack(&s), node(&s, mask).children().unwrap().len()), (undo, kids, members));
}
/// The new path goes directly above the front-most object along the area, not above art that
/// lies elsewhere, and paths on other layers bound areas too.
#[test]
+1 -1
View File
@@ -34,7 +34,7 @@ mod lookup;
mod map;
use cache::{BACKGROUND_SEGMENTS, CacheKey, RegionCache};
pub use fill_area::{AreaFinder, EnclosedArea, FillAreaTool, every_layer};
pub use fill_area::{AreaFinder, EnclosedArea, FillAreaTool, every_layer, fill_area_roots};
#[cfg(test)]
use live_paint::LpHover;
pub use live_paint::{
+93 -20
View File
@@ -14,8 +14,9 @@ pub struct EnclosedArea {
/// The area's outline, as a Shape Builder merge of that one region makes it.
pub path: PathData,
/// The object directly in a layer that holds the front-most path along the area (its outline
/// touches the area's outline, or it covers the area): the new path goes directly above it, so
/// it never goes inside a group, a Live Paint group, a Shaper group or a clipping group.
/// touches the area's outline, or it covers the area), or in isolation mode the object directly
/// in the isolated object: the new path goes directly above it, so it never goes inside a group,
/// a Live Paint group, a Shaper group or a clipping group other than the isolated one.
pub above: NodeId,
}
@@ -99,19 +100,85 @@ fn within(inner: &Rect, outer: &Rect) -> bool {
inner.x0 >= outer.x0 && inner.x1 <= outer.x1 && inner.y0 >= outer.y0 && inner.y1 <= outer.y1
}
/// The object directly in a layer (or sublayer) that holds `id`: `id` itself when a layer holds it.
fn outermost(doc: &Document, id: NodeId) -> NodeId {
/// The object directly in `scope` (the isolated object in isolation mode), or else directly in a
/// layer (or sublayer), that holds `id`: `id` itself when `scope` or a layer holds it, or when `id`
/// is `scope`.
fn outermost(doc: &Document, id: NodeId, scope: Option<NodeId>) -> NodeId {
let Some(line) = doc.ancestry(id) else { return id };
let layer = line.iter().rposition(|a| doc.node(*a).is_some_and(|n| n.is_layer()));
layer.and_then(|k| line.get(k + 1)).copied().unwrap_or(id)
let k = match scope {
Some(s) => line.iter().rposition(|a| *a == s),
None => line.iter().rposition(|a| doc.node(*a).is_some_and(|n| n.is_layer())),
};
k.and_then(|k| line.get(k + 1)).copied().unwrap_or(id)
}
/// Does `n` make, move or combine the art in it itself, so that a new path in it would not stay as
/// Fill Area adds it: a Live Paint group, a compound shape, a Shaper group, a graph, an Image Trace
/// result, a dimension, a flare or an Objects on Path group.
fn managed(n: &Node) -> bool {
let e = n.extras();
super::lookup::is_live_paint(n)
|| n.is_compound_shape()
|| e.shaper.is_some()
|| e.graph.is_some()
|| e.trace.is_some()
|| e.dimension.is_some()
|| e.flare.is_some()
|| e.objects_on_path.is_some()
}
/// The roots the Fill Area tool and `shapeBuilder.copyRegion` find areas among, with the isolated
/// object the new path goes into ([`AreaFinder::new`]'s `scope`), for `isolation` (the document's
/// isolated object) and `named` (the objects or layers named; None: every layer). In isolation mode
/// only the isolated layer or group's paths count: of `named`, the ones inside it, with the
/// isolated object in place of one that holds it. An isolated object that no longer exists counts
/// as no isolation. None while an object that is not a layer or a group is isolated (a compound
/// path or a single path), a layer or group with a live effect, a group that is [`managed`] or a
/// clipping mask, or one inside such an object or inside another object that is not a layer or a
/// group (an envelope): no area is found then.
pub fn fill_area_roots(doc: &Document, isolation: Option<NodeId>, named: Option<&[NodeId]>) -> Option<(Vec<NodeId>, Option<NodeId>)> {
let Some(iso) = isolation.filter(|i| doc.node(*i).is_some()) else {
return Some((named.map_or_else(|| every_layer(doc), <[NodeId]>::to_vec), None));
};
let line = doc.ancestry(iso)?;
// Every object from the layer down to the isolated one is a layer or a plain group: an
// envelope, a blend or another object that draws its contents its own way does not hold
// the new path as drawn.
// A layer or group with a live effect (a Transform effect moves what is in it) draws the new
// path elsewhere than the area.
let plain =
|a: &Node| (a.is_layer() || (matches!(a.kind, NodeKind::Group { .. }) && !managed(a))) && !a.appearance.effects.iter().any(|e| e.visible);
if !line.iter().all(|a| doc.node(*a).is_some_and(plain)) {
return None;
}
// A clipping group or clipped layer's first member is its mask, which clips and is not painted.
let in_mask = line.windows(2).any(|w| {
let [p, m] = w else { return false };
doc.node(*p).is_some_and(|p| p.clips() && p.children().and_then(|c| c.first()).is_some_and(|f| f.id == *m))
});
if in_mask {
return None;
}
let Some(named) = named else { return Some((vec![iso], Some(iso))) };
let mut out = vec![];
for r in named {
if line.contains(r) {
out.push(iso);
} else if doc.ancestry(*r).is_some_and(|a| a.contains(&iso)) {
out.push(*r);
}
}
Some((out, Some(iso)))
}
impl AreaFinder {
/// The finder over the paths of `roots` (layers or objects) that the Shape Builder takes:
/// visible, unlocked paths, compound paths and Live Paint faces and edges that draw, not on a
/// locked artboard. Gaps up to `gap` close, and with `open_filled_as_closed` a filled open path
/// bounds an area as if an invisible edge closed it.
pub fn new(doc: &Document, roots: &[NodeId], gap: f64, open_filled_as_closed: bool) -> Self {
/// bounds an area as if an invisible edge closed it. With `scope` (the isolated object in
/// isolation mode), an area's new path goes directly above the object in `scope` that holds the
/// front-most path along it, so it stays inside the isolated object.
pub fn new(doc: &Document, roots: &[NodeId], scope: Option<NodeId>, gap: f64, open_filled_as_closed: bool) -> Self {
let roots = sorted_roots(doc, roots);
let (shapes, leaves) = shape_builder_shapes(doc, &roots, open_filled_as_closed);
let editable = doc.editable();
@@ -121,7 +188,7 @@ impl AreaFinder {
.filter(|(_, l)| editable(l.id))
.filter_map(|(s, l)| {
let b = s.path.bounds()?;
Some((s, b, outermost(doc, l.id)))
Some((s, b, outermost(doc, l.id, scope)))
})
.collect();
let total = inputs.iter().map(|(_, b, _)| *b).reduce(|a, b| a.union(b));
@@ -281,8 +348,8 @@ pub struct FillAreaTool {
/// The finder for the document as it is, with the key it was made for. Away while a search
/// runs on another thread.
finder: Option<(FinderKey, AreaFinder)>,
/// The area under the pointer, with the document revision it was found in.
hover: Option<((u64, u64), EnclosedArea)>,
/// The area under the pointer, with the key of the finder that found it.
hover: Option<(FinderKey, EnclosedArea)>,
/// Where the pointer last moved over the canvas.
at: Option<Point>,
/// A hover search running on another thread.
@@ -293,8 +360,9 @@ pub struct FillAreaTool {
pressing: bool,
}
/// The document revision, the gap and the open-filled rule an [`AreaFinder`] was made with.
type FinderKey = ((u64, u64), f64, bool);
/// The document revision, the gap, the open-filled rule and the isolated object an [`AreaFinder`]
/// was made with.
type FinderKey = ((u64, u64), f64, bool, Option<NodeId>);
/// A search for the area under `p` on another thread, which hands back the finder it took.
struct HoverJob {
@@ -346,21 +414,26 @@ impl FillAreaTool {
}
fn finder_key(&self, cx: &ToolContext) -> FinderKey {
(cx.revision, self.gap(), self.open_filled_as_closed())
(cx.revision, self.gap(), self.open_filled_as_closed(), cx.isolation)
}
/// The finder for the document as `cx` has it, made again when the key changed.
/// The finder for the document as `cx` has it, made again when the key changed. In isolation
/// mode it takes only the isolated object's paths, as the command does.
fn take_finder(&mut self, cx: &ToolContext) -> AreaFinder {
let key = self.finder_key(cx);
match self.finder.take() {
Some((k, f)) if k == key => f,
_ => AreaFinder::new(cx.doc, &every_layer(cx.doc), key.1, key.2),
_ => {
// An isolated object Fill Area does not work in gives a finder of no paths.
let (roots, scope) = fill_area_roots(cx.doc, key.3, None).unwrap_or_default();
AreaFinder::new(cx.doc, &roots, scope, key.1, key.2)
}
}
}
/// The hover area when it is current and holds `p`.
fn hover_holding(&self, cx: &ToolContext, p: Point) -> Option<&EnclosedArea> {
self.hover.as_ref().filter(|(rev, a)| *rev == cx.revision && path_contains(&a.path, FillRule::NonZero, p)).map(|(_, a)| a)
self.hover.as_ref().filter(|(k, a)| *k == self.finder_key(cx) && path_contains(&a.path, FillRule::NonZero, p)).map(|(_, a)| a)
}
/// The area under `p`, found here and now (a click). A search running on another thread is
@@ -407,7 +480,7 @@ impl FillAreaTool {
Err(f) => finder = *f,
}
}
self.hover = finder.find(p).map(|a| (key.0, a));
self.hover = finder.find(p).map(|a| (key, a));
self.finder = Some((key, finder));
}
@@ -440,7 +513,7 @@ impl FillAreaTool {
}
// The area found serves wherever the pointer moved meanwhile, as long as it holds it.
let at = self.at;
self.hover = area.filter(|a| current && at.is_some_and(|p| path_contains(&a.path, FillRule::NonZero, p))).map(|a| (job.key.0, a));
self.hover = area.filter(|a| current && at.is_some_and(|p| path_contains(&a.path, FillRule::NonZero, p))).map(|a| (job.key, a));
if let Some(p) = at
&& self.hover.is_none()
&& (p != job.p || !current)
@@ -494,7 +567,7 @@ impl Tool for FillAreaTool {
fn overlays(&self, cx: &ToolContext) -> Vec<Overlay> {
self.hover
.iter()
.filter(|(rev, _)| *rev == cx.revision)
.filter(|(k, _)| *k == self.finder_key(cx))
.map(|(_, a)| Overlay::Path { path: a.path.to_bezpath(), color: HIGHLIGHT_RED, width: 3.0, dashed: false })
.collect()
}
+7 -1
View File
@@ -13228,7 +13228,13 @@ Double-clicking the Fill Area tool opens the Shape Builder Tool Options (`tool.o
The new path takes the current fill, stroke and stroke weight (`fill` and `stroke` override the paints), goes directly
above the front-most object along the area (one whose outline touches the area's outline, or that covers it) and is
selected. When a group, Live Paint group, Shaper group or clipping group holds that object, the new path goes above the
outermost group in its layer, not inside it, and the group keeps its members. A point in no enclosed area is the error "Fill Area: no enclosed area under the pointer" and records no undo
outermost group in its layer, not inside it, and the group keeps its members. In isolation mode only the paths in
the isolated layer or group bound areas, for the tool's hover and click and for the command (with `ids`, only the
paths of the listed objects that are in it), and the new path goes inside the isolated layer or group, directly above
the object in it that holds that path. No area is found while the isolated object is not a layer or group (a path
or compound path), is a Live Paint group, compound shape, Shaper group, graph, Image Trace result, dimension, flare or
Objects on Path group, is a layer or group with a live effect or a clipping mask, or lies inside one of these or
inside an envelope. A point in no enclosed area is the error "Fill Area: no enclosed area under the pointer" and records no undo
step; a `gap` outside 0 to 72 is an error. It returns `{id, above}`. The command looks for the area among the paths
near the point first. When the paths together have more than 65,536 segments and the paths near the point do not
enclose it, the point counts as in no enclosed area.
+1 -1
View File
@@ -1526,7 +1526,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
With Pick Color From Artwork, a merged shape takes the appearance, opacity and blending mode of the object where the drag starts, else of the object where it ends, else of the front-most selected object, as the [Shape Builder combine page](https://web.archive.org/web/20251006211643/https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/draw-shapes/combine-shapes-with-shape-builder-tool.html) describes. A click in an area that no selected object covers, such as a hole other shapes enclose, takes the front-most selected object's look (`shapeBuilder.merge` `points`: the first point is where the drag starts, and the last point is where it ends).
A Shift-drag with the Shape Builder tool draws a rectangular marquee for merging many paths at once, as [Combine shapes with the Shape Builder tool](https://web.archive.org/web/20251006211643/https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/draw-shapes/combine-shapes-with-shape-builder-tool.html) describes: the regions it reaches are shaded while it is drawn and merge into one shape on release, or with Alt they are deleted. The marquee reaches each region whose outline crosses it or has an anchor inside it, and the region that holds the whole marquee; this rule is VectorCraft's own. For Pick Color From Artwork, the marquee's starting corner is where the drag starts and the opposite corner is where it ends (`shapeBuilder.merge` `rect`).
The Shape Builder works on the selected paths, as [Combine shapes with the Shape Builder tool](https://web.archive.org/web/20251006211643/https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/draw-shapes/combine-shapes-with-shape-builder-tool.html) describes. As VectorCraft's own rule, a click or drag that builds nothing says why in the status bar when it is released: "Shape Builder: select paths or compound paths" when nothing is selected or the selection holds no unlocked, visible path; "Shape Builder: select all paths you want to merge" when the release is over a path or compound path that is not selected; and "Shape Builder: no region under the pointer" otherwise. The document, the selection and the undo history stay as they were, and the next gesture that builds something clears the message. Regression tests: `shape_builder_with_nothing_selected_says_what_to_select`, `shape_builder_names_the_unselected_path_under_a_release_that_built_nothing` and `shape_builder_replayed_gesture_over_nothing_gives_its_status_once` in `builder/tests.rs`, and `tests::build::shape_builder_click_that_builds_nothing_shows_why`.
As VectorCraft's own tool, Fill Area (in the Live Paint Bucket's group) adds a new closed path of the area under a click with the current fill and stroke, directly above the front-most object along it, and leaves the paths around it as they are. It needs no selection: the visible, unlocked paths on every layer bound areas, open paths and the overlap of filled shapes included, and it uses the Shape Builder's Gap Detection (`shapeBuilder.copyRegion`). Regression tests: `tests::fill_area::*`.
As VectorCraft's own tool, Fill Area (in the Live Paint Bucket's group) adds a new closed path of the area under a click with the current fill and stroke, directly above the front-most object along it, and leaves the paths around it as they are. It needs no selection: the visible, unlocked paths on every layer bound areas, open paths and the overlap of filled shapes included, and it uses the Shape Builder's Gap Detection (`shapeBuilder.copyRegion`). In isolation mode only the isolated layer or group's paths bound areas and the new path goes inside it. It finds no area while the isolated object is not a layer or group, is a group that makes, moves or combines its own art (Live Paint, compound shapes, Shaper groups, graphs, Image Trace results, dimensions, flares, Objects on Path), is a layer or group with a live effect or a clipping mask, or lies inside one of these or inside an envelope. Regression tests: `tests::fill_area::*`.
Shape Builder pieces on dense hatches (lines at exact 0.25 or 0.5 pt steps across another line) come back one per stretch between crossings, with no speck where the sweep cut a line's two passes a rounding error apart: the planar map contracts the stub between such cuts into one vertex, bounded by each cluster's extent so a run of tiny level segments keeps its length (`crates/pathops/src/planar.rs` tests `a_dense_hatch_at_exact_binary_steps_cuts_each_line_once_per_crossing`, `a_run_of_tiny_level_segments_is_not_contracted_as_stubs`, `a_line_crossed_where_its_two_passes_part_is_cut_once`).
The Shape Builder's gray hatch over the region under the pointer and the regions a drag has touched is drawn by a sweep that tests each hatch line only against the region's edges that span it, instead of every edge on every line. The hatch lines are the same, coordinate for coordinate; on a 2,000-sided region 1,000 hatches take about 83 ms of CPU time instead of 356 ms (release build, median of 7 alternating runs), and on a region of 40 sides the time is about the same, so the gain is on large, complex regions such as traced art (`crates/tools/src/builder/tests.rs` tests `hatch_matches_testing_every_edge`, `hatch_tests_only_the_edges_spanning_each_line` and `hatch_sweep_finds_the_crossings_of_every_edge`; timing: `hatch_perf`).
The planar map's edge-source grid stays linear in memory on any input: a segment is filed once per cell it crosses, and the grid holds at most a budget of cell references (a few dozen per item plus a few rows' worth), past which the remaining items go to a short scanned list and are still found, so thousands of coincident segments cannot make the index quadratic (`crates/pathops/src/planar.rs` test `rect_index_holds_a_bounded_number_of_references`).