cornerstoneTools icon indicating copy to clipboard operation
cornerstoneTools copied to clipboard

fix(RotateTool.js): evaluation of initialRotation

Open wang0122xl opened this issue 3 years ago • 3 comments

fix: RotateTool rotate too quick when viewport.initialRotation is 0

  • Please check if the PR fulfills these requirements
  • [x] The commit message follows our guidelines
  • [ ] Tests for the changes have been added (for bug fixes / features)
  • [ ] Docs have been added / updated (for bug fixes / features)
  • What kind of change does this PR introduce? (Bug fix, feature, docs update, ...) Bug fix

  • What is the current behavior? (You can also link to an open issue here) RotateTool rotate too quick when viewport.initialRotation is 0

  • What is the new behavior (if this is a feature change)? rotate normally

  • Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?) No

  • Other information:

wang0122xl avatar Jan 25 '22 12:01 wang0122xl

Codecov Report

Merging #1461 (75ea421) into master (95c3b7c) will not change coverage. The diff coverage is 0.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1461   +/-   ##
=======================================
  Coverage   20.16%   20.16%           
=======================================
  Files         287      287           
  Lines       10102    10102           
  Branches     2060     2060           
=======================================
  Hits         2037     2037           
  Misses       6852     6852           
  Partials     1213     1213           
Impacted Files Coverage Δ
src/tools/RotateTool.js 16.66% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 95c3b7c...75ea421. Read the comment docs.

codecov[bot] avatar Jan 25 '22 12:01 codecov[bot]

Hi ! I ran into the same problem. The recent change introduced in the 5.2.0 release has been made on purpose : Fix RotateTool on mobile devices (#1385) (cdf23b5).

Checking for undefined should preserved both attended behaviours :

  const initialRotation = viewport.initialRotation !== undefined
    ? viewport.initialRotation
    : viewport.rotation;

Hope it helps :pray:

For those needing the fix urgently, you can use a custom strategy with the RotateTool.

LaurentTrk avatar Jan 31 '22 17:01 LaurentTrk

@LaurentTrk Thx, I just made a new commit including the condition of undefined.

wang0122xl avatar Feb 08 '22 02:02 wang0122xl