S
Shauniwthanau
I'm sorry if this is the wrong place to ask this but my justification
is that I have seen this done in WPF and I am wondering how to
implement the same thing that is cross-browser compliant and using
only javascript/CSS/HTML.
What I have is a div with overflow:auto, but really could be any
container, which is for example is 800*800 px and inside of this div
is a SVG image, which changes size. It can fit in the div but it can
also get very large, say 5000*5000 px, and I need to manipulate the
scrollbars so that when the SVG has changed size the scrollbars adjust
so that you are seeing the same location on the SVG that you were
seeing before.
This is what I would like to reproduce:
Initially set the center as the center of the SVG so that when the SVG
gets larger then the container the scrollbars automatically scroll to
show the center of the SVG. If the user scrolls, then the view-ports
center is updated and any changes in size now centers your view-port
there.
In WPF they were able to access the view-port of the container and
using that along with the height and width of the container (used to
calculate the center) they were able to accomplish this.
Any help would be greatly appreciated.
is that I have seen this done in WPF and I am wondering how to
implement the same thing that is cross-browser compliant and using
only javascript/CSS/HTML.
What I have is a div with overflow:auto, but really could be any
container, which is for example is 800*800 px and inside of this div
is a SVG image, which changes size. It can fit in the div but it can
also get very large, say 5000*5000 px, and I need to manipulate the
scrollbars so that when the SVG has changed size the scrollbars adjust
so that you are seeing the same location on the SVG that you were
seeing before.
This is what I would like to reproduce:
Initially set the center as the center of the SVG so that when the SVG
gets larger then the container the scrollbars automatically scroll to
show the center of the SVG. If the user scrolls, then the view-ports
center is updated and any changes in size now centers your view-port
there.
In WPF they were able to access the view-port of the container and
using that along with the height and width of the container (used to
calculate the center) they were able to accomplish this.
Any help would be greatly appreciated.