Skip to content
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

fix(toolbox): Preserve user-specified tool state and streamline command execution #4063

Merged
merged 12 commits into from
Apr 29, 2024

Conversation

sedghi
Copy link
Member

@sedghi sedghi commented Apr 23, 2024

needs this cornerstonejs/cornerstone3D#1225

Context

Breaking Changes

The Double Range option

The values is renamed to value

CleanShot 2024-04-23 at 16 51 17@2x

Toolbox (with Options) Commmands

Now the top level commands is removed and each commands in the options automatically runs upon entry to make sure the state is preserved

CleanShot 2024-04-23 at 16 51 28@2x

previously there were two sets of commands, one at the top level and one at the options level which caused a lot of issues

 {
    id: 'Shapes',
    uiType: 'ohif.radioGroup',
    props: {
      label: 'Shapes',
      evaluate: {
        name: 'evaluate.cornerstone.segmentation',
        toolNames: ['CircleScissor', 'SphereScissor', 'RectangleScissor'],
      },
      icon: 'icon-tool-shape',
      commands: _createSetToolActiveCommands('CircleScissor'),
      options: [
        {
          name: 'Shape',
          type: 'radio',
          value: 'CircleScissor',
          id: 'shape-mode',
          values: [
            { value: 'CircleScissor', label: 'Circle' },
            { value: 'SphereScissor', label: 'Sphere' },
            { value: 'RectangleScissor', label: 'Rectangle' },
          ],
          commands: 'setToolActiveToolbar',
        },
      ],
    },
  },

Now if you have options, you can just have the commands options, and that will make sure the state is correctly set based on the latest state

{
    id: 'Shapes',
    uiType: 'ohif.radioGroup',
    props: {
      label: 'Shapes',
      evaluate: {
        name: 'evaluate.cornerstone.segmentation',
        toolNames: ['CircleScissor', 'SphereScissor', 'RectangleScissor'],
      },
      icon: 'icon-tool-shape',
      options: [
        {
          name: 'Shape',
          type: 'radio',
          value: 'CircleScissor',
          id: 'shape-mode',
          values: [
            { value: 'CircleScissor', label: 'Circle' },
            { value: 'SphereScissor', label: 'Sphere' },
            { value: 'RectangleScissor', label: 'Rectangle' },
          ],
          commands: 'setToolActiveToolbar',
        },
      ],
    },
  },

Toolbox was resetting the user specified tool

Previously

CleanShot.2024-04-23.at.16.35.02.mp4

Current
Fixes it

Was not able to jump correctly in volume viewports

https://share.cleanshot.com/q9VmwK0r


Changes & Results

Testing

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:
  • [] Node version:
  • [] Browser:

Copy link

netlify bot commented Apr 23, 2024

Deploy Preview for ohif-dev ready!

Name Link
🔨 Latest commit 11a5c33
🔍 Latest deploy log https://app.netlify.com/sites/ohif-dev/deploys/662fc0100fa9190008b34798
😎 Deploy Preview https://deploy-preview-4063--ohif-dev.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.

Copy link

netlify bot commented Apr 23, 2024

Deploy Preview for ohif-platform-docs ready!

Name Link
🔨 Latest commit 11a5c33
🔍 Latest deploy log https://app.netlify.com/sites/ohif-platform-docs/deploys/662fc0107b7728000893d254
😎 Deploy Preview https://deploy-preview-4063--ohif-platform-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.

@sedghi sedghi changed the title Fix toolbar service bug and update dependencies fix(toolbox): Preserve user-specified tool state and streamline command execution Apr 23, 2024
Copy link

codecov bot commented Apr 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 44.41%. Comparing base (8a335bd) to head (75f4fd2).
Report is 352 commits behind head on master.

❗ Current head 75f4fd2 differs from pull request most recent head 11a5c33. Consider uploading reports for the commit 11a5c33 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4063      +/-   ##
==========================================
- Coverage   46.23%   44.41%   -1.83%     
==========================================
  Files          78       80       +2     
  Lines        1276     1333      +57     
  Branches      312      327      +15     
==========================================
+ Hits          590      592       +2     
- Misses        548      588      +40     
- Partials      138      153      +15     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sedghi sedghi requested a review from IbrahimCSAE April 23, 2024 20:47
Copy link

cypress bot commented Apr 23, 2024

Passing run #3871 ↗︎

0 43 0 0 Flakiness 0

Details:

Merge branch 'master' of github.com:OHIF/Viewers into fix/3p8-rc6
Project: Viewers Commit: 11a5c33426
Status: Passed Duration: 06:47 💡
Started: Apr 29, 2024 4:05 PM Ended: Apr 29, 2024 4:11 PM

Review all test suite changes for PR #4063 ↗︎

Copy link
Collaborator

@IbrahimCSAE IbrahimCSAE left a comment

Choose a reason for hiding this comment

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

LGTM

@sedghi sedghi merged commit f1a736d into master Apr 29, 2024
7 checks passed
WillianVarela pushed a commit to cfaz-net/dicomviewer that referenced this pull request Apr 30, 2024
thanh-nguyen-dang pushed a commit to uc-cdis/Viewers that referenced this pull request May 1, 2024
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