PWV-138: Deselecting arm when advancing to another lesion
This commit is contained in:
parent
b17f5040db
commit
8c6a72cc0f
@ -677,9 +677,6 @@ function clearBidirectionalSelection(event) {
|
|||||||
const toolData = cornerstoneTools.getToolState(event.currentTarget, 'bidirectional');
|
const toolData = cornerstoneTools.getToolState(event.currentTarget, 'bidirectional');
|
||||||
if (!toolData) return;
|
if (!toolData) return;
|
||||||
toolData.data.forEach(data => {
|
toolData.data.forEach(data => {
|
||||||
data.selected = false;
|
|
||||||
imageNeedsUpdate = data.active || imageNeedsUpdate;
|
|
||||||
data.active = false;
|
|
||||||
const unselectResult = unselectAllHandles(data.handles);
|
const unselectResult = unselectAllHandles(data.handles);
|
||||||
imageNeedsUpdate = imageNeedsUpdate || unselectResult;
|
imageNeedsUpdate = imageNeedsUpdate || unselectResult;
|
||||||
});
|
});
|
||||||
@ -824,8 +821,13 @@ function mouseMoveCallback(e, eventData) {
|
|||||||
|
|
||||||
// mouseDowCallback is used to restrict behaviour of perpendicular-line
|
// mouseDowCallback is used to restrict behaviour of perpendicular-line
|
||||||
function mouseDownCallback(e, eventData) {
|
function mouseDownCallback(e, eventData) {
|
||||||
var data;
|
let data;
|
||||||
var element = eventData.element;
|
const element = eventData.element;
|
||||||
|
const $element = $(element);
|
||||||
|
|
||||||
|
// Add an event listener to clear the selected state when a measurement is activated
|
||||||
|
const activateEventKey = 'ViewerMeasurementsActivated';
|
||||||
|
$element.off(activateEventKey).on(activateEventKey, () => clearBidirectionalSelection(e));
|
||||||
|
|
||||||
// Clear selection on left mouse button click
|
// Clear selection on left mouse button click
|
||||||
let imageNeedsUpdate = false;
|
let imageNeedsUpdate = false;
|
||||||
@ -838,7 +840,7 @@ function mouseDownCallback(e, eventData) {
|
|||||||
|
|
||||||
function handleDoneMove(handle) {
|
function handleDoneMove(handle) {
|
||||||
// Set the cursor back to its default
|
// Set the cursor back to its default
|
||||||
$(element).css('cursor', '');
|
$element.css('cursor', '');
|
||||||
|
|
||||||
data.invalidated = true;
|
data.invalidated = true;
|
||||||
if (cornerstoneTools.anyHandlesOutsideImage(eventData, data.handles)) {
|
if (cornerstoneTools.anyHandlesOutsideImage(eventData, data.handles)) {
|
||||||
@ -853,7 +855,7 @@ function mouseDownCallback(e, eventData) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cornerstone.updateImage(element);
|
cornerstone.updateImage(element);
|
||||||
$(element).on('CornerstoneToolsMouseMove', eventData, mouseMoveCallback);
|
$element.on('CornerstoneToolsMouseMove', eventData, mouseMoveCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cornerstoneTools.isMouseButtonEnabled(eventData.which, e.data.mouseButtonMask)) {
|
if (cornerstoneTools.isMouseButtonEnabled(eventData.which, e.data.mouseButtonMask)) {
|
||||||
@ -870,9 +872,9 @@ function mouseDownCallback(e, eventData) {
|
|||||||
var handle = cornerstoneTools.getHandleNearImagePoint(element, data.handles, coords, distance);
|
var handle = cornerstoneTools.getHandleNearImagePoint(element, data.handles, coords, distance);
|
||||||
if (handle) {
|
if (handle) {
|
||||||
// Hide the cursor to improve precision while resizing the line or set to move if dragging text box
|
// Hide the cursor to improve precision while resizing the line or set to move if dragging text box
|
||||||
$(element).css('cursor', handle.hasBoundingBox ? 'move' : 'none');
|
$element.css('cursor', handle.hasBoundingBox ? 'move' : 'none');
|
||||||
|
|
||||||
$(element).off('CornerstoneToolsMouseMove', mouseMoveCallback);
|
$element.off('CornerstoneToolsMouseMove', mouseMoveCallback);
|
||||||
data.active = true;
|
data.active = true;
|
||||||
|
|
||||||
unselectAllHandles(data.handles);
|
unselectAllHandles(data.handles);
|
||||||
@ -896,9 +898,9 @@ function mouseDownCallback(e, eventData) {
|
|||||||
data = toolData.data[i];
|
data = toolData.data[i];
|
||||||
if (pointNearTool(element, data, coords)) {
|
if (pointNearTool(element, data, coords)) {
|
||||||
// Set the cursor to move
|
// Set the cursor to move
|
||||||
$(element).css('cursor', 'move');
|
$element.css('cursor', 'move');
|
||||||
|
|
||||||
$(element).off('CornerstoneToolsMouseMove', mouseMoveCallback);
|
$element.off('CornerstoneToolsMouseMove', mouseMoveCallback);
|
||||||
data.active = true;
|
data.active = true;
|
||||||
|
|
||||||
unselectAllHandles(data.handles);
|
unselectAllHandles(data.handles);
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
import { $ } from 'meteor/jquery';
|
||||||
import { OHIF } from 'meteor/ohif:core';
|
import { OHIF } from 'meteor/ohif:core';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -33,7 +34,7 @@ function activateTool(measurementData) {
|
|||||||
* Deactivate all other measurements on the switched image (color to be white)
|
* Deactivate all other measurements on the switched image (color to be white)
|
||||||
*/
|
*/
|
||||||
OHIF.measurements.activateMeasurements = (element, measurementData) => {
|
OHIF.measurements.activateMeasurements = (element, measurementData) => {
|
||||||
console.log('activateMeasurements');
|
OHIF.log.info('activateMeasurements');
|
||||||
|
|
||||||
// If Cornerstone Viewport information was stored while the measurement was created,
|
// If Cornerstone Viewport information was stored while the measurement was created,
|
||||||
// we should re-apply this data when activating the measurement.
|
// we should re-apply this data when activating the measurement.
|
||||||
@ -81,7 +82,8 @@ OHIF.measurements.activateMeasurements = (element, measurementData) => {
|
|||||||
// updated and the highlight is removed from inactive tools in all visible viewports
|
// updated and the highlight is removed from inactive tools in all visible viewports
|
||||||
const $viewports = $('.imageViewerViewport');
|
const $viewports = $('.imageViewerViewport');
|
||||||
$viewports.each((index, element) => {
|
$viewports.each((index, element) => {
|
||||||
if (!$(element).find('canvas')) {
|
const $element = $(element);
|
||||||
|
if (!$element.find('canvas')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,6 +101,7 @@ OHIF.measurements.activateMeasurements = (element, measurementData) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$element.trigger('ViewerMeasurementsActivated');
|
||||||
cornerstone.updateImage(element);
|
cornerstone.updateImage(element);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user