Skip to content

refactor(Tools): Cleanup code for drawingSvg, make 'data-id' attribut… #1952

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

siclesia
Copy link

…e consistant

Context

When adding svg annotation, there is a custom attribute 'data-id' intended for automation test.
the feature was not consistently implemented ( most of the time missing ) and is somehow redundant with internal unique id.

This PR remove custom value for data-id and uses the internal uid.

Changes & Results

only impacts 'data-id' attribute in SVG elements.

Testing

use stack annotation tools / https://www.cornerstonejs.org/live-examples/stackannotationtools

Checklist

PR

  • My Pull Request title is descriptive, accurate and follows the
    semantic-release format and guidelines.

Code

  • My code has been well-documented (function documentation, inline comments,
    etc.)

Public Documentation Updates

  • [] The documentation page has been updated as necessary for any public API
    additions or removals.

Tested Environment

  • "OS: Ubuntu 24
  • "Node version: 22
  • "Browser: firefox

Copy link

netlify bot commented Mar 30, 2025

Deploy Preview for cornerstone-3d-docs ready!

Name Link
🔨 Latest commit f4f8ac5
🔍 Latest deploy log https://app.netlify.com/sites/cornerstone-3d-docs/deploys/67eac5a117411e00083c4d7c
😎 Deploy Preview https://deploy-preview-1952--cornerstone-3d-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Comment on lines +5 to +12
function _draw(
what: 'circle' | 'line' | 'ellipse' | 'rect' | 'path' | 'polyline' | 'g',
svgDrawingHelper: SVGDrawingHelper,
annotationUID: string,
drawingId: string,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
attributes: Record<string, any>
): {
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 use an object instead of positional parameters?

Copy link
Author

Choose a reason for hiding this comment

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

over my dead body ;-). this is typically over engineering in my opinion.

( we are talking of 5 positional arguments that fit into a single line of text in most cases )

Copy link
Member

Choose a reason for hiding this comment

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

The issue is, later on, we're developing another tool that needs to use the _draw, but for some weird reason, it doesn't actually need drawingId or whatever. Then we end up using _draw like this:

_draw(null, svgDrawingHelper, null, ...)

I hope that makes sense.

Copy link
Member

@sedghi sedghi left a comment

Choose a reason for hiding this comment

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

please see my comments

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.

2 participants