Skip to content

Conversation

@SplinterSword
Copy link
Contributor

@SplinterSword SplinterSword commented Nov 20, 2025

Notes for Reviewers

Summary

This PR adds support for curved shapes by first generating an SVG path (d) representation of the shape and then converting that path into normalized polygon point pairs, preserving compatibility with Cytoscape node shapes. SVG paths are retained only as an intermediate and rendering/editing aid and are not used as the canonical shape representation.


Design Details

  • Path-first shape generation
    Shapes are initially constructed as SVG paths (d strings), allowing curve definitions similar to vector design tools.

  • Path → polygon conversion
    The generated path is sampled and flattened into straight-line segments, producing a list of polygon point pairs (x1 y1 x2 y2 ...).

  • Normalization
    The resulting polygon points are normalized to a coordinate space centered at (0,0) and constrained to the [-1, 1] range, which matches Cytoscape’s polygon shape requirements.

  • Canonical format
    Normalized polygon point pairs are used as the primary stored and exported shape format. SVG paths are generated only for preview and editing and are not consumed downstream.


Features Added

  • Curve support for custom shapes via path-based authoring.
  • Click-to-close shape: clicking the starting point closes the shape explicitly and finalizes the polygon.
  • Editing after closing: Made it so that editing is also allowed even when the shape is closed.

Compatibility

  • Cytoscape
    Consumes only normalized polygon point pairs; no SVG path commands or Bézier curves are passed to Cytoscape.

Validation

  • Verified that path-derived polygons remain within normalized [-1, 1] bounds.
  • Confirmed shapes are closed, non-self-intersecting polygons.

📹 Demo

  • Checking Cytoscape Compatiblity
Shape.builder.mp4

Notes

  • This approach maintains backward compatibility while enabling curve-like shapes.
  • Polygon point density can be adjusted to balance visual fidelity and performance if required.

Please let me know if further validation or changes are needed.

Signed commits

  • Yes, I signed my commits.

Signed-off-by: SplinterSword <[email protected]>
@saurabhraghuvanshii
Copy link
Contributor

@SplinterSword can you add loom recording

Signed-off-by: SplinterSword <[email protected]>
@SplinterSword
Copy link
Contributor Author

Sorry @saurabhraghuvanshii I didn't see this message I will discuss it in today's meeting

@saurabhraghuvanshii
Copy link
Contributor

@SplinterSword it'll helpful you can show demo

@SplinterSword
Copy link
Contributor Author

Yeah I plan to

@leecalcote
Copy link
Member

@SplinterSword, do you think that you can get deployment previews working for this site? // @Rajesh-Nagarajan-11

@SplinterSword
Copy link
Contributor Author

SplinterSword commented Dec 19, 2025

@leecalcote If you want I will start working on deployment previews.

@SplinterSword
Copy link
Contributor Author

This forum is to discuss how to import the custom shape on kanvas. I would like some help regarding this as I couldn't find the appropriate docs to import the custom shape to kanvas.

https://discuss.layer5.io/t/how-to-test-the-cytoscape-polygon-compatibility-of-shapes-build-in-shapes-meshery-io-and-import-it-in-kanvas/7569?u=sparsh_jain

@kishore08-07
Copy link
Contributor

@SplinterSword
resolve the merge conflicts.

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.

Add support for curved shapes

4 participants