Skip to content

Conversation

ShaMan123
Copy link
Contributor

@ShaMan123 ShaMan123 commented Apr 15, 2022

Refactored logic to support object stacking operations on Group by moving relevant logic from StaticCanvas to Collection.
Renamed methods to enable the following:

group.sendToBack();   // will send group to back in it's parent
group.sendObjectToBack(group.item(5));   // will move the object at index 5 to index 0

I think we should remove object stacking methods (src/mixins/object_stacking.mixin.js) from Object. What happens when an object is part of ActiveSelection and an object stacking method is called on it is strange and confusing.
Consider the following:

let obj, canvas;
canvas.getActiveObject().item(0) === obj //   true
canvas.getActiveObject().item(0).bringToFront()  // mutates canvas' stack
canvas.getActiveObject().item(0) === obj //   true

With this PR the dev can achieve the following:

obj.bringToFront() // acts on the origin stack manager, not on the ActiveSelection 
canvas.getActiveObject().bringObjectToFront(obj) // acts on the ActiveSelection 

Should we drop object stacking methods on Object and have the dev decide which stack to mutate?

canvas.getActiveObject().bringObjectToFront(obj)
// in case obj is part of some group and is in active selection it's group prop is overridden by the ActiveSelection
// parent is canvas or group, not AS
obj.getParent().bringObjectToFront(obj) 

BREAKING

canvas object stacking methods were renamed (sendToBack -> sendObjectToBack etc.)

@github-actions
Copy link
Contributor

github-actions bot commented Apr 15, 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  |   82.88 |    75.35 |   86.23 |   82.59 |                                               
 fabric.js |   82.88 |    75.35 |   86.23 |   82.59 | ...,30574,30648,30659-30724,30847,30946,31182 
-----------|---------|----------|---------|---------|-----------------------------------------------

@github-actions
Copy link
Contributor

github-actions bot commented Apr 15, 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  |   82.87 |    75.32 |   86.23 |   82.58 |                                               
 fabric.js |   82.87 |    75.32 |   86.23 |   82.58 | ...,30574,30648,30659-30724,30847,30946,31182 
-----------|---------|----------|---------|---------|-----------------------------------------------

@github-actions
Copy link
Contributor

github-actions bot commented Apr 15, 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  |   82.98 |    75.52 |   86.36 |   82.69 |                                               
 fabric.js |   82.98 |    75.52 |   86.36 |   82.69 | ...,30578,30652,30663-30728,30851,30950,31186 
-----------|---------|----------|---------|---------|-----------------------------------------------

@github-actions
Copy link
Contributor

github-actions bot commented Apr 15, 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  |   82.93 |    75.49 |   86.36 |   82.64 |                                               
 fabric.js |   82.93 |    75.49 |   86.36 |   82.64 | ...,30578,30652,30663-30728,30851,30950,31186 
-----------|---------|----------|---------|---------|-----------------------------------------------

1 similar comment
@github-actions
Copy link
Contributor

github-actions bot commented Apr 15, 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  |   82.93 |    75.49 |   86.36 |   82.64 |                                               
 fabric.js |   82.93 |    75.49 |   86.36 |   82.64 | ...,30578,30652,30663-30728,30851,30950,31186 
-----------|---------|----------|---------|---------|-----------------------------------------------

@ShaMan123 ShaMan123 mentioned this pull request Apr 15, 2022
48 tasks
@ShaMan123 ShaMan123 changed the title feat(Object Stacking): refactor logic to support Group feat(Object Stacking): 🔙 refactor logic to support Group 🔝 Apr 15, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Apr 15, 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  |   82.93 |    75.48 |   86.36 |   82.64 |                                               
 fabric.js |   82.93 |    75.48 |   86.36 |   82.64 | ...,30581,30655,30666-30731,30854,30953,31189 
-----------|---------|----------|---------|---------|-----------------------------------------------

@stale stale bot added the stale Issue marked as stale by the stale bot label Apr 29, 2022
@ShaMan123 ShaMan123 removed the stale Issue marked as stale by the stale bot label Apr 30, 2022
@fabricjs fabricjs deleted a comment from stale bot May 1, 2022
@github-actions
Copy link
Contributor

github-actions bot commented May 1, 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.08 |    76.09 |    85.8 |    82.8 |                                               
 fabric.js |   83.08 |    76.09 |    85.8 |    82.8 | ...,30970,31044,31055-31120,31243,31342,31578 
-----------|---------|----------|---------|---------|-----------------------------------------------

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.

updated from master

@github-actions
Copy link
Contributor

github-actions bot commented May 2, 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.09 |    76.12 |   85.79 |   82.81 |                                               
 fabric.js |   83.09 |    76.12 |   85.79 |   82.81 | ...,30979,31053,31064-31129,31252,31351,31587 
-----------|---------|----------|---------|---------|-----------------------------------------------

@stale
Copy link

stale bot commented Jun 12, 2022

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 Jun 12, 2022
@ShaMan123 ShaMan123 removed the stale Issue marked as stale by the stale bot label Jun 13, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Jun 13, 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.11 |    76.14 |   85.86 |   82.84 |                                               
 fabric.js |   83.11 |    76.14 |   85.86 |   82.84 | ...,30989,31063,31074-31139,31262,31361,31597 
-----------|---------|----------|---------|---------|-----------------------------------------------

@github-actions
Copy link
Contributor

github-actions bot commented Jun 16, 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.2 |    76.26 |   85.88 |   82.94 |                                               
 fabric.js |    83.2 |    76.26 |   85.88 |   82.94 | ...,30972,31046,31057-31122,31245,31344,31580 
-----------|---------|----------|---------|---------|-----------------------------------------------

@stale
Copy link

stale bot commented Jul 10, 2022

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 Jul 10, 2022
@ShaMan123 ShaMan123 removed the stale Issue marked as stale by the stale bot label Jul 10, 2022
@stale
Copy link

stale bot commented Jul 30, 2022

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 Jul 30, 2022
@ShaMan123 ShaMan123 removed the stale Issue marked as stale by the stale bot label Aug 1, 2022
@stale
Copy link

stale bot commented Sep 21, 2022

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 Sep 21, 2022
@ShaMan123 ShaMan123 removed the stale Issue marked as stale by the stale bot label Sep 21, 2022
@ShaMan123
Copy link
Contributor Author

This PR will be ported to the collection-stacking branch.

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.

1 participant