Skip to content

fix(ArrowAnnotate): use svg marker to draw the arrow #1732

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

Merged
merged 3 commits into from
Jan 22, 2025

Conversation

daker
Copy link
Contributor

@daker daker commented Dec 26, 2024

Context

fix #1671

Changes & Results

Using marker html def instead of two separate arrows for better control over arrow

size 1 size 2 size 3 size 4
1 2 3 4

By default, ArrowAnnotateTool uses the previous version, but you can opt for the new one by using the following code:

toolGroup.addTool(ArrowAnnotateTool.toolName, {
  arrowHeadStyle: 'standard',
});

To change the marker head size, you can use the ToolStyle API. For example, you can do something like this:

const newStyles = {
  global: {
    ...cornerstoneTools.annotation.config.style.getDefaultToolStyles().global,
    markerSize: 20,
  },
};

cornerstoneTools.annotation.config.style.setDefaultToolStyles(newStyles);

Testing

Checklist

PR

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

Code

Public Documentation Updates

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

Tested Environment

  • [] "OS:
  • [] "Node version:
  • [] "Browser:

Copy link

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Copy link

netlify bot commented Dec 26, 2024

Deploy Preview for cornerstone-3d-docs failed. Why did it fail? →

Name Link
🔨 Latest commit e8b10c2
🔍 Latest deploy log https://app.netlify.com/sites/cornerstone-3d-docs/deploys/6791384c05e0010008e0b8e8

@daker daker force-pushed the fix-arrowannotate branch from baa240c to 566ab17 Compare December 26, 2024 19:40
fix

api
@sedghi
Copy link
Member

sedghi commented Jan 22, 2025

@daker, thanks for starting this fix.
I made a couple of changes.

  1. One marker definition isn't enough since we have different colors based on the state (like selected or locked), and that was causing some issues when the color wasn't changing. So, I refactored it to have multiple marker definitions.
  2. I'm making this a configuration option on the tool, because I don't want people's tests to fail. For now, let's keep it under a configuration, and in Cornerstone 3.x, we'll default to it.

Thanks again. Take a look at the changes and let me know if you're okay with them, then I'll merge.

@sedghi sedghi mentioned this pull request Jan 22, 2025
10 tasks
@daker
Copy link
Contributor Author

daker commented Jan 22, 2025

@sedghi all good 👍🏼

@sedghi sedghi merged commit 42e8038 into cornerstonejs:main Jan 22, 2025
22 of 26 checks passed
@daker daker deleted the fix-arrowannotate branch January 22, 2025 20:40
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.

[Bug] Arrow annotate tool ui's become broken when increase the line width
2 participants