Cancel mouse-tool-interaction when getting deactivated
See original GitHub issuePrerequisites
- Are you running the latest version?
- Are you reporting to the correct repository?
- Did you perform a cursory search?
For more information, see the CONTRIBUTING
guide.
Description
Say, for example, I activated the WWWC-tool for the left mouse-button:
cornerstone.tools.wwwc.activate(element, 1)
I start dragging the mouse… (Everything working as expected.) Now, while I am still dragging, I deactivate the tool. (For example due to another event.)
cornerstone.tools.wwwc.deactivate(element)
Even though the tool is now disabled, I am still able to use it as long as I am still holding the mouse-button pressed.
Steps to Reproduce
- Activate a mouse-dragging based tool
- Start using it (hold assigned mouse-button)
- Deactivate tool
- Continue using the tool despite being deactivated
Expected behavior:
Tool stops to function as soon as it gets deactivated. (Exactly the way touch-drag-based tools currently do.)
Actual behavior:
Tool continues to function as normal until a mouse-button is lifted.
Codepen With Reproduction of Issue:
https://codepen.io/anon/pen/ejVeGK
After clicking the button, the wwwc tool is activated and again deactivated after 1 sec.
Solution
After inspecting the code, the problem is quite obvious and probably easy to fix:
src/imageTools/simpleMouseButtonTool.js
only receives a mouseDownCallback
. Additionally some kind of deactivatedCallback
is needed, to signal the implementing tools (for example src/imageTools/wwwc.js
), that they need to unbind their EVENTS.MOUSE_DRAG
-Listeners.
I can start a PR for this.
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (6 by maintainers)
Top GitHub Comments
@freund17 on my list to
fork
your codepen with a working example today. I’ll see what I can do 🙌@fruend17, I’m making this as closed. If you find that the demo I provided does not work as expected (or that the finalized version of vNext does not), please feel free to re-open this issue.
If you would like to Beta test vNext and provide feedback as well continue to shape and ultimately publish is, please feel free to send an email to danny.ri.brown@gmail.com, and I will add you to contributor Slack group.