diff --git a/src/manipulators/moveNewHandle.js b/src/manipulators/moveNewHandle.js index 8e423b4ee..99cbdcdb0 100644 --- a/src/manipulators/moveNewHandle.js +++ b/src/manipulators/moveNewHandle.js @@ -58,16 +58,22 @@ export default function( handle.active = true; state.isToolLocked = true; - const moveHandler = _moveHandler.bind( - this, - toolName, - annotation, - handle, - options, - interactionType - ); + function moveHandler(evt) { + _moveHandler( + toolName, + annotation, + handle, + options, + interactionType, + { + moveHandler, + moveEndHandler, + }, + evt + ); + } // So we don't need to inline the entire `moveEndEventHandler` function - const moveEndHandler = evt => { + function moveEndHandler(evt) { _moveEndHandler( toolName, annotation, @@ -80,15 +86,12 @@ export default function( }, evt ); - }; + } // Add event listeners _moveEvents[interactionType].forEach(eventType => { element.addEventListener(eventType, moveHandler); }); - _moveEndEvents[interactionType].forEach(eventType => { - element.addEventListener(eventType, moveEndHandler); - }); element.addEventListener(EVENTS.TOUCH_START, _stopImmediatePropagation); } @@ -98,9 +101,15 @@ function _moveHandler( handle, options, interactionType, + { moveEndHandler }, evt ) { const { currentPoints, image, element, buttons } = evt.detail; + // Add moveEndEvent Handler when move trigger + + _moveEndEvents[interactionType].forEach(eventType => { + element.addEventListener(eventType, moveEndHandler); + }); const page = currentPoints.page; const fingerOffset = -57; const targetLocation = external.cornerstone.pageToPixel( diff --git a/src/tools/annotation/EllipticalRoiTool.test.js b/src/tools/annotation/EllipticalRoiTool.test.js index 2024c526e..f534a49f2 100644 --- a/src/tools/annotation/EllipticalRoiTool.test.js +++ b/src/tools/annotation/EllipticalRoiTool.test.js @@ -16,7 +16,9 @@ jest.mock('./../../externalModules.js', () => ({ metaData: { get: jest.fn(), }, + /* eslint-disable prettier/prettier */ getPixels: () => [100, 100, 100, 100, 4, 5, 100, 3, 6], + /* eslint-enable prettier/prettier */ }, })); diff --git a/src/tools/annotation/FreehandMouseTool.js b/src/tools/annotation/FreehandMouseTool.js index 4cf6d317d..84d95143c 100644 --- a/src/tools/annotation/FreehandMouseTool.js +++ b/src/tools/annotation/FreehandMouseTool.js @@ -1252,8 +1252,6 @@ export default class FreehandMouseTool extends BaseAnnotationTool { * @returns {Boolean} */ _checkInvalidHandleLocation(data, eventData) { - const { element } = eventData; - if (data.handles.points.length < 2) { return true; } diff --git a/src/tools/annotation/ProbeTool.test.js b/src/tools/annotation/ProbeTool.test.js index ecba75e6c..62bf2697f 100644 --- a/src/tools/annotation/ProbeTool.test.js +++ b/src/tools/annotation/ProbeTool.test.js @@ -17,10 +17,9 @@ jest.mock('./../../externalModules.js', () => ({ get: jest.fn(), }, getStoredPixels: (element, x, y) => { - // prettier-ignore - const storedPixels = [10, 20, 30, - 40, 50, 60, - 70, 80, 90]; + /* eslint-disable prettier/prettier */ + const storedPixels = [10, 20, 30, 40, 50, 60, 70, 80, 90]; + /* eslint-enable prettier/prettier */ return [storedPixels[x * 2 + y]]; }, diff --git a/src/tools/annotation/RectangleRoiTool.test.js b/src/tools/annotation/RectangleRoiTool.test.js index 95232d603..b49417ff7 100644 --- a/src/tools/annotation/RectangleRoiTool.test.js +++ b/src/tools/annotation/RectangleRoiTool.test.js @@ -16,10 +16,9 @@ jest.mock('./../../externalModules.js', () => ({ metaData: { get: jest.fn(), }, - // prettier-ignore - getPixels: () => [100, 100, 100, - 100, 4, 5, - 100, 3, 6] + /* eslint-disable prettier/prettier */ + getPixels: () => [100, 100, 100, 100, 4, 5, 100, 3, 6], + /* eslint-enable prettier/prettier */ }, })); diff --git a/src/tools/base/BaseAnnotationTool.js b/src/tools/base/BaseAnnotationTool.js index f208df519..9ae7ab84d 100644 --- a/src/tools/base/BaseAnnotationTool.js +++ b/src/tools/base/BaseAnnotationTool.js @@ -168,6 +168,7 @@ class BaseAnnotationTool extends BaseTool { * @returns {void} */ updateCachedStats(image, element, data) { + // eslint-disable-line logger.warn(`updateCachedStats not implemented for ${this.name}.`); } } diff --git a/src/tools/cursors/MouseCursor.js b/src/tools/cursors/MouseCursor.js index 337e94f1b..d91f276d6 100644 --- a/src/tools/cursors/MouseCursor.js +++ b/src/tools/cursors/MouseCursor.js @@ -3,6 +3,8 @@ import { modules } from '../../store/index.js'; const cursorModule = modules.cursor; +/* eslint-disable valid-jsdoc */ + /* MACROS - The following keys will have the appropriate value injected when an SVG is requested: