Alonso Torres 217284b1e1
Improve path operations and edition (#10807)
*  Improve path operations and edition

* 🐛 Fix floating-point equality issues in path editing

Replace exact equality checks with tolerance-based comparisons
in path editing functions to handle floating-point rounding
differences after transforms, rotations, or curve fitting.

Changes:
- distribute-content: Round coordinates to 0.1 precision before
  grouping to ensure coincident nodes move together
- separate-node: Use gpt/close? instead of exact equality to
  find nodes with floating-point imprecision
- collision-step: Use mth/close? for tolerance-based comparison
  to detect paste collisions correctly
- resolve-edit-fills: Add cycle detection to prevent infinite
  loops with corrupted parent chains

Made collision-step, available-offset-step, and resolve-edit-fills
public for better testability.

Added comprehensive tests for all fixes covering both exact and
floating-point coordinate scenarios.

AI-assisted-by: qwen3.7-plus

* 🐛 Fix path editor code review findings

Fix issues identified during code review of path editor enhancements:

- Fix unused binding lint warning in distribute-content that blocked CI
- Fix collision-step floor comparison to use round instead of floor,
  correctly detecting collisions when coordinates drift slightly below
  integer boundaries
- Fix resolve-edit-fills to recurse through empty parent groups when
  searching for inherited fills in nested group hierarchies
- Fix expand-coincident-node-indices to use fuzzy comparison (gpt/close?)
  instead of exact equality, handling floating-point divergence after
  transforms or rotations
- Remove unreachable dead code in path-point* on-pointer-down handler
- Add tests for collision-step boundary cases, nested group fill
  inheritance, and coincident node alignment/flipping

AI-assisted-by: mimo-v2.5-pro

---------

Co-authored-by: Andrey Antukh <niwi@niwi.nz>
2026-08-27 10:51:10 +02:00

7 lines
3.3 KiB
XML

<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 16 16">
<g transform="scale(0.76190476)">
<path d="M17.2916 13.4999C17.7886 13.4999 18.1919 13.9033 18.192 14.4003V15.8075H19.5992C20.0962 15.8075 20.4995 16.2109 20.4996 16.7079V17.2919C20.4996 17.7889 20.0963 18.1923 19.5992 18.1923H18.192V19.5995C18.192 20.0965 17.7887 20.4999 17.2916 20.4999H16.7076C16.2108 20.4997 15.8073 20.0964 15.8073 19.5995V18.1923H14.4C13.9031 18.1921 13.4996 17.7888 13.4996 17.2919V16.7079C13.4997 16.211 13.9032 15.8077 14.4 15.8075H15.8073V14.4003C15.8073 13.9034 16.2108 13.5001 16.7076 13.4999H17.2916ZM0.88147 -0.0987549L1.00256 -0.0782471L1.99182 0.146362C2.3212 0.21982 2.65134 0.291628 2.98108 0.361206C4.00487 0.577222 5.31171 0.836914 6.47229 1.01648C7.39815 1.15971 8.48521 1.32758 9.51331 1.64441C10.5453 1.96253 11.6032 2.45468 12.4391 3.30359C14.1063 4.99746 14.7467 6.98154 14.6783 9.37097L15.8883 10.5809C16.4936 11.1862 16.4936 12.168 15.8883 12.7733L12.7731 15.8885C12.1678 16.4938 11.186 16.4938 10.5807 15.8885L9.37073 14.6786C6.98134 14.747 4.99719 14.1065 3.30334 12.4393C2.45441 11.6035 1.96229 10.5455 1.64417 9.51355C1.32731 8.48543 1.15947 7.39842 1.01624 6.47253C0.836669 5.31192 0.576975 4.00516 0.360962 2.98132C0.221743 2.3215 0.0738358 1.66228 -0.0784912 1.00281C-0.218776 0.394559 0.283552 -0.155568 0.88147 -0.0987549Z" fill="white"/>
<path d="M17.2922 14.0001C17.513 14.0001 17.6923 14.1788 17.6926 14.3995V16.3077H19.5998C19.8205 16.3077 19.9999 16.4865 20.0002 16.7072V17.2921C20.0002 17.513 19.8207 17.6925 19.5998 17.6925H17.6926V19.5997C17.6926 19.8206 17.5131 20.0001 17.2922 20.0001H16.7072C16.4865 19.9999 16.3078 19.8205 16.3078 19.5997V17.6925H14.3996C14.1789 17.6923 14.0002 17.5129 14.0002 17.2921V16.7072C14.0004 16.4866 14.179 16.308 14.3996 16.3077H16.3078V14.3995C16.308 14.179 16.4867 14.0004 16.7072 14.0001H17.2922ZM0.889832 0.408325C1.55119 0.561087 2.21384 0.710545 2.87811 0.850708C3.90528 1.06744 5.22258 1.32923 6.39667 1.51086C7.32828 1.65499 8.37875 1.81778 9.36639 2.12219C10.3562 2.42732 11.3274 2.88674 12.0832 3.65442C13.6878 5.28471 14.2849 7.19577 14.174 9.57336L15.5353 10.9347C15.9452 11.3448 15.9453 12.01 15.5353 12.42L12.4201 15.5353C12.0101 15.9453 11.3448 15.9452 10.9348 15.5353L9.57343 14.174C7.19581 14.2849 5.28478 13.6877 3.65448 12.0831C2.88678 11.3274 2.42739 10.3562 2.12225 9.36633C1.81784 8.37867 1.65505 7.32823 1.51093 6.39661C1.32929 5.2225 1.06749 3.90523 0.850769 2.87805C0.710614 2.21378 0.56115 1.55113 0.408386 0.889771C0.342017 0.601058 0.601117 0.34194 0.889832 0.408325ZM7.1496 6.35266C7.77157 6.05022 8.54221 6.15652 9.05878 6.67297C9.71018 7.32455 9.71021 8.38079 9.05878 9.03235C8.40723 9.6839 7.35102 9.68379 6.6994 9.03235C6.18548 8.51832 6.07823 7.7533 6.37518 7.13293L1.93964 2.71301C2.1554 3.73878 2.41539 5.04925 2.59784 6.22864C2.74397 7.17322 2.8961 8.14467 3.17303 9.04309C3.44934 9.93927 3.83806 10.7193 4.42694 11.299C5.85147 12.701 7.63567 13.1258 9.54999 13.0695C9.83791 13.0611 10.1196 13.1647 10.3234 13.3683L11.6769 14.7218L14.7219 11.6769L13.3683 10.3234C13.1648 10.1196 13.0611 9.83786 13.0695 9.54993C13.1258 7.63562 12.701 5.8514 11.299 4.42688C10.7194 3.838 9.93933 3.44928 9.04315 3.17297C8.14473 2.89604 7.17327 2.74391 6.2287 2.59778C5.05377 2.41601 3.74882 2.15681 2.72479 1.94153L7.1496 6.35266Z" fill="black"/>
</g>
</svg>