mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-25 10:17:02 -06:00
The editing data writes a gradient mesh as its patches, each with its place in the grid (`/P`) and the grid's size (`/Size`); the importer read each patch as a mesh of its own, in a group, so moving a mesh point tore a patch away and left a hole, and a patch with anchors on its edges was cut into cells on its own. The patches are now placed by `/P` in the `/Size` grid and joined at the corners they share into one GradientMesh. Which index of `/P` runs along the columns is taken from the one under which the shared corners meet. Where an edge bends through anchors, a mesh line runs through the whole row or column of patches there, each patch cut at the same place, so every cell keeps single-cubic edges. A mesh whose patches don't say where they are reads as before; one whose patches fill the grid but don't join up reads as before with a warning. Sizes and lines are capped; non-finite values fall back. Hand-written tests: a 2 x 2 grid as one mesh with the old patches' colours, a moved inner point shared by its four cells, an anchor on a shared edge adding a line through the mesh, a collapsed patch with finite values, and unplaced or unjoined patches staying separate.