LT-324: Improve scrolling responsiveness

This commit is contained in:
Erik Ziegler 2016-11-12 21:06:21 +01:00
parent 82add14113
commit 9496410e55
7 changed files with 878 additions and 231 deletions

View File

@ -1,7 +1,6 @@
import { OHIF } from 'meteor/ohif:core'; import { OHIF } from 'meteor/ohif:core';
OHIF.viewer = OHIF.viewer || {}; OHIF.viewer = OHIF.viewer || {};
OHIF.viewer.loadIndicatorDelay = 500;
OHIF.viewer.defaultTool = 'wwwc'; OHIF.viewer.defaultTool = 'wwwc';
OHIF.viewer.refLinesEnabled = true; OHIF.viewer.refLinesEnabled = true;
OHIF.viewer.cine = { OHIF.viewer.cine = {

File diff suppressed because it is too large Load Diff

View File

@ -8,7 +8,7 @@
<div class='viewportInstructions'> <div class='viewportInstructions'>
Please drag a stack here to view images. Please drag a stack here to view images.
</div> </div>
{{>loadingIndicator}}
{{>viewportOverlay}} {{>viewportOverlay}}
{{>loadingIndicator}}
{{>viewportOrientationMarkers}} {{>viewportOrientationMarkers}}
</template> </template>

View File

@ -144,7 +144,7 @@ function loadDisplaySetIntoViewport(data, templateData) {
} }
// Caches element's jQuery object // Caches element's jQuery object
const jQueryEl = $(element); const $element = $(element);
// Update the enabled element with the image and viewport data // Update the enabled element with the image and viewport data
// This is not usually necessary, but we need them stored in case // This is not usually necessary, but we need them stored in case
@ -207,8 +207,8 @@ function loadDisplaySetIntoViewport(data, templateData) {
// Hide the viewport instructions (i.e. 'Drag a stack here') and show // Hide the viewport instructions (i.e. 'Drag a stack here') and show
// the viewport overlay data. // the viewport overlay data.
jQueryEl.siblings('.viewportInstructions').hide(); $element.siblings('.viewportInstructions').hide();
jQueryEl.siblings('.imageViewerViewportOverlay').show(); $element.siblings('.imageViewerViewportOverlay').show();
// Add stack state managers for the stack tool, CINE tool, and reference lines // Add stack state managers for the stack tool, CINE tool, and reference lines
cornerstoneTools.addStackStateManager(element, ['stack', 'playClip', 'referenceLines']); cornerstoneTools.addStackStateManager(element, ['stack', 'playClip', 'referenceLines']);
@ -276,8 +276,8 @@ function loadDisplaySetIntoViewport(data, templateData) {
}; };
// Attach the onImageRendered callback to the CornerstoneImageRendered event // Attach the onImageRendered callback to the CornerstoneImageRendered event
jQueryEl.off('CornerstoneImageRendered', onImageRendered); $element.off('CornerstoneImageRendered', onImageRendered);
jQueryEl.on('CornerstoneImageRendered', onImageRendered); $element.on('CornerstoneImageRendered', onImageRendered);
// Set a random value for the Session variable in order to trigger an overlay update // Set a random value for the Session variable in order to trigger an overlay update
Session.set('CornerstoneImageRendered' + viewportIndex, Random.id()); Session.set('CornerstoneImageRendered' + viewportIndex, Random.id());
@ -288,7 +288,7 @@ function loadDisplaySetIntoViewport(data, templateData) {
OHIF.log.info('imageViewerViewport onNewImage'); OHIF.log.info('imageViewerViewport onNewImage');
// Update the metaData for missing fields // Update the metaData for missing fields
updateMetaData(eventData.enabledElement.image); //updateMetaData(eventData.enabledElement.image);
// Update the templateData with the new imageId // Update the templateData with the new imageId
// This allows the template helpers to update reactively // This allows the template helpers to update reactively
@ -315,12 +315,22 @@ function loadDisplaySetIntoViewport(data, templateData) {
}; };
// Attach the onNewImage callback to the CornerstoneNewImage event // Attach the onNewImage callback to the CornerstoneNewImage event
jQueryEl.off('CornerstoneNewImage', onNewImage); $element.off('CornerstoneNewImage', onNewImage);
jQueryEl.on('CornerstoneNewImage', onNewImage); $element.on('CornerstoneNewImage', onNewImage);
// Set a random value for the Session variable in order to trigger an overlay update // Set a random value for the Session variable in order to trigger an overlay update
Session.set('CornerstoneNewImage' + viewportIndex, Random.id()); Session.set('CornerstoneNewImage' + viewportIndex, Random.id());
function onStackScroll(e, eventData) {
// Update the imageSlider value
Session.set('CornerstoneNewImage' + viewportIndex, Random.id());
}
$element.off('CornerstoneStackScroll', onStackScroll);
if (stack.imageIds.length > 1) {
$element.on('CornerstoneStackScroll', onStackScroll);
}
// Define a function to trigger an event whenever a new viewport is being used // Define a function to trigger an event whenever a new viewport is being used
// This is used to update the value of the "active viewport", when the user interacts // This is used to update the value of the "active viewport", when the user interacts
// with a new viewport element // with a new viewport element
@ -352,8 +362,8 @@ function loadDisplaySetIntoViewport(data, templateData) {
}; };
// Attach the sendActivationTrigger function to all of the Cornerstone interaction events // Attach the sendActivationTrigger function to all of the Cornerstone interaction events
jQueryEl.off(allCornerstoneEvents, sendActivationTrigger); $element.off(allCornerstoneEvents, sendActivationTrigger);
jQueryEl.on(allCornerstoneEvents, sendActivationTrigger); $element.on(allCornerstoneEvents, sendActivationTrigger);
ViewerData[contentId].loadedSeriesData = layoutManager.viewportData; ViewerData[contentId].loadedSeriesData = layoutManager.viewportData;

View File

@ -11,6 +11,7 @@ var loadHandlerTimeout;
startLoadingHandler = function(element) { startLoadingHandler = function(element) {
clearTimeout(loadHandlerTimeout); clearTimeout(loadHandlerTimeout);
loadHandlerTimeout = setTimeout(function() { loadHandlerTimeout = setTimeout(function() {
console.log('startLoading');
var elem = $(element); var elem = $(element);
elem.siblings('.imageViewerErrorLoadingIndicator').css('display', 'none'); elem.siblings('.imageViewerErrorLoadingIndicator').css('display', 'none');
elem.find('canvas').not('.magnifyTool').addClass("faded"); elem.find('canvas').not('.magnifyTool').addClass("faded");

View File

@ -6,7 +6,7 @@ Meteor.startup(function() {
OHIF.viewer = {}; OHIF.viewer = {};
} }
OHIF.viewer.loadIndicatorDelay = 3000; OHIF.viewer.loadIndicatorDelay = 200;
OHIF.viewer.defaultTool = 'wwwc'; OHIF.viewer.defaultTool = 'wwwc';
OHIF.viewer.refLinesEnabled = true; OHIF.viewer.refLinesEnabled = true;
OHIF.viewer.isPlaying = {}; OHIF.viewer.isPlaying = {};

View File

@ -1,14 +1,6 @@
import { OHIF } from 'meteor/ohif:core'; import { OHIF } from 'meteor/ohif:core';
OHIF.viewer = OHIF.viewer || {}; OHIF.viewer = OHIF.viewer || {};
OHIF.viewer.loadIndicatorDelay = 500;
OHIF.viewer.defaultTool = 'wwwc';
OHIF.viewer.refLinesEnabled = true;
OHIF.viewer.isPlaying = {};
OHIF.viewer.cine = {
framesPerSecond: 24,
loop: true
};
OHIF.viewer.functionList = { OHIF.viewer.functionList = {
toggleCineDialog: toggleCineDialog, toggleCineDialog: toggleCineDialog,