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) {
|
||||
OHIF.measurements.toggleLabelButton({
|
||||
instance,
|
||||
toolData,
|
||||
measurementId: toolData._id,
|
||||
toolType: toolData.toolType,
|
||||
element,
|
||||
measurementApi: instance.data.measurementApi,
|
||||
position: data.currentPoints.page
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import { Template } from 'meteor/templating';
|
||||
import { ReactiveVar } from 'meteor/reactive-var';
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
|
||||
Template.caseProgress.onCreated(() => {
|
||||
const instance = Template.instance();
|
||||
|
||||
@ -81,6 +81,10 @@ Template.measureFlow.onRendered(() => {
|
||||
instance.$('.measure-flow').bounded();
|
||||
|
||||
instance.$('.btn-add').focus();
|
||||
|
||||
if (instance.data.autoClick) {
|
||||
instance.$('.btn-add').hide().trigger('click');
|
||||
}
|
||||
});
|
||||
|
||||
Template.measureFlow.events({
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { Template } from 'meteor/templating';
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
|
||||
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
|
||||
var keys = {
|
||||
const keys = {
|
||||
D: 68,
|
||||
DELETE: 46
|
||||
};
|
||||
@ -26,10 +28,25 @@ Template.measurementTableRow.events({
|
||||
$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');
|
||||
|
||||
var measurementData = this;
|
||||
const measurementData = this;
|
||||
|
||||
// TODO = Fix this weird issue? Need to set toolData's ID properly..
|
||||
measurementData.id = this._id;
|
||||
@ -37,13 +54,13 @@ Template.measurementTableRow.events({
|
||||
changeLesionLocationCallback(measurementData, null, doneCallback);
|
||||
},
|
||||
|
||||
'keydown .location': function(e) {
|
||||
var keyCode = e.which;
|
||||
'keydown .location'(event) {
|
||||
const keyCode = event.which;
|
||||
|
||||
if (keyCode === keys.DELETE ||
|
||||
(keyCode === keys.D && e.ctrlKey === true)) {
|
||||
var currentMeasurement = this;
|
||||
var options = {
|
||||
(keyCode === keys.D && event.ctrlKey === true)) {
|
||||
const currentMeasurement = this;
|
||||
const options = {
|
||||
keyPressAllowed: false,
|
||||
title: 'Remove measurement?',
|
||||
text: 'Are you sure you would like to remove the entire measurement?'
|
||||
|
||||
@ -21,15 +21,16 @@ OHIF.measurements.toggleLabelButton = options => {
|
||||
removeButtonView();
|
||||
}
|
||||
|
||||
const tool = toolMap[options.toolData.toolType];
|
||||
const tool = options.measurementTypeId || toolMap[options.toolType];
|
||||
const toolCollection = options.measurementApi[tool];
|
||||
const measurement = toolCollection.findOne(options.toolData._id);
|
||||
const measurement = toolCollection.findOne(options.measurementId);
|
||||
|
||||
const data = {
|
||||
measurement,
|
||||
position: options.position,
|
||||
threeColumns: true,
|
||||
hideCommon: true,
|
||||
autoClick: options.autoClick,
|
||||
doneCallback(location, description) {
|
||||
if (_.isFunction(options.callback)) {
|
||||
options.callback(options, location, description);
|
||||
@ -44,6 +45,8 @@ OHIF.measurements.toggleLabelButton = options => {
|
||||
location,
|
||||
description
|
||||
}
|
||||
}, {
|
||||
multi: true
|
||||
});
|
||||
|
||||
removeButtonView();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user