OHIF-155: tools: textBox anchor (center)

This commit is contained in:
Leonardo Campos committed 2017-02-23 10:32:42 -03:00
1 parent dd7c47bdb7
commit e7cd285f9c
5 files changed
+66 -16

No files matched your search

@@ -7,12 +7,15 @@ import { Viewerbase } from 'meteor/ohif:viewerbase';
var toolType = 'bidirectional';
const shadowConfig = Viewerbase.toolManager.getToolDefaultStates().shadowConfig;
const toolDefaultStates = Viewerbase.toolManager.getToolDefaultStates();
const shadowConfig = toolDefaultStates.shadowConfig;
const textBoxConfig = toolDefaultStates.textBoxConfig;
var configuration = {
getMeasurementLocationCallback: getMeasurementLocationCallback,
changeMeasurementLocationCallback: changeMeasurementLocationCallback,
...shadowConfig
...shadowConfig,
textBox: textBoxConfig
};
// Used to cancel tool placement
@@ -1018,11 +1021,11 @@ import { Viewerbase } from 'meteor/ohif:viewerbase';
var boundingBox = cornerstoneTools.drawTextBox(context,
textLines,
canvasTextLocation.x, canvasTextLocation.y, color);
canvasTextLocation.x, canvasTextLocation.y, color, config.textBox);
data.handles.textBox.boundingBox = boundingBox;
OHIF.cornerstone.repositionTextBox(eventData, data);
OHIF.cornerstone.repositionTextBox(eventData, data, config.textBox);
// Draw linked line as dashed
var link = {
@@ -7,7 +7,9 @@ import { Viewerbase } from 'meteor/ohif:viewerbase';
const toolType = 'nonTarget';
const shadowConfig = Viewerbase.toolManager.getToolDefaultStates().shadowConfig;
const toolDefaultStates = Viewerbase.toolManager.getToolDefaultStates();
const shadowConfig = toolDefaultStates.shadowConfig;
const textBoxConfig = toolDefaultStates.textBoxConfig;
const configuration = {
getMeasurementLocationCallback: getMeasurementLocationCallback,
@@ -15,7 +17,9 @@ import { Viewerbase } from 'meteor/ohif:viewerbase';
drawHandles: false,
drawHandlesOnHover: true,
arrowFirst: true,
...shadowConfig
textBox: textBoxConfig,
...shadowConfig,
};
// Used to cancel tool placement
@@ -253,10 +257,11 @@ import { Viewerbase } from 'meteor/ohif:viewerbase';
// Draw the text
if (data.measurementNumber) {
var boundingBox = cornerstoneTools.drawTextBox(context, `Non-Target ${data.measurementNumber}`, canvasTextLocation.x, canvasTextLocation.y, color);
var textLine = `Non-Target ${data.measurementNumber}`;
var boundingBox = cornerstoneTools.drawTextBox(context, textLine, canvasTextLocation.x, canvasTextLocation.y, color, config.textBox);
data.handles.textBox.boundingBox = boundingBox;
OHIF.cornerstone.repositionTextBox(eventData, data);
OHIF.cornerstone.repositionTextBox(eventData, data, config.textBox);
// Draw linked line as dashed
var link = {
@@ -1,3 +1,5 @@
import { Viewerbase } from 'meteor/ohif:viewerbase';
(function($, cornerstone, cornerstoneMath, cornerstoneTools) {
'use strict';
@@ -12,12 +14,16 @@
"toolResponse": "EX"
}];
const toolDefaultStates = Viewerbase.toolManager.getToolDefaultStates();
const textBoxConfig = toolDefaultStates.textBoxConfig;
var configuration = {
getMeasurementLocationCallback: getMeasurementLocationCallback,
changeMeasurementLocationCallback: changeMeasurementLocationCallback,
drawHandles: false,
drawHandlesOnHover: false,
arrowFirst: true
arrowFirst: true,
textBox: textBoxConfig
};
// Used to cancel tool placement
@@ -290,7 +296,8 @@
context.lineTo(canvasTextLocation.x + 20, canvasTextLocation.y + 20);
context.stroke();
var boundingBox = cornerstoneTools.drawTextBox(context, `Target ${data.measurementNumber}`, canvasTextLocation.x, canvasTextLocation.y, color);
var textLine = `Target ${data.measurementNumber}`;
var boundingBox = cornerstoneTools.drawTextBox(context, textLine, canvasTextLocation.x, canvasTextLocation.y, color, config.textBox);
data.handles.textBox.boundingBox = boundingBox;
}