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

SVG zoom for visualization graph #810

Merged
merged 2 commits into from
Sep 25, 2024
Merged

SVG zoom for visualization graph #810

merged 2 commits into from
Sep 25, 2024

Conversation

zoeyTM
Copy link
Contributor

@zoeyTM zoeyTM commented Sep 23, 2024

resolves #806
resolves #807

  • using svg-pan-zoom library to zoom and pan mermaid diagram
  • set maxTextSize to 5e5 instead of the default of 5e4

@@ -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(() => {
Copy link
Member

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?

Copy link
Contributor Author

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

@alcuadrado
Copy link
Member

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 examples/complete/ignition/modules/CompleteModule.js, and there are two issues:

  1. The batches "buttons" overlap with each other.
  2. The diagram is still 300px tall, so it's hard to read.

Copy link
Member

@alcuadrado alcuadrado left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@zoeyTM zoeyTM merged commit 1f1ae43 into development Sep 25, 2024
8 checks passed
@zoeyTM zoeyTM deleted the svg-zoom branch September 25, 2024 15:00
@zoeyTM zoeyTM mentioned this pull request Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
3 participants