-
Notifications
You must be signed in to change notification settings - Fork 25
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
SVG zoom for visualization graph #810
Conversation
@@ -31,6 +34,20 @@ export const Mermaid: React.FC<{ | |||
mermaid.contentLoaded(); | |||
}); | |||
|
|||
// requestAnimationFrame is used to ensure that the svgPanZoom is called after the svg is rendered | |||
useEffect(() => { | |||
requestAnimationFrame(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you walk me through this one.
Is the problem that you want to hold on the svgPanZoom
invocation until you are sure that the diagram svg is rendered?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct. If svgPanZoom
is run before its rendered the function will error. This ensures that its run after rendering
I tried this manually and it works, but I added this for (let i = 1; i < 20; i++) {
basicContracts.push(
m.contractAt("BasicContract", basicContracts[i - 1], { id: "basic" + i })
);
} to
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
resolves #806
resolves #807
svg-pan-zoom
library to zoom and pan mermaid diagrammaxTextSize
to5e5
instead of the default of5e4