mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-24 18:32:23 +00:00
Merge pull request #8782 from storytold/train/carry8001
Fill Area: a click adds a path of the enclosed area and keeps the paths around it (#8001)
This commit is contained in:
+31
-2
@@ -2388,7 +2388,7 @@ and `type.fractionalWidths`; `flip` in `type.dynamicTextPreset`; `remove` and `o
|
||||
`swatch.addUsedColors`; `visible` in `appearance.setItem`; `copy` in `appearance.transfer`; `reverse` and `append` in
|
||||
`appearance.copyFrom`; `reverse` and `stroke` in `paint.editGradient`; `stroke` in `paint.setGradientGeom` and in
|
||||
`paint.freeform.addPoint`, `setPoint`, `deletePoint`, `addLine`, `splitLine` and `get`; `erase`,
|
||||
`openFilledAsClosed` and `splitStroke` in `shapeBuilder.merge`; `openFilledAsClosed` in `shapeBuilder.regions`; `closeGaps` in `livePaint.gapOptions`; and
|
||||
`openFilledAsClosed` and `splitStroke` in `shapeBuilder.merge`; `openFilledAsClosed` in `shapeBuilder.regions` and `shapeBuilder.copyRegion`; `closeGaps` in `livePaint.gapOptions`; and
|
||||
`enhanced` in `imageTrace.make` and `imageTrace.makeAndExpand`. A null is read as a key left out.
|
||||
|
||||
These commands refuse a string or another value that is not a number with `` `radius` must be a number, not "2" ``,
|
||||
@@ -2409,7 +2409,7 @@ and `fitMinPercent` in `text.areaOptions`; `x` and `y` in `symbol.place`; `radiu
|
||||
`symbol.spray`; `radius` and `intensity` in `symbol.adjust`; `to` in `swatch.move`; `weight` and `opacity` in
|
||||
`appearance.setItem`; `r`, `g`, `b`, `c`, `m`, `y`, `k`, `gray` and `tint` in `edit.colors.adjustBalance`; `steps`
|
||||
and `amount` in `color.harmony`; `angle` in `paint.editGradient` and in the `gradient` of a command that takes a paint; `t` in
|
||||
`paint.freeform.splitLine`; `tolerance` and `gap` in `shapeBuilder.merge`; `gap` in `shapeBuilder.regions`; and
|
||||
`paint.freeform.splitLine`; `tolerance` and `gap` in `shapeBuilder.merge`; `gap` in `shapeBuilder.regions` and `shapeBuilder.copyRegion`; and
|
||||
`width` and `tolerance` in `livePaint.strokeEdge`. A null is read as a key left out. A gradient stop that names a
|
||||
swatch refuses a `tint` that is not a number with `` stop 0: `tint` must be a number ``.
|
||||
|
||||
@@ -13565,6 +13565,35 @@ a stroke when it has `rect`. With both `rect` and `points`, the command also tou
|
||||
{"name":"run_command","arguments":{"command":"shapeBuilder.merge","params":{"rect":[50,50,200,200]}}}
|
||||
```
|
||||
|
||||
The Fill Area tool (`fillArea`, in the Live Paint Bucket's group) adds a new closed path of the area under a click
|
||||
and leaves the paths around it as they are. Nothing needs to be selected: the visible, unlocked paths on every layer
|
||||
bound areas, filled or not, open paths included, and the overlap of two filled shapes is an area of its own. While the
|
||||
pointer hovers an area, the tool outlines it in red and the pointer shows the bucket with paint; elsewhere the pointer
|
||||
shows the empty bucket, and a click there does nothing. The new path appears on the press and is kept on the release;
|
||||
Escape or a canceled touch before the release takes it back. In a document of more than 128 path segments the tool looks
|
||||
for the hovered area on another thread, and the outline appears when that search is done. The tool sends `shapeBuilder.copyRegion` with `point`, the Shape Builder's gap
|
||||
length (`gap`, 0 with Gap Detection off) and its `openFilledAsClosed`: the two tools share `gapDetection`, `gapLength`
|
||||
and `openFilledAsClosed`, so `tool.setOption` on either one sets them for both, and `fillArea` has no other options.
|
||||
Double-clicking the Fill Area tool opens the Shape Builder Tool Options (`tool.options {tool: "fillArea"}`, dialog
|
||||
`shapeBuilderOptions`).
|
||||
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. 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.
|
||||
|
||||
```json
|
||||
{"name":"run_command","arguments":{"command":"shapeBuilder.copyRegion","params":{"point":[50,70],"gap":3}}}
|
||||
```
|
||||
|
||||
## Perspective grid
|
||||
|
||||
The grid is document data (`perspective.grid.set` edits the model directly). `perspective.grid.get` reads it:
|
||||
|
||||
@@ -1547,6 +1547,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`). 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`).
|
||||
|
||||
Reference in New Issue
Block a user