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

chore(TS): Group #8455

Merged
merged 31 commits into from
Nov 26, 2022
Merged

chore(TS): Group #8455

merged 31 commits into from
Nov 26, 2022

Conversation

ShaMan123
Copy link
Contributor

@ShaMan123 ShaMan123 commented Nov 21, 2022

Motivation

Description

Migrate Group & ActiveSelection

Changes

  • removed redundant deep clone of option in fromObject 4e8db1a
  • removed Rect TObject stub types

Gist

Will have conflicts with #8431 - should resolve with union strategy, sort of. I can do it

In Action

@github-actions
Copy link
Contributor

github-actions bot commented Nov 21, 2022

Build Stats

file / KB (diff) bundled minified
fabric 1041.905 (-8.352) 311.214 (-0.716)

commit 7e7e6e7
Merge: 050ea1a d02fbf0
Author: ShaMan123 <[email protected]>
Date:   Sun Nov 20 15:23:30 2022 +0200

    Merge branch 'master' into fix-transformer

commit 050ea1a
Author: ShaMan123 <[email protected]>
Date:   Tue Nov 1 08:30:56 2022 +0200

    fix mixin parsing

commit 44eb941
Author: ShaMan123 <[email protected]>
Date:   Tue Nov 1 07:45:16 2022 +0200

    Update index.mjs

commit 450e795
Author: ShaMan123 <[email protected]>
Date:   Mon Oct 31 23:51:18 2022 +0200

    Update CHANGELOG.md

commit 9345400
Merge: 459e72f 2c0817b
Author: ShaMan123 <[email protected]>
Date:   Mon Oct 31 23:49:25 2022 +0200

    Merge branch 'master' into fix-transformer

commit 459e72f
Merge: f9071cf 5d95075
Author: ShaMan123 <[email protected]>
Date:   Mon Oct 31 23:33:32 2022 +0200

    Merge branch 'master' into fix-transformer

commit f9071cf
Author: ShaMan123 <[email protected]>
Date:   Mon Oct 31 21:52:32 2022 +0200

    Update transform_files.mjs

commit 6ebf5ff
Author: ShaMan123 <[email protected]>
Date:   Mon Oct 31 20:31:18 2022 +0200

    Update transform_files.mjs

commit 6433c0b
Author: ShaMan123 <[email protected]>
Date:   Mon Oct 31 20:09:43 2022 +0200

    Update transform_files.mjs

commit 5793489
Author: ShaMan123 <[email protected]>
Date:   Mon Oct 31 20:01:55 2022 +0200

    Update transform_files.mjs

commit 06a12b0
Author: ShaMan123 <[email protected]>
Date:   Mon Oct 31 19:39:23 2022 +0200

    Update transform_files.mjs

commit 4111587
Author: ShaMan123 <[email protected]>
Date:   Mon Oct 31 19:37:41 2022 +0200

    Create out.ts

commit a2f29c0
Author: ShaMan123 <[email protected]>
Date:   Mon Oct 31 18:56:48 2022 +0200

    Update transform_files.mjs

commit 6587d19
Author: ShaMan123 <[email protected]>
Date:   Mon Oct 31 18:49:32 2022 +0200

    Update transform_files.mjs

commit c3bf999
Author: ShaMan123 <[email protected]>
Date:   Mon Oct 31 18:45:46 2022 +0200

    Update transform_files.mjs

commit 8105167
Author: ShaMan123 <[email protected]>
Date:   Mon Oct 31 18:37:17 2022 +0200

    Update transform_files.mjs

commit b8de8aa
Author: ShaMan123 <[email protected]>
Date:   Mon Oct 31 18:34:27 2022 +0200

    Update transform_files.mjs

commit 2d1d1da
Author: ShaMan123 <[email protected]>
Date:   Mon Oct 31 18:22:47 2022 +0200

    Update transform_files.mjs

commit 781fe55
Author: ShaMan123 <[email protected]>
Date:   Mon Oct 31 18:18:01 2022 +0200

    Update transform_files.mjs

commit daf443f
Author: ShaMan123 <[email protected]>
Date:   Mon Oct 31 18:16:48 2022 +0200

    Update transform_files.mjs

commit 3c55455
Author: ShaMan123 <[email protected]>
Date:   Mon Oct 31 17:41:30 2022 +0200

    Update transform_files.mjs

commit f567fcf
Author: ShaMan123 <[email protected]>
Date:   Mon Oct 31 17:24:54 2022 +0200

    Update transform_files.mjs

commit 9ab2ea3
Author: ShaMan123 <[email protected]>
Date:   Mon Oct 31 17:16:13 2022 +0200

    Update transform_files.mjs

commit b3c73d1
Author: ShaMan123 <[email protected]>
Date:   Mon Oct 31 17:10:30 2022 +0200

    Update transform_files.mjs

commit f6d9031
Author: ShaMan123 <[email protected]>
Date:   Mon Oct 31 16:51:10 2022 +0200

    Update transform_files.mjs

commit 6208499
Author: ShaMan123 <[email protected]>
Date:   Mon Oct 31 15:51:00 2022 +0200

    Update transform_files.mjs

commit 483379a
Author: ShaMan123 <[email protected]>
Date:   Mon Oct 31 13:38:10 2022 +0200

    static

commit 316ba1a
Author: ShaMan123 <[email protected]>
Date:   Mon Oct 31 13:28:03 2022 +0200

    Update transform_files.mjs

commit bcb3124
Author: ShaMan123 <[email protected]>
Date:   Mon Oct 31 12:00:43 2022 +0200

    Update transform_files.mjs

commit 1d555ad
Author: ShaMan123 <[email protected]>
Date:   Mon Oct 31 11:53:37 2022 +0200

    Update transform_files.mjs

commit 5a04341
Author: ShaMan123 <[email protected]>
Date:   Mon Oct 31 11:38:11 2022 +0200

    Update transform_files.mjs

commit 322c271
Author: ShaMan123 <[email protected]>
Date:   Mon Oct 31 10:13:37 2022 +0200

    Update transform_files.mjs

commit 9b7f6f9
Author: ShaMan123 <[email protected]>
Date:   Mon Oct 31 09:57:55 2022 +0200

    Update transform_files.mjs

commit e86aa95
Author: ShaMan123 <[email protected]>
Date:   Mon Oct 31 08:32:27 2022 +0200

    Update transform_files.mjs

commit f23227f
Author: ShaMan123 <[email protected]>
Date:   Mon Oct 31 08:26:14 2022 +0200

    ast!
@ShaMan123
Copy link
Contributor Author

ShaMan123 commented Nov 21, 2022

@asturur do you want me to extract the layout mechanism to a standalone class in a dedicated PR?
Now, after working on controls, I have a better idea using originX/Y in relation to group to position objects in layout. It should simplify logic a great deal, but might add additional iterations over objects.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 21, 2022

Coverage after merging ts-group into master will be

82.37%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
HEADER.js54%48.15%0%63.64%12, 14, 14, 14, 14, 14, 16–17, 21, 21–22, 22, 22, 24, 24, 26, 28, 30–31, 77, 77, 77
src
   cache.ts97.06%90%100%100%56
   canvas.class.ts93.36%90.22%94.12%95.54%1045, 1045–1046, 1049, 1069, 1069, 1104, 1137–1138, 1166–1167, 1200, 1208, 1318–1319, 1321–1322, 1342–1343, 1501, 1506, 1516, 1520, 472–473, 478, 487, 636–638, 683–684, 733–734, 737, 739, 782–784, 826, 831–832, 860–861
   config.ts77.27%66.67%66.67%84.62%130, 138–140, 151–153
   constants.ts100%100%100%100%
   intersection.class.ts100%100%100%100%
   pattern.class.ts92.19%85.71%100%96.30%109, 115, 126, 135, 87
   point.class.ts100%100%100%100%
   shadow.class.ts98.51%96%100%100%156
   static_canvas.class.ts89.83%83.28%96.70%92.55%1112–1113, 1113, 1113–1114, 1248, 1314–1315, 1318, 1367–1368, 1461, 1476, 1480, 1506–1507, 1536–1537, 1570–1571, 1612–1613, 1616, 1618, 1618, 1618, 1618, 1622, 1622, 1622–1624, 1646–1647, 1688–1689, 1692, 1694, 1694, 1694, 1694, 1698, 1698, 1698–1700, 1771, 1771–1772, 1830, 1832, 1832, 1832, 1832, 1832–1833, 1836–1837, 1837, 1837–1838, 1841, 1841, 1841, 1843, 1846, 1852, 1854–1855, 1855, 1855, 1858–1859, 1859, 1859, 1862, 319–320, 322–323, 325–326, 339–340, 342–343, 57, 658–661, 783, 783–784, 861
src/brushes
   base_brush.class.ts100%100%100%100%
   circle_brush.class.ts1.52%0%0%2%101, 103–105, 114, 114, 114, 116, 118, 120–122, 124–127, 135, 142, 144, 24, 29–30, 38–42, 46–50, 57–60, 68–72, 74, 82, 82, 82, 82, 82–83, 85, 85, 85–88, 90, 98–99
   pattern_brush.class.ts5.26%0%0%8.33%16, 20–23, 25–26, 26, 26–29, 37–38, 40, 44, 55, 55, 55, 63–65, 65, 65, 72–73, 75–76, 76, 80
   pencil_brush.class.ts91.91%85.42%100%93.64%122–123, 152, 152–154, 276, 280, 285–286, 68–69, 84–85
   spray_brush.class.ts1.16%0%0%1.56%100–102, 104–105, 113, 113, 113, 113, 113–114, 116–117, 124–125, 127, 129–133, 142, 146–147, 147, 155, 155, 155–158, 160–163, 167–168, 170, 172–175, 178, 185–186, 188, 190–191, 193, 200–201, 203–204, 207, 207, 214, 214, 218, 23–24, 26–28, 28, 28–30, 34, 43, 50, 57, 64, 71, 78, 90–92
src/color
   color.class.ts91.67%84.51%100%94.44%325–326, 330–331, 334–335, 41, 45, 72–73, 73, 75, 75, 75–76, 78–79
   color_map.ts100%100%100%100%
   constants.ts100%100%100%100%
   index.ts100%100%100%100%
   util.ts100%100%100%100%
src/controls
   actions.ts100%100%100%100%
   changeWidth.ts100%100%100%100%
   control.class.ts93.98%88.89%90.91%97.78%236, 320, 320, 355
   controls.render.ts81.63%78%100%84.78%106, 111, 121, 121, 45, 50, 61, 61, 65–72, 81–82
   default_controls.ts72.73%50%100%100%109, 113, 120
   drag.ts100%100%100%100%
   rotate.ts20%12.50%50%22.22%44, 50, 50, 50–51, 54–56, 58, 58, 58, 58, 58–60, 60, 60–62, 64, 64, 64–66, 66, 66–67, 72, 72, 72–73, 75, 77, 79–80
   scale.ts94.41%94.74%100%93.59%129–130, 132–134, 181–183, 42
   scaleSkew.ts80.56%66.67%100%92.31%14, 28, 30, 30, 30, 32, 34
   skew.ts91.03%79.31%100%97.67%131–132, 163–164, 171, 177, 179
   util.ts100%100%100%100%
   wrapWithFireEvent.ts100%100%100%100%
   wrapWithFixedAnchor.ts100%100%100%100%
src/filters
   2d_backend.class.ts92%83.33%100%93.75%35–36
   FilterBackend.ts88.89%83.33%100%90%11–12
   WebGLProbe.ts40.54%40%60%36.36%28–30, 30, 30–31, 33–35, 43, 46–48, 48, 48–51, 53, 58
   base_filter.class.ts22.35%20.41%38.10%20%100, 102–104, 104, 104–105, 112–114, 114, 114–115, 122–125, 125, 125–126, 132, 132, 132–135, 153, 183–188, 192–193, 193, 193–196, 196, 196, 196, 196–198, 204, 213–214, 219–223, 266–269, 285, 285, 285–286, 288, 304–306, 306, 306, 306, 306–307, 309, 311–312, 314–315, 317–319, 327–328, 33, 330, 334–336, 340, 340, 340, 344, 344, 344–345, 367, 367, 367–371, 54–55, 83–84, 86, 86, 86–87, 87, 90, 95–97, 99, 99, 99, 99, 99, 99
   blendcolor_filter.class.ts10%4.76%28.57%9.72%104, 126, 128, 128, 128–130, 135, 145–147, 155, 157–160, 162–165, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 169–172,

@ShaMan123 ShaMan123 requested a review from asturur November 21, 2022 17:11
Copy link
Contributor Author

@ShaMan123 ShaMan123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ready to extract layout mechanism or to merge

(obj) => obj instanceof Collection && obj.contains(object, true)
(obj) =>
obj instanceof Collection &&
(obj as unknown as Collection).contains(object, true)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TS doesn't manage to cope with this line

_renderControls(
ctx: CanvasRenderingContext2D,
styleOverride?: ControlRenderingStyleOverride,
childrenOverride?: ControlRenderingStyleOverride
Copy link
Contributor Author

@ShaMan123 ShaMan123 Nov 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

guessed these types

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems correct

* keeps track of the selected objects
* @private
*/
__objectSelectionMonitor(selected: boolean, opt) {
Copy link
Contributor Author

@ShaMan123 ShaMan123 Nov 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

opt can be typed when #8431 is merged

@ShaMan123
Copy link
Contributor Author

This PR finalizes shapes!

@ShaMan123
Copy link
Contributor Author

Once this PR is merged I will convert all Group PRs to TS.

@asturur
Copy link
Member

asturur commented Nov 26, 2022

@asturur do you want me to extract the layout mechanism to a standalone class in a dedicated PR? Now, after working on controls, I have a better idea using originX/Y in relation to group to position objects in layout. It should simplify logic a great deal, but might add additional iterations over objects.

I would like to do that, because that is the only way for me to settle on what to do with those layout strategies.

*/
_onAfterObjectsChange(type: 'added' | 'removed', targets: FabricObject[]) {
// @TODO figure out this change. This part wasn't here before migration.
super._onAfterObjectsChange(type, targets);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I m merging now, but i wonder why we added this line here.
This adds an extra layout call that we weren't doing before?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, correct.
It was a bug that I fixed in a pending PR so I decided to put it here

@asturur asturur merged commit 59e6a22 into master Nov 26, 2022
@ShaMan123 ShaMan123 mentioned this pull request Nov 26, 2022
48 tasks
@asturur asturur deleted the ts-group branch November 27, 2022 00:15
frankrousseau pushed a commit to cgwire/fabric.js that referenced this pull request Jan 6, 2023
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