-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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 for bounding box of path, opacity of group, some transform #1671
Fix for bounding box of path, opacity of group, some transform #1671
Conversation
Removed own render function , used the parent one. Created new parse dimension, using the structure of render function to iterate the path. Removed one translation from render cycle Top and left is specified or calculated, while width and height are always calculated.
Removed globalalpha from transform method. Added private setOpacity Method that checks recursively the groups both for groups and path-groups. Commented "setup fill rule" to avoid confusion, it should be rename in "setupCompositeOperation". removed _transform method Object not grouped with transformMatrix are still not supported but behaves lot better than before.
Some changes to follow object class changes.
Added getBoundsOfCurve and getBoundsOfArc functions
@kangax We use fillRule even to store generic object property that gets applied to globalCompositeOperation, such as "nonzero", "destination-over" , "destination-atop" etc etc etc. I think we should change both the name of the latter property and the name of the method in "compositeRule" and setCompositeRule , restoreCompositeRule to avoid confunsion. If we do not make that change path class cannot have both a fillrule even-odd and a destination-over composite operaiton. What do you think? can i make the change? of course i will fix the unit testing if you approve all those changes. |
@asturur Can you split this PR into eg. 3 PR's?
|
i can split in opacity, bounding box, and general rendering changes. but is a lot of work to rewrite, if you need it ok. let me know. let me know for my question about globalcompositeoperation, otherwise i
|
Other problem is that i have to make a path bounding box patch, that when applied needs custom fix to don't break the render ( cause now left, top, width etc etc will change ), and those render changes are just made to make that pr works. Maybe the only one that i can extract is the opacity change. |
This PR adds:
Path Class
Correct calculation of bounding box for paths ( with bezier and arc commands ).
Removed render method in path class to use the standard obejct one
Removed 1 ctx.transform in path _render method
Object Class
Correct rendering of opacity for groups, added setOpacity method.
Removed _Transform method, it was confusing in the render logic. "transform" method is enough
TransformMatrix on single objects are not supported yet, but behaves a little better, at least the object now follow mouse movements and doesn't go in different direction.
Text class:
Made some changes to adapt to object class.
arc.js
Add functions to calculate the bounding box.