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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Suggestion] Make Component Work With SVG #62

Open
krowark opened this issue Apr 8, 2020 · 0 comments
Open

[Suggestion] Make Component Work With SVG #62

krowark opened this issue Apr 8, 2020 · 0 comments

Comments

@krowark
Copy link

krowark commented Apr 8, 2020

Hi,
I've been trying to make this component work with SVGs and found a series of small changes to the package that would help. Of course, I could fork this repository, make my changes there, and use that but I figured I'd note my findings here in case supporting SVG is a direction the core team wants to consider.

The main roadblocks for getting SVG to work with this component are twofold.

  1. Currently the "doObjectsCollide" method only correctly handles HTMLElements despite the function being easily generalize-able to Elements, which includes SVGElements, with some minor tweaks. Those tweaks include changing "doObjectsCollide" to expect and check for instances of Elements, as well as changing "getBoundsForNode" to the below:
    image
    This change is needed because SVG doesn't support node.offsetWidth/node.offsetHeight anymore.

  2. Like the repo already allows for the component tag to be modified from "div", selectable items will need a way to change the tag of the enclosing element. This should be a reasonably simple change, as the extra "component" attribute can follow the same pattern as "selectableKey" does.

Perhaps this added functionality has already been thought of and dismissed as out of scope, though I cannot imagine why. Let me know what you think.
Thanks.

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

No branches or pull requests

1 participant