anvaka / panzoom

Universal pan and zoom library (DOM, SVG, Custom)
https://anvaka.github.io/panzoom/demo/attach-via-script.html
MIT License
1.83k stars 293 forks source link

[BUG] Script attachment options: HTML Attribute Names Not Recognized as Case-Sensitive #301

Open dcastillogi opened 1 year ago

dcastillogi commented 1 year ago

I've been working with your library and I noticed an issue regarding the "boundsPadding" or any other attribute using camelCase in HTML Script attachment. In my case, I need to use the "boundsPadding" attribute, which is not recognized as case-sensitive in the browser. This causes the attribute to be displayed as "boundspadding" in the browser, which results in JavaScript not recognizing it when trying to access the attribute using dot notation.

Additionally, the library does not recognize "bounds-padding" or "boundspadding" as valid options to set the bounds padding attribute. This further limits the options for users to set the attribute correctly.

Example:

<script src='https://unpkg.com/panzoom@9.4.0/dist/panzoom.min.js' query='#scene' name='pz' pz-bounds='true'
        pz-autocenter='true' pz-boundsPadding="0.9"></script>

While the "bounds" and "autocenter" attributes are successfully applied to the panzoom, the "boundsPadding" attribute is currently being ignored.