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(fabric.Group) make addWithUpdate compatible with nested groups #6774

Merged
merged 8 commits into from
Feb 7, 2021

Conversation

asturur
Copy link
Member

@asturur asturur commented Jan 2, 2021

The pr does not work great yet, needs some understanding of what is not going right.

close #6738

@asturur
Copy link
Member Author

asturur commented Jan 2, 2021

What is the issue so far:
Given the group in the example below, that is created with this code:

var rect = new fabric.Rect({fill: '#0c0', left: 0, top: 0, width: 30, height: 40});
var rect1 = new fabric.Rect({fill: '#c00', left: 30, top: 0, width: 60, height: 50});
window.group0 = new fabric.Group([rect, rect1], {left: 20, top: 30, originX: 'left', originY: 'top'});

var rect2 = new fabric.Rect({fill: '#ccc', left:40, top: 4, width: 30, height: 40});
var rect3 = new fabric.Rect({fill: '#00c', left: 80, top: 7, width: 60, height: 50});
window.group1 = new fabric.Group([rect2, rect3], {left: 40, top: 0, originX: 'left', originY: 'top'});


window.group = new fabric.Group([group0, group1], {left: 0, top: 30, originX: 'left', originY: 'top'});


canvas.add(group);

Two triangles are added as a refence of position on the canvas

image

We try to add the text to the grey/blue group. with the code:

window.group1.addWithUpdate(canvas.getActiveObject())
canvas.renderAll()

we obtain this:
image

objects are grouped, but everything moved from its position.

@asturur
Copy link
Member Author

asturur commented Jan 2, 2021

if i overlap a copy of the group over the new one
image

Seems like the text has been added in correct position and what failed is the outer addWithUpdate.

I think the problem is in the fact that the group logic does not expect objects to change size when being grouped/ungrouped.

@asturur
Copy link
Member Author

asturur commented Jan 2, 2021

@jameszhong2008 seems we have a solution!

@jameszhong2008
Copy link

jameszhong2008 commented Jan 5, 2021

@asturur Great job, hope this PR can be merged soon.

jameszhong2008
jameszhong2008 previously approved these changes Jan 5, 2021
Copy link

@jameszhong2008 jameszhong2008 left a comment

Choose a reason for hiding this comment

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

Hope this will be approve soon by reviewer who have write access

@asturur
Copy link
Member Author

asturur commented Jan 5, 2021

the pipeline from travis is stopped because we do not have credits anymore. Without pipeline i won't merge anything.
I either need them to approve us as open source project or find another ci/cd application

@stale
Copy link

stale bot commented Jan 19, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale Issue marked as stale by the stale bot label Jan 19, 2021
@stale stale bot closed this Jan 26, 2021
@asturur
Copy link
Member Author

asturur commented Jan 31, 2021

bad bot.

@asturur asturur reopened this Jan 31, 2021
@stale stale bot removed the stale Issue marked as stale by the stale bot label Jan 31, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Jan 31, 2021

Code Coverage Summary

> fabric@4.3.1 coverage:report /home/runner/work/fabric.js/fabric.js
> nyc report --reporter=lcov --reporter=text

-----------|---------|----------|---------|---------|-----------------------------------------------
File       | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s                             
-----------|---------|----------|---------|---------|-----------------------------------------------
All files  |   82.72 |     76.9 |   85.66 |   82.48 |                                               
 fabric.js |   82.72 |     76.9 |   85.66 |   82.48 | ...,29540,29665,29745-29810,29933,30032,30249 
-----------|---------|----------|---------|---------|-----------------------------------------------

1 similar comment
@github-actions
Copy link
Contributor

github-actions bot commented Jan 31, 2021

Code Coverage Summary

> fabric@4.3.1 coverage:report /home/runner/work/fabric.js/fabric.js
> nyc report --reporter=lcov --reporter=text

-----------|---------|----------|---------|---------|-----------------------------------------------
File       | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s                             
-----------|---------|----------|---------|---------|-----------------------------------------------
All files  |   82.72 |     76.9 |   85.66 |   82.48 |                                               
 fabric.js |   82.72 |     76.9 |   85.66 |   82.48 | ...,29540,29665,29745-29810,29933,30032,30249 
-----------|---------|----------|---------|---------|-----------------------------------------------

@github-actions
Copy link
Contributor

github-actions bot commented Feb 7, 2021

Code Coverage Summary

> fabric@4.3.1 coverage:report /home/runner/work/fabric.js/fabric.js
> nyc report --reporter=lcov --reporter=text

-----------|---------|----------|---------|---------|-----------------------------------------------
File       | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s                             
-----------|---------|----------|---------|---------|-----------------------------------------------
All files  |   82.72 |    76.91 |   85.66 |   82.48 |                                               
 fabric.js |   82.72 |    76.91 |   85.66 |   82.48 | ...,29544,29669,29749-29814,29937,30036,30253 
-----------|---------|----------|---------|---------|-----------------------------------------------

@github-actions
Copy link
Contributor

github-actions bot commented Feb 7, 2021

Code Coverage Summary

> fabric@4.3.1 coverage:report /home/runner/work/fabric.js/fabric.js
> nyc report --reporter=lcov --reporter=text

-----------|---------|----------|---------|---------|-----------------------------------------------
File       | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s                             
-----------|---------|----------|---------|---------|-----------------------------------------------
All files  |   82.69 |     76.9 |    85.6 |   82.45 |                                               
 fabric.js |   82.69 |     76.9 |    85.6 |   82.45 | ...,29559,29684,29764-29829,29952,30051,30268 
-----------|---------|----------|---------|---------|-----------------------------------------------

@github-actions
Copy link
Contributor

github-actions bot commented Feb 7, 2021

Code Coverage Summary

> fabric@4.3.1 coverage:report /home/runner/work/fabric.js/fabric.js
> nyc report --reporter=lcov --reporter=text

-----------|---------|----------|---------|---------|-----------------------------------------------
File       | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s                             
-----------|---------|----------|---------|---------|-----------------------------------------------
All files  |    82.7 |    76.91 |    85.6 |   82.46 |                                               
 fabric.js |    82.7 |    76.91 |    85.6 |   82.46 | ...,29558,29683,29763-29828,29951,30050,30267 
-----------|---------|----------|---------|---------|-----------------------------------------------

@asturur asturur merged commit a298d85 into master Feb 7, 2021
@asturur asturur mentioned this pull request Apr 7, 2021
@asturur asturur deleted the investigate-nested-group branch August 8, 2021 20:22
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.

Add object to nested group
2 participants