From 4dcff38a532898719f7088d3d8ed89a6036be7e9 Mon Sep 17 00:00:00 2001 From: Bruno Alves de Faria Date: Tue, 21 Nov 2017 13:22:54 -0200 Subject: [PATCH] Keeping bidirectional arm selected after moving handles --- .../both/configuration/tools/bidirectional.js | 20 +++++++++++++------ .../both/schema/measurements.js | 2 +- .../client/lib/MeasurementHandlers.js | 2 +- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/Packages/ohif-lesiontracker/both/configuration/tools/bidirectional.js b/Packages/ohif-lesiontracker/both/configuration/tools/bidirectional.js index ad6e58e82..119ee932a 100644 --- a/Packages/ohif-lesiontracker/both/configuration/tools/bidirectional.js +++ b/Packages/ohif-lesiontracker/both/configuration/tools/bidirectional.js @@ -1,24 +1,32 @@ import { SimpleSchema } from 'meteor/aldeed:simple-schema'; import { MeasurementSchemaTypes } from 'meteor/ohif:measurements/both/schema/measurements'; -// import { OHIF } from 'meteor/ohif:core'; -const CornerstoneHandleSchema = MeasurementSchemaTypes.CornerstoneHandleSchema; +const { CornerstoneHandleSchema } = MeasurementSchemaTypes; + +const BidirectionalHandleSchema = new SimpleSchema([CornerstoneHandleSchema, { + selected: { + type: Boolean, + label: 'Selected', + optional: true, + defaultValue: false + } +}]); const BidirectionalHandlesSchema = new SimpleSchema({ start: { - type: CornerstoneHandleSchema, + type: BidirectionalHandleSchema, label: 'Start' }, end: { - type: CornerstoneHandleSchema, + type: BidirectionalHandleSchema, label: 'End' }, perpendicularStart: { - type: CornerstoneHandleSchema, + type: BidirectionalHandleSchema, label: 'Perpendicular Start' }, perpendicularEnd: { - type: CornerstoneHandleSchema, + type: BidirectionalHandleSchema, label: 'Perpendicular End' }, textBox: { diff --git a/Packages/ohif-measurements/both/schema/measurements.js b/Packages/ohif-measurements/both/schema/measurements.js index 9eac50db0..bc0dcb111 100644 --- a/Packages/ohif-measurements/both/schema/measurements.js +++ b/Packages/ohif-measurements/both/schema/measurements.js @@ -149,7 +149,7 @@ const CornerstoneViewport = new SimpleSchema({ decimal: true, optional: true } -}) +}); const InstanceLevelMeasurement = new SimpleSchema([ StudyLevelMeasurement, diff --git a/Packages/ohif-measurements/client/lib/MeasurementHandlers.js b/Packages/ohif-measurements/client/lib/MeasurementHandlers.js index f10d2e44d..668776903 100644 --- a/Packages/ohif-measurements/client/lib/MeasurementHandlers.js +++ b/Packages/ohif-measurements/client/lib/MeasurementHandlers.js @@ -113,7 +113,7 @@ class MeasurementHandlers { } // Clean the measurement according to the Schema - Collection._c2._simpleSchema.clean(measurement); + Collection._c2._simpleSchema.clean(_.clone(measurement)); // Insert the new measurement into the collection Collection.update(measurementId, {