You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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:
This change is needed because SVG doesn't support node.offsetWidth/node.offsetHeight anymore.
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.
The text was updated successfully, but these errors were encountered:
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.
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](https://user-images.githubusercontent.com/62404508/78819555-6daeef80-79a4-11ea-9eab-db612182e630.png)
This change is needed because SVG doesn't support node.offsetWidth/node.offsetHeight anymore.
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.
The text was updated successfully, but these errors were encountered: