Skip to content

docs: add more information about perimeters#656

Merged
tbouffard merged 2 commits intomainfrom
docs/improve_perimeters_information
Jan 31, 2025
Merged

docs: add more information about perimeters#656
tbouffard merged 2 commits intomainfrom
docs/improve_perimeters_information

Conversation

@tbouffard
Copy link
Copy Markdown
Member

@tbouffard tbouffard commented Jan 31, 2025

Explain more precisely how the connection point is computed on the perimeter.
In particular, mention that it is possible to use orthogonal projection, and add various schemas to illustrates the
explanations.

Update the JSDoc of elements that are involved in the orthogonal projection.

Summary by CodeRabbit

  • Documentation

    • Updated documentation for orthogonal property in CellStateStyle
    • Refined comments for isOrthogonal method in Graph class
    • Improved JSDoc comments in CellState class
    • Enhanced documentation for perimeters in usage guide
  • New Features

    • Added new draw.io diagrams for perimeter documentation
  • Chores

    • Clarified terminology and naming conventions in documentation
    • Updated code comments for better readability

Explain more precisely how the connection point is computed on the perimeter.
In particular, mention that it is possible to use orthogonal projection, and add various schemas to illustrates the
explanations.

Update the JSDoc of elements that are involved in the orthogonal projection.
@tbouffard tbouffard added the documentation Improvements or additions to documentation label Jan 31, 2025
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Jan 31, 2025

Walkthrough

This pull request introduces modifications to the documentation and type definitions related to orthogonal edge styles and perimeters in the maxGraph library. The changes primarily focus on clarifying the behavior of the orthogonal property in CellStateStyle, updating method comments, and enhancing documentation for perimeter configurations. The updates aim to improve code clarity, provide more precise descriptions of graph-related functionalities, and offer better guidance for developers using the library.

Changes

File Change Summary
packages/core/src/types.ts Updated orthogonal property in CellStateStyle type to allow null and clarified its interaction with Graph.isOrthogonal
packages/core/src/view/Graph.ts Refined documentation for isOrthogonal method, explicitly stating its return type and purpose
packages/core/src/view/GraphView.ts Updated comment in isLoopStyleEnabled method, replacing terminology
packages/core/src/view/cell/CellState.ts Enhanced documentation using {@link} syntax and added @default annotations
packages/website/docs/usage/assets/perimeters/perimeters-diagrams.drawio Added new draw.io diagram file for perimeter-related visualizations
packages/website/docs/usage/perimeters.md Comprehensive documentation update for perimeter configuration and usage

Possibly related PRs

  • docs: add content to getting started page #598: The changes in the main PR regarding the orthogonal property and its interaction with Graph.isOrthogonal may relate to the documentation updates in this PR, which enhances the clarity of the Perimeter concept, potentially involving similar edge handling logic.
  • docs: add links to specific examples and demos in various pages #603: This PR adds links to specific examples and demos in the documentation, which may include examples related to the orthogonal property and its usage in edge styles, thus connecting to the changes made in the main PR.
  • docs: migrate the mxGraph tutorial #618: The migration documentation updates in this PR may touch upon changes related to edge handling and properties, which could be relevant to the modifications made in the main PR regarding the orthogonal property.

Suggested Labels

enhancement


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
packages/website/docs/usage/perimeters.md (2)

58-60: Minor grammar improvement needed

Consider revising "based on the center" to "in the center" for better grammatical accuracy.

-| Context                                                                                        | Computation based on the center            |
+| Context                                                                                        | Computation in the center                  |
🧰 Tools
🪛 LanguageTool

[grammar] ~58-~58: In this expression, the usual preposition is “in”, not “on”. Did you mean “in the center”?
Context: ... | Computation based on the center | |-------------------------...

(ON_IN_THE_MIDDLE)


70-70: Add comma for better readability

Add a comma before 'but' as it connects two independent clauses.

-By default, this is also applied when `style.orthogonal` is not explicitly set but the edge style belongs to one of the "orthogonal" `EdgeStyle` connectors.
+By default, this is also applied when `style.orthogonal` is not explicitly set, but the edge style belongs to one of the "orthogonal" `EdgeStyle` connectors.
🧰 Tools
🪛 LanguageTool

[uncategorized] ~70-~70: Use a comma before ‘but’ if it connects two independent clauses (unless they are closely connected and short).
Context: ...style.orthogonal is not explicitly set but the edge style belongs to one of the "o...

(COMMA_COMPOUND_SENTENCE_2)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 10bb56d and eacbe46.

⛔ Files ignored due to path filters (4)
  • packages/website/docs/usage/assets/perimeters/perimeter-point-computation-01-context.png is excluded by !**/*.png
  • packages/website/docs/usage/assets/perimeters/perimeter-point-computation-02-center.png is excluded by !**/*.png
  • packages/website/docs/usage/assets/perimeters/perimeter-point-computation-03-orthogonal_projection.png is excluded by !**/*.png
  • packages/website/docs/usage/assets/perimeters/story-overview.png is excluded by !**/*.png
📒 Files selected for processing (6)
  • packages/core/src/types.ts (1 hunks)
  • packages/core/src/view/Graph.ts (1 hunks)
  • packages/core/src/view/GraphView.ts (1 hunks)
  • packages/core/src/view/cell/CellState.ts (12 hunks)
  • packages/website/docs/usage/assets/perimeters/perimeters-diagrams.drawio (1 hunks)
  • packages/website/docs/usage/perimeters.md (1 hunks)
✅ Files skipped from review due to trivial changes (3)
  • packages/website/docs/usage/assets/perimeters/perimeters-diagrams.drawio
  • packages/core/src/view/Graph.ts
  • packages/core/src/view/GraphView.ts
🧰 Additional context used
🪛 LanguageTool
packages/website/docs/usage/perimeters.md

[grammar] ~58-~58: In this expression, the usual preposition is “in”, not “on”. Did you mean “in the center”?
Context: ... | Computation based on the center | |-------------------------...

(ON_IN_THE_MIDDLE)


[uncategorized] ~70-~70: Use a comma before ‘but’ if it connects two independent clauses (unless they are closely connected and short).
Context: ...style.orthogonal is not explicitly set but the edge style belongs to one of the "o...

(COMMA_COMPOUND_SENTENCE_2)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build (windows-2022)
🔇 Additional comments (4)
packages/core/src/view/cell/CellState.ts (1)

35-37: Documentation improvements look good!

The updated JSDoc comments provide clearer references to properties using {@link ...} syntax, improving documentation readability.

packages/core/src/types.ts (1)

518-524: Excellent documentation enhancement for the orthogonal property!

The updated documentation clearly explains:

  1. The relationship with perimeter computation
  2. The behavior with Graph.isOrthogonal
  3. The automatic behavior with orthogonal edge styles

This aligns perfectly with the PR's objective of clarifying perimeter computation.

packages/website/docs/usage/perimeters.md (2)

15-18: Clear and concise introduction to perimeters!

The explanation effectively communicates the purpose and configuration of perimeters.


42-80: Excellent documentation of terminal point computation!

The new section thoroughly explains:

  1. How terminal points are computed
  2. The orthogonal projection alternative
  3. Visual examples with diagrams

This significantly improves understanding of perimeter behavior.

🧰 Tools
🪛 LanguageTool

[grammar] ~58-~58: In this expression, the usual preposition is “in”, not “on”. Did you mean “in the center”?
Context: ... | Computation based on the center | |-------------------------...

(ON_IN_THE_MIDDLE)


[uncategorized] ~70-~70: Use a comma before ‘but’ if it connects two independent clauses (unless they are closely connected and short).
Context: ...style.orthogonal is not explicitly set but the edge style belongs to one of the "o...

(COMMA_COMPOUND_SENTENCE_2)

@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (5)
packages/website/docs/usage/perimeters.md (5)

15-21: Consider adding a basic diagram to illustrate the perimeter concept.

The explanation is clear, but a simple diagram showing a vertex with its perimeter and an edge connecting to it would help readers quickly grasp the concept.

Would you like me to help create a basic diagram to illustrate this concept?


23-27: Add a code example for disabling perimeters.

Consider adding a TypeScript code snippet demonstrating how to disable the perimeter. This would make the documentation more actionable.

Example:

// Disable perimeter for a specific vertex
const style = {
  ...vertexStyle,
  perimeter: null
};

34-40: Enhance the image description.

Consider adding more details about what specific perimeter types are shown in the example image. This would help readers understand what they're looking at before visiting the live demo.


58-60: Fix grammar in table header and enhance the comparison.

  1. Change "Computation based on the center" to "Computation in the center" for better grammar.
  2. Consider adding brief captions under each image to highlight the key differences between the two approaches.
🧰 Tools
🪛 LanguageTool

[grammar] ~58-~58: In this expression, the usual preposition is “in”, not “on”. Did you mean “in the center”?
Context: ... | Computation based on the center | |-------------------------...

(ON_IN_THE_MIDDLE)


Line range hint 134-143: Enhance the custom perimeter example.

The current custom perimeter example uses placeholder calculations (x = 0, y = 0). Consider providing a more practical example that demonstrates actual coordinate calculations, perhaps for a triangle or star shape.

Would you like me to provide a more practical custom perimeter implementation example?

🧰 Tools
🪛 LanguageTool

[grammar] ~58-~58: In this expression, the usual preposition is “in”, not “on”. Did you mean “in the center”?
Context: ... | Computation based on the center | |-------------------------...

(ON_IN_THE_MIDDLE)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between eacbe46 and 5097167.

📒 Files selected for processing (1)
  • packages/website/docs/usage/perimeters.md (1 hunks)
🧰 Additional context used
🪛 LanguageTool
packages/website/docs/usage/perimeters.md

[grammar] ~58-~58: In this expression, the usual preposition is “in”, not “on”. Did you mean “in the center”?
Context: ... | Computation based on the center | |-------------------------...

(ON_IN_THE_MIDDLE)

🔇 Additional comments (1)
packages/website/docs/usage/perimeters.md (1)

Line range hint 1-184: Documentation changes look great!

The enhanced documentation provides clear explanations of perimeter concepts, computation methods, and implementation details. The addition of visual aids and live demo references makes it very comprehensive.

🧰 Tools
🪛 LanguageTool

[grammar] ~58-~58: In this expression, the usual preposition is “in”, not “on”. Did you mean “in the center”?
Context: ... | Computation based on the center | |-------------------------...

(ON_IN_THE_MIDDLE)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant