-
Notifications
You must be signed in to change notification settings - Fork 239
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
Add readonly property view.transformedPath
#102
Comments
Hi @ahmedk92 can you please attach a project that would allow us to reproduce the issue? |
For convenience, I made a fork with the changed demo, and added you as a collaborator to it. |
Thanks, I have it clearer now. The issue here is that @fjolnir any thoughts on how to catch touches on specific SVG paths when the container frame changes? If the |
@arielelkin Any news or a workaround? |
It always works "correctly", you're just trying to do something that path.containsPoint does not do. The scaling of the view does not change the path, it simply renders it differently. So the view coordinate and path coordinate are only guaranteed to coincide if the content mode is bottom left (start from 0,0 with no scaling applied). If you want to map a point in the view to the path, you'll have to do a reverse transformation of the point to the path's coordinate space, which could get a little tricky. To scale a frame using a content mode, PocketSVG uses Line 15 in efb22b9
path.bounds , and SVGAdjustCGRectForContentsGravity(path.bounds, view.bounds.size, view.layer.contentsGravity) )
There's no workaround or anything that PocketSVG will do to make it easier for now, you're going to have to implement it by yourself unless you have a lot of time to wait for us to get around to it. |
path.contains(point)
correctly works only when SVGImageView contentMode is bottomeLeftview.transformedPath
~~~path.contains(point)
correctly works only when SVGImageView contentMode is bottomeLeft~~~
view.transformedPath
~~~path.contains(point)
correctly works only when SVGImageView contentMode is bottomeLeft~~~view.transformedPath
~path.contains(point)
correctly works only when SVGImageView contentMode is bottomeLeft~
view.transformedPath
~path.contains(point)
correctly works only when SVGImageView contentMode is bottomeLeft~view.transformedPath
~~path.contains(point)
correctly works only when SVGImageView contentMode is bottomeLeft~~
view.transformedPath
~~path.contains(point)
correctly works only when SVGImageView contentMode is bottomeLeft~~view.transformedPath
Update lottie-ios.podspec
It might be useful if SVGLayer had a readonly property to access the path with the rendering transformation applied.
Original title:
path.contains(point)
correctly works only when SVGImageView contentMode is bottomeLeftI'm building a fill-on-tap demo on top of the
Demo-iOS
project.I added a
UITapGestureRecognizer
to theSVGImageView
. I'm aiming to fill the subpath under the tapped point with a color. My code so far:This correctly works only if the
contentMode
of theSVGImageView
isbottomLeft
. Other modes acknowledges the tapped point while it's actually rendered somewhere else. Any ideas what may be wrong?The text was updated successfully, but these errors were encountered: