Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(): Path controls utility #9998

Merged
merged 16 commits into from
Aug 4, 2024
Merged

feat(): Path controls utility #9998

merged 16 commits into from
Aug 4, 2024

Conversation

asturur
Copy link
Member

@asturur asturur commented Jul 14, 2024

Description

This PR introduces the utilities for path controls.
Those utils use the control api to build a control set that is useful to edit Paths.
The controls reference their points through indexes of command and must be recreated if new commands get added or removed to the path.

In Action

image

Copy link

codesandbox bot commented Jul 14, 2024

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

Copy link
Contributor

github-actions bot commented Jul 14, 2024

Build Stats

file / KB (diff) bundled minified
fabric 919.524 (+5.797) 306.618 (+2.048)

@asturur
Copy link
Member Author

asturur commented Jul 14, 2024

Just a reminder that this code was originally thought and proven in ~2017 with @r-a-c-h-e-l.
It finally see the light of day.

@asturur
Copy link
Member Author

asturur commented Jul 30, 2024

Ok i think is done now, i need some test.

@asturur asturur marked this pull request as ready for review July 30, 2024 07:05
@asturur
Copy link
Member Author

asturur commented Jul 30, 2024

Couldn't really squeeze the code more than this, i managed to make it 1.5kb instead of 2, but the re-usability was bad and also wasn't a good example to developers for other custom functions

@vadimcoder
Copy link

This is a great feature! Looking forward to having it.

@asturur
Copy link
Member Author

asturur commented Jul 31, 2024

Needs tests and the occasion for an explainer on the website on how to do those things with the control api. But the feature itself is ready imho

Copy link
Contributor

github-actions bot commented Aug 4, 2024

Coverage after merging path-controls into master will be

83.75%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
index.node.ts14.29%100%0%25%23, 26, 29, 41, 44, 47
src
   ClassRegistry.ts88.71%53.85%100%97.73%31, 52, 52
   Collection.ts71.39%31.15%45.16%83.91%130, 138, 153, 155–157, 159, 169–170, 180–181, 197, 215, 217, 219, 228, 243, 254, 263, 265, 270, 279, 281, 283, 286–287, 302, 304, 306, 309–310, 327–328, 328, 328–329, 333–334, 337–344, 346–348, 350, 75, 99
   CommonMethods.ts88.57%64.29%83.33%96%50, 52, 9
   Intersection.ts81.42%41.30%73.33%96.14%105, 132–133, 166, 184–190, 228, 228, 237, 239, 289–291, 297, 297, 78, 80
   Observable.ts72.40%45.45%31.25%86.36%144, 153, 156, 168, 170, 173, 175, 41, 43, 68–70, 72, 76, 78, 80, 82–85, 87–91
   Point.ts84.43%61.22%41.18%92.38%104, 117, 148, 157, 179, 197, 206, 216, 225, 236–239, 259, 284–285, 294–297, 317, 328, 341, 349, 359, 95
   Shadow.ts81.22%13.04%37.50%90.19%144, 144–145, 145–146, 148, 150–155, 164, 181, 181, 181, 181, 199, 199, 201–202, 202, 204, 211, 211, 228–235, 237, 237, 239–240
   cache.ts83.72%45.45%75%90.14%57, 59, 71–72, 74–77
   config.ts82.21%20%44.44%94.03%123, 131–132, 134–137, 139, 142–143, 147, 152, 152, 152, 152, 152, 152
   constants.ts100%100%100%100%
src/LayoutManager
   ActiveSelectionLayoutManager.ts86.67%76.92%28.57%100%
   LayoutManager.ts89.22%65.06%53.85%99.31%279, 344, 355
   constants.ts100%100%100%100%
   index.ts48.57%37.50%80%66.67%1, 1, 1–2, 2, 2–3, 3, 3–4, 4, 4–5, 5, 5, 5–6
   types.ts100%100%100%100%
src/LayoutManager/LayoutStrategies
   ClipPathLayout.ts71.05%37.50%100%78.95%39, 41–44, 46–48, 54, 57–58, 66–69
   FitContentLayout.ts100%100%100%100%
   FixedLayout.ts85.71%20%100%100%23, 23
   LayoutStrategy.ts84.17%48.15%71.43%96.51%46, 52, 54, 73, 73, 75, 88
   utils.ts62.90%7.14%100%78.72%28–32, 34–35, 39, 39–44, 47, 47, 47
src/Pattern
   Pattern.ts54.39%3.03%10%65.95%105–107, 113, 113–114, 117, 117–119, 119, 119–122, 130, 130–132, 132, 132, 132, 132, 132–138, 140–141, 143, 150, 150, 150, 150, 153–160, 160, 160–164, 174–175, 175, 175, 175–176, 176, 176–182, 182, 182, 182–183, 183, 183–188, 190–199, 204–205, 207–209, 211, 33, 37
src/brushes
   BaseBrush.ts78.67%8.33%14.29%88.55%110, 114, 114–115, 122, 122, 122, 122, 124–125, 130, 135, 143, 146, 155, 155, 155, 155, 155–160, 99
   CircleBrush.ts52.10%12.50%12.50%58.25%100–108, 108–118, 122, 130–139, 55, 67, 69, 76, 76, 78–79, 79, 83, 85–86, 92–98
   PatternBrush.ts97.06%87.50%100%100%21
   PencilBrush.ts91.06%82.35%100%93.81%122–123, 152, 152–154, 176, 176, 276, 280, 285–286, 68–69, 84–85
   SprayBrush.ts0%0%0%0%107, 107, 107, 107, 107–108, 110–111, 118–119, 121, 123–127, 136, 140–141, 141, 148, 148, 148–151, 153–156, 160–161, 163, 165–168, 17, 171, 178–179, 18, 181, 183–184, 186, 193–194, 196–197, 20, 200, 200, 207, 207, 21, 211, 22, 22, 22–24, 28, 32, 39, 46, 53, 60, 67, 84–86, 94–96, 98–99
src/canvas
   Canvas.ts72.51%30.38%78.57%84.40%1004, 1008, 1012–1013, 1018, 1022, 1031–1032, 1047, 1049, 1056, 1058, 1063–1068, 1105, 1126, 1128, 1130, 1137, 1140, 117, 1203–1207, 1249, 1252, 1260, 1285–1290, 1314, 1317, 1334, 1377, 1380–1404, 1404–1409, 1409–1414, 1418, 1420–1421, 1423–1425, 1429, 1431–1435, 1438–1443, 1446–1448, 1451, 1453, 1465, 1467, 1474, 1476–1487, 1489–1492, 1492, 1494, 1498–1499, 1502–1503, 1506–1508, 1511, 183, 318, 328, 353, 369, 388, 431, 443, 559–563, 566–567, 569, 579, 582–583, 585, 588–590, 602, 609–613, 615–620, 622–626, 659, 661, 668–672, 674–679, 681, 683–684, 686–689, 691–692, 703, 747, 783–786, 789, 791, 791, 794, 796, 798, 824, 830, 839–840, 844, 853, 870, 870, 886–887, 906, 932–933, 935–936, 938, 947–953, 956, 964–970, 972, 974, 995–996, 999
   CanvasOptions.ts100%100%100%100%
   SelectableCanvas.ts83.70%49.39%80%94.38%1006, 1008–1009, 1026, 1035, 1103–1107, 1153–1154, 1156–1157, 1159, 1186, 1188–1189, 1189, 1191, 1230, 1232, 1234, 1250, 1252, 1280,

@asturur asturur merged commit 2c24f6b into master Aug 4, 2024
20 checks passed
@asturur asturur deleted the path-controls branch August 4, 2024 08:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants