Add pan and zoom to DAG preview - #46
Merged
Merged
Conversation
|
Years ago I did a proof of concept of displaying nextflow DAG svg using OpenSeadragon, you can find it here. OpenSeadragon might be a bit overkill for this purpose (or not) but worth checking as the setup could be quite easy and it handles pan, zoom etc (even minimaps) out of the box. |
bentsherman
force-pushed
the
dag-preview-pan-and-zoom
branch
from
September 15, 2026 19:28
87caa77 to
786ab69
Compare
bentsherman
marked this pull request as ready for review
September 15, 2026 19:37
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds pan and zoom to the DAG preview webview.
The original version of this PR used svg-pan-zoom, which rewrites the SVG's
viewBoxand so needs a sized SVG to work against. That forcedmermaid.render()instead ofstartOnLoad, a custom events handler to re-add dragging, and a hardcodedheight: 1024px. It also predates the bundled Mermaid and the webview CSP, both of which it would now conflict with.This version drops the library. The
<pre class="mermaid">goes inside a.viewportdiv (flex: 1; overflow: hidden) and pan/zoom is a CSStransformon the pre, driven by ~50 lines of vanilla JS. No dependency, no CSP change,startOnLoaduntouched. The height is no longer fixed: the body is a flex column at100vhand the viewport takes whatever is left.Keeping the transform on the wrapper rather than the
viewBoxmeans Export as SVG still serializes the unzoomed diagram instead of baking in the current zoom level. Panning useswindowlisteners rather thansetPointerCapture, which would retarget the subsequentclickto the viewport and break click-to-open-file; a drag of more than 4px swallows the click so panning doesn't open files by accident.Pan/zoom is webview-only, passed through
htmlHead'sextraparameter. The standalone HTML export is left alone since browsers already scroll and zoom it.Controls: drag to pan, scroll to zoom at the cursor (clamped 0.1x-20x), double-click to reset.