-
Notifications
You must be signed in to change notification settings - Fork 388
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
for dynamically appended svg, im getting this error #247
Comments
Hi, Please read the support section of the Readme. |
I got it working, actually the problem was outside container of the SVG was
hidden, but I didn't understand the logic, why should it throw matrix
inversion error when it's hidden. In the console, a message should be
logged saying SVG is hidden.
…On Sat, Jun 17, 2017 at 3:51 PM, bumbu ***@***.***> wrote:
Closed #247 <#247>.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#247 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AYZCaWGSVWWT9XIIea8OUM4noPZGr_i7ks5sE6jFgaJpZM4N4WZg>
.
|
That depends on the browser implementation, some browsers are detaching foreign objects (like iframe, svg) when an ancestors is hidden. It would be possible for the library to check at any event that all parent elements are visible, but that's computationally inefficient and too specific. The developer should be responsible for knowing when to initialise the library. Also see this comment. |
Ok.
Thanks for the reply and the awesome library.
…On Jun 17, 2017 4:14 PM, "bumbu" ***@***.***> wrote:
That depends on the browser implementation, some browsers are detaching
foreign objects (like iframe, svg) when an ancestors is hidden. It would be
possible for the library to check at any event that all parent elements are
visible, but that's computationally inefficient and too specific. The
developer should be responsible for knowing when to initialise the library.
Also see this comment
<#105 (comment)>
.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#247 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AYZCaXT6s9z8mA565O3ZkVMTWWXhO4nCks5sE64KgaJpZM4N4WZg>
.
|
I had this same issue when SVG mounted to DOM and fixed it by just giving a height and width to the container. Any value works it seems, even % |
Thanks for inspiration @jacobwindsor. What was working for me is: // view.tsx
<div className={classes.container} ref={setRef}>
<svg viewBox={`0 0 ${width} ${height}`} style={{ width, height }}>
<g className="svg-pan-zoom_viewport">
<image x="0" y="0" xlinkHref={url} width={width} height={height} />
</g>
</svg>
</div>
|
Faced the same issue. The problem occurs when you try to use reset when the container for the svg is not visible on the viewport. I fixed it by checking for this before performing reset.
|
Uncaught DOMException: Failed to execute 'inverse' on 'SVGMatrix': The matrix is not invertible.
at SvgPanZoom.zoomAtPoint (http://localhost/school/js/svg-pan-zoom.js:753:52)
at SvgPanZoom.handleMouseWheel (http://localhost/school/js/svg-pan-zoom.js:724:8)
at SVGSVGElement.wheelListener (http://localhost/school/js/svg-pan-zoom.js:667:19)
observation: initial transform matrix is setting to zero, here's how it's setting: transform="matrix(0,0,0,0,0,0)"
svg is appended like this:
//html
The text was updated successfully, but these errors were encountered: