-
-
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
isTargetTransparent fails on the control borders for objects #2601
Comments
if you turn off controls, it will not be possible to select controls with the "perPixelFind" true. |
This modified code will only turn the corners off while testing the isTargetTransparent. I don't think this code will affect re-sizing the objects since it only turns it off on the object being drawn on to the contextCache. Did I misunderstand your question? |
If you check the code Example: At least this is the idea i get from the code. Other solution is that this.transparentCorners = false is wrong and must be changed with target.hasControls = false as you say. |
Ah I understand now. Just testing it with my fiddle provided, I added perPixelTargetFind: true to the green circle on the left. It appears just by that test the corner resize is still working as expected. However, I do not know if this could have negative implications in other uses. Logically it seems more correct to not check the corners of an object when testing if it is transparent. For me that is the desired behavior. Is this fabricjs desired behavior though? I can do a work around where I put 'hasControls' as false on the object before I test it for transparency and then reset hasControls to true after running my test. |
The problem is that actually the code is: if (obj && so: I would make a deep analysis before changing this behaviour. What mainly makes me doubt is that "this.transparentCorner = false" put there. It can't be a typo but it looks like intentional. |
You are much more qualified to solve this problem than I am! Hopefully this will be updated in a not so distant future release. Thanks for your help! |
@kangax should remember |
I finally understand this issue. |
See this fiddle I created here:
http://jsfiddle.net/jhundley9109/co6ncoyo/
You can see the green circle on the left has 12 pixels that fail the isTargetTransparent test. However, the yellow circle on the right has a 100% isTransparent pass rate on the right. This is due to the controls being on for the circle on the left. It looks like when fabric runs this test and draws the object in the contextCache it is not turning off the controls but it is turning off the borders and corners.
I simply fixed this by also turning off the controls too and the test passed (as I expected at least)
Here is my modified code:
Let me know what you think!
The text was updated successfully, but these errors were encountered: