LT-298: Implementing rename behavior for measurement table
This commit is contained in:
parent
8a265b248a
commit
5c36074f8a
@ -141,7 +141,8 @@ Template.viewer.events({
|
|||||||
if (toolData.active) {
|
if (toolData.active) {
|
||||||
OHIF.measurements.toggleLabelButton({
|
OHIF.measurements.toggleLabelButton({
|
||||||
instance,
|
instance,
|
||||||
toolData,
|
measurementId: toolData._id,
|
||||||
|
toolType: toolData.toolType,
|
||||||
element,
|
element,
|
||||||
measurementApi: instance.data.measurementApi,
|
measurementApi: instance.data.measurementApi,
|
||||||
position: data.currentPoints.page
|
position: data.currentPoints.page
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import { Template } from 'meteor/templating';
|
import { Template } from 'meteor/templating';
|
||||||
import { ReactiveVar } from 'meteor/reactive-var';
|
import { ReactiveVar } from 'meteor/reactive-var';
|
||||||
|
import { OHIF } from 'meteor/ohif:core';
|
||||||
|
|
||||||
Template.caseProgress.onCreated(() => {
|
Template.caseProgress.onCreated(() => {
|
||||||
const instance = Template.instance();
|
const instance = Template.instance();
|
||||||
|
|||||||
@ -81,6 +81,10 @@ Template.measureFlow.onRendered(() => {
|
|||||||
instance.$('.measure-flow').bounded();
|
instance.$('.measure-flow').bounded();
|
||||||
|
|
||||||
instance.$('.btn-add').focus();
|
instance.$('.btn-add').focus();
|
||||||
|
|
||||||
|
if (instance.data.autoClick) {
|
||||||
|
instance.$('.btn-add').hide().trigger('click');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Template.measureFlow.events({
|
Template.measureFlow.events({
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
import { Meteor } from 'meteor/meteor';
|
||||||
|
import { Template } from 'meteor/templating';
|
||||||
import { OHIF } from 'meteor/ohif:core';
|
import { OHIF } from 'meteor/ohif:core';
|
||||||
|
|
||||||
function doneCallback(measurementData, deleteTool) {
|
function doneCallback(measurementData, deleteTool) {
|
||||||
@ -14,7 +16,7 @@ function doneCallback(measurementData, deleteTool) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Delete a lesion if Ctrl+D or DELETE is pressed while a lesion is selected
|
// Delete a lesion if Ctrl+D or DELETE is pressed while a lesion is selected
|
||||||
var keys = {
|
const keys = {
|
||||||
D: 68,
|
D: 68,
|
||||||
DELETE: 46
|
DELETE: 46
|
||||||
};
|
};
|
||||||
@ -26,10 +28,25 @@ Template.measurementTableRow.events({
|
|||||||
$row.toggleClass('active');
|
$row.toggleClass('active');
|
||||||
},
|
},
|
||||||
|
|
||||||
'dblclick .location': function() {
|
'click .js-rename'(event, instance) {
|
||||||
|
OHIF.measurements.toggleLabelButton({
|
||||||
|
instance,
|
||||||
|
measurementId: instance.data.rowItem.entries[0],
|
||||||
|
measurementTypeId: instance.data.rowItem.measurementTypeId,
|
||||||
|
element: document.body,
|
||||||
|
measurementApi: instance.data.measurementApi,
|
||||||
|
position: {
|
||||||
|
x: event.clientX,
|
||||||
|
y: event.clientY
|
||||||
|
},
|
||||||
|
autoClick: true
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
'dblclick .location'() {
|
||||||
OHIF.log.info('Double clicked on Lesion Location cell');
|
OHIF.log.info('Double clicked on Lesion Location cell');
|
||||||
|
|
||||||
var measurementData = this;
|
const measurementData = this;
|
||||||
|
|
||||||
// TODO = Fix this weird issue? Need to set toolData's ID properly..
|
// TODO = Fix this weird issue? Need to set toolData's ID properly..
|
||||||
measurementData.id = this._id;
|
measurementData.id = this._id;
|
||||||
@ -37,13 +54,13 @@ Template.measurementTableRow.events({
|
|||||||
changeLesionLocationCallback(measurementData, null, doneCallback);
|
changeLesionLocationCallback(measurementData, null, doneCallback);
|
||||||
},
|
},
|
||||||
|
|
||||||
'keydown .location': function(e) {
|
'keydown .location'(event) {
|
||||||
var keyCode = e.which;
|
const keyCode = event.which;
|
||||||
|
|
||||||
if (keyCode === keys.DELETE ||
|
if (keyCode === keys.DELETE ||
|
||||||
(keyCode === keys.D && e.ctrlKey === true)) {
|
(keyCode === keys.D && event.ctrlKey === true)) {
|
||||||
var currentMeasurement = this;
|
const currentMeasurement = this;
|
||||||
var options = {
|
const options = {
|
||||||
keyPressAllowed: false,
|
keyPressAllowed: false,
|
||||||
title: 'Remove measurement?',
|
title: 'Remove measurement?',
|
||||||
text: 'Are you sure you would like to remove the entire measurement?'
|
text: 'Are you sure you would like to remove the entire measurement?'
|
||||||
|
|||||||
@ -21,15 +21,16 @@ OHIF.measurements.toggleLabelButton = options => {
|
|||||||
removeButtonView();
|
removeButtonView();
|
||||||
}
|
}
|
||||||
|
|
||||||
const tool = toolMap[options.toolData.toolType];
|
const tool = options.measurementTypeId || toolMap[options.toolType];
|
||||||
const toolCollection = options.measurementApi[tool];
|
const toolCollection = options.measurementApi[tool];
|
||||||
const measurement = toolCollection.findOne(options.toolData._id);
|
const measurement = toolCollection.findOne(options.measurementId);
|
||||||
|
|
||||||
const data = {
|
const data = {
|
||||||
measurement,
|
measurement,
|
||||||
position: options.position,
|
position: options.position,
|
||||||
threeColumns: true,
|
threeColumns: true,
|
||||||
hideCommon: true,
|
hideCommon: true,
|
||||||
|
autoClick: options.autoClick,
|
||||||
doneCallback(location, description) {
|
doneCallback(location, description) {
|
||||||
if (_.isFunction(options.callback)) {
|
if (_.isFunction(options.callback)) {
|
||||||
options.callback(options, location, description);
|
options.callback(options, location, description);
|
||||||
@ -44,6 +45,8 @@ OHIF.measurements.toggleLabelButton = options => {
|
|||||||
location,
|
location,
|
||||||
description
|
description
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
multi: true
|
||||||
});
|
});
|
||||||
|
|
||||||
removeButtonView();
|
removeButtonView();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user