Fixes for keydown event detection for dialogs. Updated cornerstoneTools to latest master
This commit is contained in:
parent
8afcb1a1a9
commit
44491c639d
@ -1,4 +1,4 @@
|
||||
/*! cornerstoneTools - v0.7.7 - 2015-12-18 | (c) 2014 Chris Hafey | https://github.com/chafey/cornerstoneTools */
|
||||
/*! cornerstoneTools - v0.7.7 - 2016-01-09 | (c) 2014 Chris Hafey | https://github.com/chafey/cornerstoneTools */
|
||||
// Begin Source: src/header.js
|
||||
if (typeof cornerstone === 'undefined') {
|
||||
cornerstone = {};
|
||||
@ -901,7 +901,7 @@ if (typeof cornerstoneTools === 'undefined') {
|
||||
}
|
||||
|
||||
var preventHandleOutsideImage;
|
||||
if (mouseToolInterface.options.preventHandleOutsideImage !== undefined) {
|
||||
if (mouseToolInterface.options && mouseToolInterface.options.preventHandleOutsideImage !== undefined) {
|
||||
preventHandleOutsideImage = mouseToolInterface.options.preventHandleOutsideImage;
|
||||
} else {
|
||||
preventHandleOutsideImage = false;
|
||||
@ -1608,7 +1608,7 @@ if (typeof cornerstoneTools === 'undefined') {
|
||||
if (toolData) {
|
||||
for (i = 0; i < toolData.data.length; i++) {
|
||||
data = toolData.data[i];
|
||||
var distanceSq = 75; // Should probably make this a settable property later
|
||||
var distanceSq = 25; // Should probably make this a settable property later
|
||||
var handle = cornerstoneTools.getHandleNearImagePoint(element, data.handles, coords, distanceSq);
|
||||
if (handle) {
|
||||
$(element).off('CornerstoneToolsTouchStartActive', touchToolInterface.touchDownActivateCallback || touchDownActivateCallback);
|
||||
@ -1674,7 +1674,7 @@ if (typeof cornerstoneTools === 'undefined') {
|
||||
|
||||
// now check to see if there is a handle we can move
|
||||
var distanceFromTouch = cornerstoneTools.touchSettings.getToolDistanceFromTouch();
|
||||
var distanceSq = Math.pow(Math.max(Math.abs(distanceFromTouch.x), Math.abs(distanceFromTouch.y)), 2);
|
||||
var distanceSq = Math.max(Math.abs(distanceFromTouch.x), Math.abs(distanceFromTouch.y));
|
||||
if (toolData) {
|
||||
for (i = 0; i < toolData.data.length; i++) {
|
||||
data = toolData.data[i];
|
||||
@ -5415,7 +5415,7 @@ if (typeof cornerstoneTools === 'undefined') {
|
||||
return {
|
||||
min: globalMin,
|
||||
max: globalMax,
|
||||
mean: globalMin
|
||||
mean: (globalMin + globalMax) / 2
|
||||
};
|
||||
}
|
||||
|
||||
@ -6739,7 +6739,6 @@ if (typeof cornerstoneTools === 'undefined') {
|
||||
handle.active = false;
|
||||
$(element).off('CornerstoneToolsTouchDrag', touchDragCallback);
|
||||
$(element).off('CornerstoneToolsTouchPinch', touchEndCallback);
|
||||
$(element).off('CornerstoneToolsTouchPress', touchEndCallback);
|
||||
$(element).off('CornerstoneToolsTouchEnd', touchEndCallback);
|
||||
$(element).off('CornerstoneToolsDragEnd', touchEndCallback);
|
||||
$(element).off('CornerstoneToolsTap', touchEndCallback);
|
||||
@ -6751,7 +6750,6 @@ if (typeof cornerstoneTools === 'undefined') {
|
||||
}
|
||||
|
||||
$(element).on('CornerstoneToolsTouchPinch', touchEndCallback);
|
||||
$(element).on('CornerstoneToolsTouchPress', touchEndCallback);
|
||||
$(element).on('CornerstoneToolsTouchEnd', touchEndCallback);
|
||||
$(element).on('CornerstoneToolsDragEnd', touchEndCallback);
|
||||
$(element).on('CornerstoneToolsTap', touchEndCallback);
|
||||
@ -10031,17 +10029,18 @@ Display scroll progress bar across bottom of image.
|
||||
x = Math.round(x);
|
||||
y = Math.round(y);
|
||||
var enabledElement = cornerstone.getEnabledElement(element);
|
||||
var image = enabledElement.image;
|
||||
var luminance = [];
|
||||
var index = 0;
|
||||
var pixelData = enabledElement.image.getPixelData();
|
||||
var pixelData = image.getPixelData();
|
||||
var spIndex,
|
||||
row,
|
||||
column;
|
||||
|
||||
if (enabledElement.image.color) {
|
||||
if (image.color) {
|
||||
for (row = 0; row < height; row++) {
|
||||
for (column = 0; column < width; column++) {
|
||||
spIndex = (((row + y) * enabledElement.image.columns) + (column + x)) * 4;
|
||||
spIndex = (((row + y) * image.columns) + (column + x)) * 4;
|
||||
var red = pixelData[spIndex];
|
||||
var green = pixelData[spIndex + 1];
|
||||
var blue = pixelData[spIndex + 2];
|
||||
@ -10051,8 +10050,8 @@ Display scroll progress bar across bottom of image.
|
||||
} else {
|
||||
for (row = 0; row < height; row++) {
|
||||
for (column = 0; column < width; column++) {
|
||||
spIndex = ((row + y) * enabledElement.image.columns) + (column + x);
|
||||
luminance[index++] = pixelData[spIndex];
|
||||
spIndex = ((row + y) * image.columns) + (column + x);
|
||||
luminance[index++] = pixelData[spIndex] * image.slope + image.intercept;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<template name="confirmDeleteDialog">
|
||||
<div id="confirmDeleteDialog">
|
||||
<div id="confirmDeleteDialog" tabindex="0">
|
||||
<h5>Remove Measurement?</h5>
|
||||
<p>Are you sure you would like to remove this measurement?</p>
|
||||
<button id="cancel" class="btn btn-link" tabindex="1">Cancel</button>
|
||||
|
||||
@ -7,6 +7,9 @@ function closeHandler() {
|
||||
|
||||
// Remove the callback from the template data
|
||||
delete Template.confirmDeleteDialog.doneCallback;
|
||||
|
||||
// Restore the focus to the active viewport
|
||||
setFocusToActiveViewport();
|
||||
}
|
||||
|
||||
showConfirmDialog = function(doneCallback, options) {
|
||||
@ -19,14 +22,17 @@ showConfirmDialog = function(doneCallback, options) {
|
||||
closeHandler();
|
||||
});
|
||||
|
||||
$("#confirmDeleteDialog").css('display', 'block');
|
||||
var confirmDeleteDialog = $("#confirmDeleteDialog");
|
||||
confirmDeleteDialog.css('display', 'block');
|
||||
confirmDeleteDialog.focus();
|
||||
|
||||
if (doneCallback && typeof doneCallback === 'function') {
|
||||
Template.confirmDeleteDialog.doneCallback = doneCallback;
|
||||
}
|
||||
};
|
||||
|
||||
var keys = {
|
||||
// Global object of key names (TODO: put this somewhere else)
|
||||
keys = {
|
||||
ESC: 27,
|
||||
ENTER: 13
|
||||
};
|
||||
@ -46,6 +52,7 @@ Template.confirmDeleteDialog.events({
|
||||
'keydown #confirmDeleteDialog': function(e) {
|
||||
if (e.which === keys.ESC) {
|
||||
closeHandler();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.keyPressAllowed === false) {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<template name="lesionLocationDialog">
|
||||
<div id="lesionLocationDialog">
|
||||
<div id="lesionLocationDialog" tabindex="0">
|
||||
<div class="dialogHeader">
|
||||
<h4>Select Lesion Location</h4>
|
||||
</div>
|
||||
@ -16,7 +16,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="lesionLocationRelabelDialog">
|
||||
<div id="lesionLocationRelabelDialog" tabindex="0">
|
||||
<div class="dialogHeader">
|
||||
<h4>Change Lesion Location</h4>
|
||||
</div>
|
||||
|
||||
@ -4,6 +4,9 @@ function closeHandler(dialog) {
|
||||
|
||||
// Remove the backdrop
|
||||
$(".removableBackdrop").remove();
|
||||
|
||||
// Restore the focus to the active viewport
|
||||
setFocusToActiveViewport();
|
||||
}
|
||||
|
||||
// This event sets lesion number for new lesion
|
||||
@ -96,6 +99,7 @@ function getLesionLocationCallback(measurementData, eventData) {
|
||||
}
|
||||
|
||||
dialog.css(dialogProperty);
|
||||
dialog.focus();
|
||||
}
|
||||
|
||||
changeLesionLocationCallback = function(measurementData, eventData, doneCallback) {
|
||||
@ -134,6 +138,7 @@ changeLesionLocationCallback = function(measurementData, eventData, doneCallback
|
||||
}
|
||||
|
||||
dialog.css(dialogProperty);
|
||||
dialog.focus();
|
||||
|
||||
var measurement = Measurements.findOne(measurementData.id);
|
||||
if (!measurement) {
|
||||
@ -249,9 +254,10 @@ Template.lesionLocationDialog.events({
|
||||
'keydown #lesionLocationDialog, keydown #lesionLocationRelabelDialog': function(e) {
|
||||
var dialog = Template.lesionLocationDialog.dialog;
|
||||
|
||||
// If Enter is pressed, close the dialog
|
||||
if (e.which === 13) {
|
||||
// If Esc or Enter are pressed, close the dialog
|
||||
if (e.which === keys.ESC || e.which === keys.ENTER) {
|
||||
closeHandler(dialog);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
{{ #if isTarget }}
|
||||
<td class="lesionTableTimepointCell targetCell" tabindex="1">{{displayData}}</td>
|
||||
{{ else }}
|
||||
<td class="lesionTableTimepointCell nonTargetCell" tabindex="2">{{displayData}}</td>
|
||||
<td class="lesionTableTimepointCell nonTargetCell" tabindex="1">{{displayData}}</td>
|
||||
{{ /if }}
|
||||
{{ else }}
|
||||
<td class="lesionTableTimepointCell empty"></td>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<template name="nonTargetLesionDialog">
|
||||
<div id="nonTargetLesionLocationDialog">
|
||||
<div id="nonTargetLesionLocationDialog" tabindex="0">
|
||||
<div class="dialogHeader">
|
||||
<h4>Select Lesion Location</h4>
|
||||
</div>
|
||||
@ -32,7 +32,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="nonTargetLesionRelabelDialog">
|
||||
<div id="nonTargetLesionRelabelDialog" tabindex="0">
|
||||
<div class="dialogHeader">
|
||||
<h4>Select Lesion Location</h4>
|
||||
</div>
|
||||
|
||||
@ -4,6 +4,9 @@ function closeHandler(dialog) {
|
||||
|
||||
// Remove the backdrop
|
||||
$(".removableBackdrop").remove();
|
||||
|
||||
// Restore the focus to the active viewport
|
||||
setFocusToActiveViewport();
|
||||
}
|
||||
|
||||
// This event sets lesion number for new lesion
|
||||
@ -168,6 +171,7 @@ changeNonTargetLocationCallback = function(measurementData, eventData, doneCallb
|
||||
}
|
||||
|
||||
dialog.css(dialogProperty);
|
||||
dialog.focus();
|
||||
|
||||
var measurement = Measurements.findOne(measurementData.id);
|
||||
if (!measurement) {
|
||||
@ -311,9 +315,10 @@ Template.nonTargetLesionDialog.events({
|
||||
'keydown #lesionLocationDialog, keydown #lesionLocationRelabelDialog': function(e) {
|
||||
var dialog = Template.nonTargetLesionDialog.dialog;
|
||||
|
||||
// If Enter is pressed, close the dialog
|
||||
if (e.which === 13) {
|
||||
// If Esc or Enter are pressed, close the dialog
|
||||
if (e.which === keys.ESC || e.which === keys.ENTER) {
|
||||
closeHandler(dialog);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<template name="nonTargetResponseDialog">
|
||||
<div id="nonTargetResponseDialog">
|
||||
<div id="nonTargetResponseDialog" tabindex="0">
|
||||
<div class="dialogHeader">
|
||||
<h5>Select Response</h5>
|
||||
</div>
|
||||
|
||||
@ -4,6 +4,9 @@ function closeHandler(dialog) {
|
||||
|
||||
// Remove the backdrop
|
||||
$(".removableBackdrop").remove();
|
||||
|
||||
// Restore the focus to the active viewport
|
||||
setFocusToActiveViewport();
|
||||
}
|
||||
|
||||
changeNonTargetResponse = function(measurementData, eventData, doneCallback) {
|
||||
@ -55,6 +58,7 @@ changeNonTargetResponse = function(measurementData, eventData, doneCallback) {
|
||||
}
|
||||
|
||||
dialog.css(dialogProperty);
|
||||
dialog.focus();
|
||||
|
||||
var measurement = Measurements.findOne(measurementData.id);
|
||||
if (!measurement) {
|
||||
@ -136,9 +140,10 @@ Template.nonTargetResponseDialog.events({
|
||||
'keydown #nonTargetResponseDialog': function(e) {
|
||||
var dialog = Template.nonTargetResponseDialog.dialog;
|
||||
|
||||
// If Enter is pressed, close the dialog
|
||||
if (e.which === 13) {
|
||||
// If Esc or Enter are pressed, close the dialog
|
||||
if (e.which === keys.ESC || e.which === keys.ENTER) {
|
||||
closeHandler(dialog);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -342,6 +342,10 @@ function loadSeriesIntoViewport(data, templateData) {
|
||||
*/
|
||||
function setSeries(data, seriesInstanceUid, templateData) {
|
||||
var study = data.study;
|
||||
if (!study || !study.seriesList) {
|
||||
return;
|
||||
}
|
||||
|
||||
study.seriesList.every(function(series) {
|
||||
if (series.seriesInstanceUid === seriesInstanceUid) {
|
||||
data.series = series;
|
||||
|
||||
@ -122,6 +122,7 @@ Package.onUse(function (api) {
|
||||
api.addFiles('lib/viewportFunctions.js', 'client');
|
||||
api.addFiles('lib/WLPresets.js', 'client');
|
||||
api.addFiles('lib/resizeViewportElements.js', 'client');
|
||||
api.addFiles('lib/setFocusToActiveViewport.js', 'client');
|
||||
api.addFiles('lib/encodeQueryData.js', 'server');
|
||||
|
||||
//api.export('accountsConfig', 'client');
|
||||
@ -139,6 +140,7 @@ Package.onUse(function (api) {
|
||||
api.export('rerenderViewportWithNewSeries', 'client');
|
||||
api.export('sortStudy', 'client');
|
||||
api.export('updateOrientationMarkers', 'client');
|
||||
api.export('setFocusToActiveViewport', 'client');
|
||||
api.export('encodeQueryData', 'server');
|
||||
|
||||
// Viewer management objects
|
||||
|
||||
Loading…
Reference in New Issue
Block a user