Skip to content

Commit

Permalink
Fix moveNewHandle (#1209)
Browse files Browse the repository at this point in the history
* Fix moveNewHandle

* fix: 🐛 Fixes moveNewHandle for click-move-click interaction
  • Loading branch information
JamesAPetts authored Apr 2, 2020
1 parent 24bca45 commit 1a627bf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 18 deletions.
8 changes: 8 additions & 0 deletions src/manipulators/moveNewHandle.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ export default function(
options
);

options.hasMoved = false;

const { element } = eventData;

annotation.active = true;
Expand Down Expand Up @@ -135,6 +137,8 @@ function _moveHandler(
) {
const { currentPoints, image, element, buttons } = evt.detail;

options.hasMoved = true;

const page = currentPoints.page;
const fingerOffset = -57;
const targetLocation = external.cornerstone.pageToPixel(
Expand Down Expand Up @@ -218,6 +222,10 @@ function _moveEndHandler(
const eventData = evt.detail;
const { element, currentPoints } = eventData;

if (options.hasMoved === false) {
return;
}

const page = currentPoints.page;
const fingerOffset = -57;
const targetLocation = external.cornerstone.pageToPixel(
Expand Down
18 changes: 0 additions & 18 deletions src/store/modules/manipulatorStateModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,24 +56,6 @@ function removeEnabledElementCallback(element) {
removeActiveManipulatorForElement(element);
}

//

// const enabledElements = cornerstoneTools.store.state.enabledElements;

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

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

///

function enabledElementCallback(element) {
const { NEW_IMAGE } = external.cornerstone.EVENTS;

Expand Down

0 comments on commit 1a627bf

Please sign in to comment.