nbelyh / diagram-frame

SharePoint SPFx web part to display Visio diagrams.
https://unmanagedvisio.com/products/diagram-frame-sharepoint-visio-web-part/
MIT License
12 stars 5 forks source link

Initial Zoom to defined Position (or save current view)? #12

Open Constey opened 1 year ago

Constey commented 1 year ago

Hi @nbelyh ,

i'm not sure if this is possible - we have some visio shapes to use as process description. If I embed them it looks like: image So there very small, so the zoom feature is nice. But when zooming into 120% for example we have to scroll a bit up to not have a blank page, because zoom is always centered. image Is it possible to save the "viewing" location / scrollbar location and use this in combination with the zoom level to have a nice view like: image

Thanks in advance, Constantin

nbelyh commented 1 year ago

Yes I got the issue 😅 There is Visio Online API to control the View, so technically this must be possible: https://learn.microsoft.com/en-us/javascript/api/visio/visio.pageview?view=visio-js-1.1#visio-visio-pageview-setposition-member(1)

An easy option may be to provide option for the default view, more "advanced" could be to analyze the content of the diagram and auto-adjust the diagram accordingly.

I'm actually currently working on "SVG" version of the web part, that would NOT use Visio to render diagrams (basically porting my SvgPublish extension to a the web / wordpress part, that provides the default view out of the box), but currently it's at a very early alpha stage: https://github.com/nbelyh/SvgPublishWebPart

Constey commented 1 year ago

ah yeah with getPosition() and setPosition() that should be possible. (or maybe: centerViewportOnShape() is evend better) could you give me a hint how I could call that funciton within the webpart? the zoom thing is only an attachment to the get url, that's what I already understood. But i'm a bit unclear how the other things get rendered :/

Constey commented 1 year ago

the svgPublish looks like the draw.io features :o) i know this from confluence, that's more awesome than visio by design, but currently aswell not an integration possibility found (even if its free) ;-)