question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cancel mouse-tool-interaction when getting deactivated

See original GitHub issue

Prerequisites

  • 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

  1. Activate a mouse-dragging based tool
  2. Start using it (hold assigned mouse-button)
  3. Deactivate tool
  4. 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:closed
  • Created 5 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
dannyrbcommented, Aug 14, 2018

@freund17 on my list to fork your codepen with a working example today. I’ll see what I can do 🙌

0reactions
dannyrbcommented, Aug 18, 2018

@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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cancel, Deactivate, or Reactivate a Facility Registration
The process of cancelling or deactivating a registration takes less than five minutes. ... Click the box by the certification statement and select...
Read more >
Temporarily deactivate your Instagram account
Tap Temporarily Deactivate Account. Tap Yes to confirm or No to cancel. You'll need to be able to log into your account to...
Read more >
How do I temporarily deactivate my Facebook account?
Learn how to delete or deactivate individual profiles. You can deactivate your account temporarily and choose to come back whenever you want.
Read more >
Help with account deactivation - Twitter Help Center
I tried to deactivate, but it says I have the wrong password ... I deactivated my account, but it keeps getting reactivated.
Read more >
About deactivated AdMob accounts - Google Support
Note: If you no longer need your AdMob account, you can cancel your AdMob account after you reactivate it. FAQs. Can I still...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found