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

fix(Group): patch2 minors #7916

Merged
merged 6 commits into from
Jun 10, 2022
Merged

fix(Group): patch2 minors #7916

merged 6 commits into from
Jun 10, 2022

Conversation

asturur
Copy link
Member

@asturur asturur commented Apr 30, 2022

This PR rename canEnter in canEnterGroup and move canEnterGroup to an higher level of the logic so that it can stops adding not supported objects to groups.

Background color has been left in for group since the layers in group concept may be slow to enter fabricjs.

@asturur asturur changed the title minimal changes fix(Group): patch2 minors Apr 30, 2022
@asturur
Copy link
Member Author

asturur commented Apr 30, 2022

replace #7900
@ShaMan123 have a look at this solution to catching the issue before need to throw

@github-actions
Copy link
Contributor

github-actions bot commented Apr 30, 2022

Code Coverage Summary

> fabric@5.1.0 coverage:report
> nyc report --reporter=lcov --reporter=text

-----------|---------|----------|---------|---------|-----------------------------------------------
File       | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s                             
-----------|---------|----------|---------|---------|-----------------------------------------------
All files  |   83.05 |    75.93 |   85.71 |   82.78 |                                               
 fabric.js |   83.05 |    75.93 |   85.71 |   82.78 | ...,30840,30914,30925-30990,31113,31212,31448 
-----------|---------|----------|---------|---------|-----------------------------------------------

@github-actions
Copy link
Contributor

github-actions bot commented Apr 30, 2022

Code Coverage Summary

> fabric@5.1.0 coverage:report
> nyc report --reporter=lcov --reporter=text

-----------|---------|----------|---------|---------|-----------------------------------------------
File       | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s                             
-----------|---------|----------|---------|---------|-----------------------------------------------
All files  |   83.05 |    75.93 |   85.71 |   82.78 |                                               
 fabric.js |   83.05 |    75.93 |   85.71 |   82.78 | ...,30842,30916,30927-30992,31115,31214,31450 
-----------|---------|----------|---------|---------|-----------------------------------------------

@github-actions
Copy link
Contributor

github-actions bot commented Apr 30, 2022

Code Coverage Summary

> fabric@5.1.0 coverage:report
> nyc report --reporter=lcov --reporter=text

-----------|---------|----------|---------|---------|-----------------------------------------------
File       | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s                             
-----------|---------|----------|---------|---------|-----------------------------------------------
All files  |   83.06 |    75.96 |   85.71 |   82.79 |                                               
 fabric.js |   83.06 |    75.96 |   85.71 |   82.79 | ...,30842,30916,30927-30992,31115,31214,31450 
-----------|---------|----------|---------|---------|-----------------------------------------------

Copy link
Contributor

@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.

This is much better no doubt.

However:

The advantage of moving it to add/insertAt is clear. That's how it should be. The disadvantage is a drop in perf for large groups because we add an iteration over objects. Unless we manage to change collection logic to run all logic on object in one single iteration

Originally posted by @ShaMan123 in #7900 (comment)

But I think we should move forward

@ShaMan123
Copy link
Contributor

Background color has been left in for group since the layers in group concept may be slow to enter fabricjs.

Could you explain why Layer will take time to merge into master?
I am fine with dropping background. I have worked around it in my projects.

@ShaMan123 ShaMan123 self-requested a review May 1, 2022 04:38
Copy link
Contributor

@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.

@ShaMan123 ShaMan123 mentioned this pull request May 1, 2022
11 tasks
@asturur
Copy link
Member Author

asturur commented May 1, 2022

Background color has been left in for group since the layers in group concept may be slow to enter fabricjs.

Could you explain why Layer will take time to merge into master? I am fine with dropping background. I have worked around it in my projects.

Because i have seen the PR, and i don't like the idea of having special logic to allow layers to react to both canvas and group container. I want to simplify things not make more complicated. The layer per se is ok, a dimensionless group always interactive. fine.
the gymmics in the layout management less.
But we can talk there, or maybe we could make an hands on and see how we can make it simpler.

@asturur
Copy link
Member Author

asturur commented May 1, 2022

The only large group i know of is the spray brush, can you think of others?
maybe the spray brush shouldn't be a group with thons of rect or circles, it should be just a function able to render a spray effect.

@ShaMan123
Copy link
Contributor

I guess you are right. I don't use huge groups in my projects.

@ShaMan123 ShaMan123 mentioned this pull request May 1, 2022
48 tasks
@ShaMan123
Copy link
Contributor

This next? Don't forget my review

@github-actions
Copy link
Contributor

github-actions bot commented Jun 10, 2022

Code Coverage Summary

> fabric@5.1.0 coverage:report
> nyc report --reporter=lcov --reporter=text

-----------|---------|----------|---------|---------|-----------------------------------------------
File       | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s                             
-----------|---------|----------|---------|---------|-----------------------------------------------
All files  |   83.07 |    76.01 |    85.7 |   82.79 |                                               
 fabric.js |   83.07 |    76.01 |    85.7 |   82.79 | ...,30881,30955,30966-31031,31154,31253,31489 
-----------|---------|----------|---------|---------|-----------------------------------------------

@asturur
Copy link
Member Author

asturur commented Jun 10, 2022

Applied fixes and merging

@asturur asturur merged commit eb25d2b into master Jun 10, 2022
Copy link
Contributor

@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.

What about insertAt - we should filter that as well

if (object === this || this.isDescendantOf(object)) {
/* _DEV_MODE_START_ */
console.warn('fabric.Group: trying to add group to itself, this call has no effect');
console.error('fabric.Group: trying to add group to itself, this call has no effect');
Copy link
Contributor

Choose a reason for hiding this comment

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

so we should only warn now, right?

ShaMan123 added a commit that referenced this pull request Jun 15, 2022
@asturur asturur deleted the can-enter-group branch September 11, 2022 23:03
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