-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Feat: add support for circular text background shape #3386
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
Feat: add support for circular text background shape #3386
Conversation
How does this work if you have a long, single-line label? All the existing bounds logic for labels assumes that the bounds are a rectangle. |
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.
Pull Request Overview
This PR adds support for a new circular text background shape and fixes redundant drawing issues for rectangle and round-rectangle backgrounds.
- Adds "circle" as an allowed value in the text background shape property.
- Introduces a new canvas drawing function for circular backgrounds and refines the round rectangle drawing logic.
- Updates documentation and tests to reflect the new background shape.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
src/style/properties.mjs | Added the "circle" option to the textBackgroundShape enums. |
src/extensions/renderer/canvas/drawing-label-text.mjs | Introduced the circle drawing function and adjusted drawing logic for background shapes. |
documentation/md/style.md | Updated the documentation to include "circle" for text backgrounds. |
debug/tests.js | Added a test case for the new circular text background shape. |
Comments suppressed due to low confidence (1)
src/extensions/renderer/canvas/drawing-label-text.mjs:132
- Consider adding a documentation comment for the 'circle' function to briefly explain its purpose and parameters.
function circle(ctx, x, y, width, height) {
That's fine. Those sorts of details would need to be noted in the documentation, so that the user's expectation is aligned with how it works. Would these circles be compatible with text-background-padding? |
Happy to add that
Yes, it does. In fact, padding allows the circle to expand. |
Great, this should be good to merge in with the documentation tweak |
@maxkfranz, documentation has been updated - would be great to get it merged. Cheers! |
Cross-references to related issues.
⚠️ Currently, label backgrounds in Cytoscape.js are limited to rectangle and round-rectangle.
Associated issues:
Notes re. the content of the pull request. Give context to reviewers or serve as a general record of the changes made. Add a screenshot or video to demonstrate your new feature, if possible.
text-background-shape: circle
rectangle
andround-rectangle
.📸 Demo:


Checklist
Author:
unstable
. Bug-fix patches can go on eitherunstable
ormaster
.index.d.ts
Typescript definition file has been appropriately updated.Reviewers:
master
branch and theunstable
branch. Normally, this just requires cherry-picking the corresponding merge commit frommaster
tounstable
-- or vice versa.cc: @maxkfranz @chrtannus