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

Event cancelling for manipulators #1195

Merged

Conversation

JamesAPetts
Copy link
Member

Add in event cancelling for manipulators.

Paste this in the netlify demo console and then you can use ESC (at least on Chrome) to test moveNewHandle, moveHandle and moveAllHandles:

const cancelActiveManipulatorsForElement = cornerstoneTools.getModule(
  'manipulatorState'
).setters.cancelActiveManipulatorsForElement;

const enabledElements = cornerstoneTools.store.state.enabledElements;

enabledElements.forEach(element => {
  element.addEventListener('keydown', evt => {
    if (evt.keyCode === 27) {
      cancelActiveManipulatorsForElement(element);
    }
  });
});

Only cancelation of moveNewHandle will solve these issues.

Note that not all tools use manipulators, other tools would ideally be switched to use them (e.g. freehand tool, bidirectional tool).

@JamesAPetts JamesAPetts requested a review from dannyrb March 18, 2020 10:33
@codecov
Copy link

codecov bot commented Mar 18, 2020

Codecov Report

Merging #1195 into master will decrease coverage by 0.08%.
The diff coverage is 3.8%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1195      +/-   ##
==========================================
- Coverage   18.81%   18.73%   -0.09%     
==========================================
  Files         284      286       +2     
  Lines        8518     8571      +53     
  Branches     1453     1457       +4     
==========================================
+ Hits         1603     1606       +3     
- Misses       5728     5774      +46     
- Partials     1187     1191       +4
Impacted Files Coverage Δ
src/store/index.js 45.45% <ø> (-4.55%) ⬇️
...ispatchers/mouseEventHandlers/addNewMeasurement.js 6.25% <ø> (ø) ⬆️
src/stateManagement/toolState.js 0% <0%> (ø) ⬆️
src/tools/annotation/CobbAngleTool.js 0% <0%> (ø) ⬆️
src/tools/annotation/AngleTool.js 0% <0%> (ø) ⬆️
src/tools/annotation/ArrowAnnotateTool.js 0% <0%> (ø) ⬆️
src/util/uuidv4.js 0% <0%> (ø)
src/manipulators/moveHandle.js 6.17% <10%> (+1.17%) ⬆️
src/manipulators/moveAllHandles.js 6.89% <10%> (+1.23%) ⬆️
src/store/modules/manipulatorStateModule.js 3.57% <3.57%> (ø)
... and 3 more

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 b4afdef...d0b2a1a. Read the comment docs.

Copy link
Member

@dannyrb dannyrb left a comment

Choose a reason for hiding this comment

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

LGTM 👍
Discussed offline. This moves us in the right direction. Would eventually like to make this song-and-dance less magic (baked into manipulators? different abstraction?) This satisfies the core issue and is great to build off of.

@dannyrb dannyrb merged commit 3987557 into cornerstonejs:master Mar 24, 2020
@dannyrb
Copy link
Member

dannyrb commented Mar 24, 2020

🎉 This PR is included in version 4.13.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@JamesAPetts JamesAPetts mentioned this pull request Apr 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants