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

Add the ability to zoom in and pan around the SVG diagram. #309

Closed
wants to merge 18 commits into from

Conversation

qtzar
Copy link
Contributor

@qtzar qtzar commented Sep 8, 2023

Added the ability to zoom in on a part of a diagram.

  • Double click a non-clickable area of the diagram to zoom it in.
  • Hold the control key and use the mouse wheel/scroll to zoom in/out
  • Click and hold a zoomed in diagram and move mouse to pan
  • Pinch on trackpad/mobile to zoom in and out

Still to do : Add button(s) to control zoom under the sag, add button to reset to original size, add some sort of bounding box so that the zoomed element doesn't take over the full screen.

@qtzar
Copy link
Contributor Author

qtzar commented Sep 8, 2023

@dirkgroot Would love to get your input on this early stage concept.

@qtzar
Copy link
Contributor Author

qtzar commented Sep 8, 2023

Found a better SVG Zooming library that gives me the ability to zoom within the svg's container and add control buttons but lost the ability to require the control key to be held down to zoom with mouse.

@qtzar
Copy link
Contributor Author

qtzar commented Oct 9, 2023

Still working on this functionality. I moved the Pan/Zoom version of the SVG to a modal. I was unhappy with how having it directly on the page was interfering with normal site usage as you couldn't;t scroll up/down the page when the mouse was over the svg area.

I still need to figure out a good style for the 'zoom' button that surfaces the modal.

For the modal itself I used the built in Bulma CSS's modal and their sample JS so that additional resources would not have to be added to the site. I also added a new property to the DSL to allow users to enable/disable this functionality. When disabled (default) the JS for the modal and pan/zoom are excluded from the generated html.

@dirkgroot @jp7677 Any feedback?

@qtzar qtzar marked this pull request as ready for review October 10, 2023 12:49
qtzar and others added 2 commits October 11, 2023 10:33
# Conflicts:
#	README.md
#	src/main/kotlin/nl/avisi/structurizr/site/generatr/site/model/PageViewModel.kt
#	src/main/kotlin/nl/avisi/structurizr/site/generatr/site/views/Page.kt
@qtzar
Copy link
Contributor Author

qtzar commented Oct 11, 2023

here is what I did for the positioning of the 'zoom/pan' button that opens the modal window. I split the caption on the diagram in to two lines, first for the diagram title and the second for the download links. When the Zoom feature is enabled the extra link is added to the list.

Screenshot 2023-10-11 at 3 59 28 PM

qtzar and others added 2 commits October 13, 2023 11:27
# Conflicts:
#	README.md
#	src/main/kotlin/nl/avisi/structurizr/site/generatr/site/SiteGenerator.kt
#	src/main/kotlin/nl/avisi/structurizr/site/generatr/site/views/Page.kt
@jp7677
Copy link
Contributor

jp7677 commented Oct 20, 2023

Hi @qtzar sorry again for the late response, I promise, this one is next on my list ;).
Already a heads up, could you please organize new browser dependencies according to #328 ?

qtzar added 2 commits October 20, 2023 13:35
# Conflicts:
#	src/test/kotlin/nl/avisi/structurizr/site/generatr/site/model/MarkdownToHtmlTest.kt
@qtzar
Copy link
Contributor Author

qtzar commented Oct 20, 2023

@jp7677 Much appreciated & I have setup the browser dependency as requested.

@jp7677
Copy link
Contributor

jp7677 commented Oct 21, 2023

@qtzar Please see #334

@qtzar qtzar closed this Oct 21, 2023
@qtzar qtzar deleted the svgzoom branch October 21, 2023 13:29
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.

2 participants