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

Support for svg viewbox #88

Closed

Conversation

kheyse-werk
Copy link

@kheyse-werk kheyse-werk commented Mar 27, 2018

Support for svg viewbox. if a viewbox is defined, it overrides the svg width and height.
Fixes #86.

Allows to write:

<ReactSVGPanZoom width={500} height={500}>
        <svg viewBox="40 40 80 80">
...

@chrvadala
Copy link
Owner

It seems a really good feature, but I have to investigate if there could be some drawback.
I'll give you a feedback soon.

@kheyse-werk
Copy link
Author

Do you have any comments on this PR?

@chrvadala
Copy link
Owner

Sorry, but I haven't had the opportunity to study it yet. Hope to find enough time soon.

@TimVanMourik
Copy link
Contributor

I missed this pull request and basically programmed the same thing to only find @kheyse-oqton was there first 😄 (https://github.com/TimVanMourik/react-svg-pan-zoom).

I more or less made the exact same change. So hereby consider this an endorsement of this feature!

@chrvadala, I really love this work, it's an amazing React component and just what I needed for my application.

The only drawback of this issue that I can think of is that it alters the behaviour of users that at the moment have an (unused) viewbox property on their tag.

TimVanMourik added a commit to TimVanMourik/react-svg-pan-zoom that referenced this pull request Aug 26, 2019
This was referenced Aug 26, 2019
chrvadala pushed a commit that referenced this pull request Sep 17, 2019
* Add x and y to SVG

* initialise to zero, because not mandatory

* Update translations in fitToViewer

* bugfix in setting new SVG x and y

* Set default value for SVG x and y

* Merge PR #88 from @kheyse-oqton with current version

* stylistic changes

* Update fit to viewer as switch statement

More explicit handling of the translations as a function of alignment options

* Cleaning up of the constructor and componentDidUpdate functions

* using destructured values in Miniature

* small scaling bugfix

* small scale fix: scaling should be with viewer scaleLevel, not scaleY

* adds ViewboxStory

* minor ViewboxStory fix

* rename SVGViewBoxXY to SVGMinXY

* in order to reuse the standard name as defined in SVG RFC https://www.w3.org/TR/SVG/coords.html#ViewBoxAttribute, please rename SVGViewBoxX and SVGViewBoxY with SVGMinX and SVGMinY
#150 (comment)

* Move viewbox parser to separate file

* please move the ViewBox parser in a new file called utils/ViewBoxParser.js

#150 (comment)

* make ViewBox parser W3C compliant

This should do the trick and is more readable than a regex, IMO

#150 (comment)

* replace `withViewBox` by `viewBox`

#150 (comment)
@chrvadala
Copy link
Owner

PR moved on #150 and released with version 3.3.0
@TimVanMourik and @kheyse-oqton Thanks for your work, I added you in contributors list

@chrvadala chrvadala closed this Sep 17, 2019
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

Successfully merging this pull request may close these issues.

No support for svg viewbox
3 participants