LT-304 Difficult to select target tool on canvas for repositioning

This commit is contained in:
Emanuel F. Oliveira 2016-11-10 21:27:01 -02:00 committed by Erik Ziegler
parent 75bb0a80b2
commit dd2f2cc466

View File

@ -15,6 +15,9 @@
ESC: 27 ESC: 27
}; };
// The distance between the mouse and the tool to make it active
var distanceThreshold = 7;
// Set lesion number // Set lesion number
// Get Target lesions on image // Get Target lesions on image
function setMeasurementNumberCallback(measurementData, eventData, doneCallback) { function setMeasurementNumberCallback(measurementData, eventData, doneCallback) {
@ -233,7 +236,7 @@
return true; return true;
} }
return (distanceToPoint < 5); return (distanceToPoint < distanceThreshold);
} }
function pointNearPerpendicular(element, handles, coords) { function pointNearPerpendicular(element, handles, coords) {
@ -242,7 +245,7 @@
end: cornerstone.pixelToCanvas(element, handles.perpendicularEnd) end: cornerstone.pixelToCanvas(element, handles.perpendicularEnd)
}; };
var distanceToPoint = cornerstoneMath.lineSegment.distanceToPoint(lineSegment, coords); var distanceToPoint = cornerstoneMath.lineSegment.distanceToPoint(lineSegment, coords);
return (distanceToPoint < 5); return (distanceToPoint < distanceThreshold);
} }
// Move long-axis start point // Move long-axis start point
@ -950,6 +953,7 @@
for (var i = 0; i < toolData.data.length; i++) { for (var i = 0; i < toolData.data.length; i++) {
var data = toolData.data[i]; var data = toolData.data[i];
var strokeWidth = lineWidth;
context.save(); context.save();
@ -962,6 +966,8 @@
if (data.active) { if (data.active) {
color = cornerstoneTools.toolColors.getActiveColor(); color = cornerstoneTools.toolColors.getActiveColor();
// increase line width of active tool...
strokeWidth *= 1.5;
} else { } else {
color = cornerstoneTools.toolColors.getToolColor(); color = cornerstoneTools.toolColors.getToolColor();
} }
@ -973,13 +979,13 @@
context.beginPath(); context.beginPath();
context.strokeStyle = color; context.strokeStyle = color;
context.lineWidth = lineWidth; context.lineWidth = strokeWidth;
context.moveTo(handleStartCanvas.x, handleStartCanvas.y); context.moveTo(handleStartCanvas.x, handleStartCanvas.y);
context.lineTo(handleEndCanvas.x, handleEndCanvas.y); context.lineTo(handleEndCanvas.x, handleEndCanvas.y);
context.stroke(); context.stroke();
// Draw perpendicular line // Draw perpendicular line
drawPerpendicularLine(context, eventData, element, data, color, lineWidth); drawPerpendicularLine(context, eventData, element, data, color, strokeWidth);
// draw the handles // draw the handles
cornerstoneTools.drawHandles(context, eventData, data.handles, color); cornerstoneTools.drawHandles(context, eventData, data.handles, color);
@ -987,7 +993,7 @@
//Draw linked line as dashed //Draw linked line as dashed
context.beginPath(); context.beginPath();
context.strokeStyle = color; context.strokeStyle = color;
context.lineWidth = lineWidth; context.lineWidth = strokeWidth;
context.setLineDash([ 2, 3 ]); context.setLineDash([ 2, 3 ]);
// Set position of text // Set position of text