Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: interactivity #184

Open
Coyamo opened this issue Oct 6, 2019 · 14 comments
Open

Feature request: interactivity #184

Coyamo opened this issue Oct 6, 2019 · 14 comments

Comments

@Coyamo
Copy link

Coyamo commented Oct 6, 2019

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.馃榿

@Coyamo Coyamo changed the title a small idea a small feature requests Oct 6, 2019
@Coyamo Coyamo changed the title a small feature requests a small feature request Oct 6, 2019
@Coyamo
Copy link
Author

Coyamo commented Oct 6, 2019

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!

@BigBadaboom
Copy link
Owner

BigBadaboom commented Oct 7, 2019

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

@Coyamo
Copy link
Author

Coyamo commented Oct 7, 2019

'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!

@Coyamo
Copy link
Author

Coyamo commented Oct 7, 2019

For example, I might be able to getPath from the SVG object ,SVG.getFromX.getPath() ...

@BigBadaboom
Copy link
Owner

Okay. Thanks. I will rename this issue to reflect your request.

@BigBadaboom BigBadaboom changed the title a small feature request Feature request: interactivity Oct 7, 2019
@BigBadaboom BigBadaboom self-assigned this Oct 7, 2019
@DeutschDaniel
Copy link

DeutschDaniel commented Dec 10, 2019

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.

@BigBadaboom BigBadaboom added this to the 1.5 milestone Dec 11, 2019
@BigBadaboom
Copy link
Owner

BigBadaboom commented Dec 11, 2019

@DeutschDaniel Interactivity is not supported at the moment. But I intend for it to be in the next release.

@marcoceccarellispotsoftware

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

@BigBadaboom
Copy link
Owner

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.

  1. Simple global click listener SVG.registerClickHandler(fn). Where fn gets called with the clicked element's id
  2. Simple click listeners attachable to any SVG graphics element by Id. Eg. SVG.registerClickHandler(id, fn)
  3. Full DOM style: querySelector[All](sel).addEventListener("click", fn)
  4. Support event bubbling. Ie. the ability to attach event listeners to container elements, such as groups.
  5. Support event capture phase. Ie. addEventListener("click", fn, true).
  6. Support pointer-events CSS property
  7. Support getIntersectionList(), getEnclosureList(), checkIntersection(), and checkEnclosure().

Please reply with your list, sorted by preference. For example: 2, 3, 1.

Thanks!
Paul

@Coyamo
Copy link
Author

Coyamo commented Mar 6, 2020

1,2,7 Personally, these should meet the my needs. Thank you for your efforts

@i-mitra
Copy link

i-mitra commented Sep 11, 2020

Yeah 1, 2 would be perfect. 6, 7 could also work.

@Viraj7009
Copy link

Hi @BigBadaboom 1,2,6 and 7 would be really great to have features. Thanks

@i-mitra
Copy link

i-mitra commented Jul 18, 2021

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.

@BigBadaboom
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants