Feature request: interactivity
Can this excellent library expose more methods, such as converting svg to Android's path object, if possible, I hope you can add some functions to implement click events for different images in svg.😁
I saw similar questions in the past, but I still hope to expose some ways to implement the click function. (Or I didn't find it?😞) I am sorry to bother you!
Hi Coyamo.
When you say "converting svg to Android's path object", what do you mean exactly? What would be the input and output? I know other libraries have things like parsePath(), which take an SVG path description and return a Path. Is that what you mean? Or something else?
implement click events
I am working on a new version of SVGImageView. I want it to be able to support taps and other events.
Paul
'converting svg to Android's path object' is just to get a Path object to implement the click event (check if the clicked coordinates are in the path). If you are implementing a click event, I don't think I need to get the path😳. Thank you for your reply, I am looking forward to your new version!
For example, I might be able to getPath from the SVG object ,SVG.getFromX.getPath() ...
Okay. Thanks. I will rename this issue to reflect your request.
Hey @BigBadaboom. I'm researching your project for a corporate use case.
I would need to be able to break down an SVG into separate components that can be individually clickable. I think this is what @Coyamo is also asking?
Or if this is already possible somehow using your library, I'd love to learn how.
In your sample app, it looks like the rubics cube is doing this... setting individual colors.
Please advise.
@DeutschDaniel Interactivity is not supported at the moment. But I intend for it to be in the next release.
Hi Paul, how do you intend to provide this feature ? Which strategy are you plan to use ? Any plan for this release ?
Maybe we could provide some help, even if for test/debug/dev
Thanks for you work, Marco
Hi all
A new SVGView class that supports zoom and pan is basically complete. Next step is to add interactivity to it.
Dear reader. If you are waiting for this feature, it would be helpful if I had an idea of what level of API support each of you would need, or prefer.
- Simple global click listener
SVG.registerClickHandler(fn). Wherefngets called with the clicked element's id - Simple click listeners attachable to any SVG graphics element by Id. Eg.
SVG.registerClickHandler(id, fn) - Full DOM style:
querySelector[All](sel).addEventListener("click", fn) - Support event bubbling. Ie. the ability to attach event listeners to container elements, such as groups.
- Support event capture phase. Ie.
addEventListener("click", fn, true). - Support
pointer-eventsCSS property - Support
getIntersectionList(),getEnclosureList(),checkIntersection(), andcheckEnclosure().
Please reply with your list, sorted by preference. For example: 2, 3, 1.
Thanks! Paul
1,2,7 Personally, these should meet the my needs. Thank you for your efforts
Yeah 1, 2 would be perfect. 6, 7 could also work.
Hi @BigBadaboom 1,2,6 and 7 would be really great to have features. Thanks
Hey @BigBadaboom, I've implemented a bit of this for my application on my fork. I would love to give back to this library, therefore I was wondering, if there is anyway we could review the code change, so all of us could benefit.
Hi Ishan
I've implemented a bit of this for my application on my fork. I would love to give back to this library, therefore I was wondering, if there is anyway we could review the code change, so all of us could benefit.
You could create a pull request if you like. Or summarise your changes in a document and create a bug (or email it to me).
Thanks Paul