LT-405: syncronized scrolling issue

This commit is contained in:
Leonardo Campos 2017-02-08 20:58:58 -02:00
parent ffc32fb214
commit 2752228c7f
6 changed files with 24 additions and 20 deletions

View File

@ -236,4 +236,6 @@ Template.viewer.onDestroyed(() => {
Session.set('ViewerMainReady', false); Session.set('ViewerMainReady', false);
Session.set('TimepointsReady', false); Session.set('TimepointsReady', false);
Session.set('MeasurementsReady', false); Session.set('MeasurementsReady', false);
OHIF.viewer.stackImagePositionOffsetSynchronizer.deactivate();
}); });

View File

@ -77,7 +77,6 @@ OHIF.measurements.jumpToRowItem = (rowItem, timepoints) => {
const activateMeasurements = OHIF.measurements.activateMeasurements; const activateMeasurements = OHIF.measurements.activateMeasurements;
const activatedViewportIndexes = []; const activatedViewportIndexes = [];
const syncViewportsByIndexesOnce = _.once(syncViewports);
let syncViewportsCaller = syncViewports; let syncViewportsCaller = syncViewports;
let renderCount = 0; let renderCount = 0;
@ -143,7 +142,8 @@ OHIF.measurements.jumpToRowItem = (rowItem, timepoints) => {
} }
} }
syncViewportsCaller = _.after(++renderCount, syncViewportsCaller); // The sync will be called only after loading all series on viewports
syncViewportsCaller = _.after(++renderCount, syncViewports);
// Otherwise, re-render the viewport with the required study/series, then // Otherwise, re-render the viewport with the required study/series, then
// add an onRendered callback to activate the measurements // add an onRendered callback to activate the measurements
@ -160,7 +160,8 @@ OHIF.measurements.jumpToRowItem = (rowItem, timepoints) => {
renderedCallback); renderedCallback);
} }
if(!renderCount) { // If all viewports are already rendered then sync them
if (!renderCount) {
syncViewportsCaller(activatedViewportIndexes); syncViewportsCaller(activatedViewportIndexes);
} }
}; };

View File

@ -8,8 +8,8 @@ import { thumbnailDragHandlers } from '../../../lib/thumbnailDragHandlers';
Template.thumbnailEntry.onCreated(() => { Template.thumbnailEntry.onCreated(() => {
const instance = Template.instance(); const instance = Template.instance();
// Check if the thumbnails will be draggable or clickable // Check if the thumbnails will be draggable or clickable
instance.isDragAndDrop = _.isUndefined(instance.data.viewportIndex); instance.isDragAndDrop = _.isUndefined(instance.data.viewportIndex);
}); });
Template.thumbnailEntry.events({ Template.thumbnailEntry.events({
@ -41,19 +41,20 @@ Template.thumbnailEntry.events({
// Event handlers for double click // Event handlers for double click
'dblclick .thumbnailEntry'(event, instance) { 'dblclick .thumbnailEntry'(event, instance) {
if (instance.isDragAndDrop) {
// Get the active viewport index and total number of viewports...
const viewportCount = OHIF.viewerbase.layoutManager.getNumberOfViewports();
let viewportIndex = Session.get('activeViewport') || 0;
if (viewportIndex >= viewportCount) {
viewportIndex = viewportCount > 0 ? viewportCount - 1 : 0;
}
// Get the active viewport index and total number of viewports... // Get the thumbnail stack data
const viewportCount = OHIF.viewerbase.layoutManager.getNumberOfViewports(); const data = instance.data.thumbnail.stack;
let viewportIndex = Session.get('activeViewport') || 0;
if (viewportIndex >= viewportCount) { // Rerender the viewport using the clicked thumbnail data
viewportIndex = viewportCount > 0 ? viewportCount - 1 : 0; OHIF.viewerbase.layoutManager.rerenderViewportWithNewDisplaySet(viewportIndex, data);
} }
// Get the thumbnail stack data
const data = instance.data.thumbnail.stack;
// Rerender the viewport using the clicked thumbnail data
OHIF.viewerbase.layoutManager.rerenderViewportWithNewDisplaySet(viewportIndex, data);
} }
}); });

View File

@ -39,7 +39,7 @@ export class StackImagePositionOffsetSynchronizer {
} }
this.active = false; this.active = false;
toolManager.deactivateCommandButton('link'); toolManager.deactivateCommandButton('linkStackScroll');
} }
update() { update() {
@ -73,7 +73,7 @@ export class StackImagePositionOffsetSynchronizer {
}); });
this.active = true; this.active = true;
toolManager.activateCommandButton('link'); toolManager.activateCommandButton('linkStackScroll');
Session.set('StackImagePositionOffsetSynchronizerLinkedViewports', viewportIndexes); Session.set('StackImagePositionOffsetSynchronizerLinkedViewports', viewportIndexes);
} }

View File

@ -447,7 +447,7 @@ export const toolManager = {
const activeCommandButtons = Session.get('ToolManagerActiveCommandButtons') || []; const activeCommandButtons = Session.get('ToolManagerActiveCommandButtons') || [];
if(activeCommandButtons.indexOf(button) === -1) { if(activeCommandButtons.indexOf(button) === -1) {
activeCommandButtons.push('link'); activeCommandButtons.push(button);
Session.set('ToolManagerActiveCommandButtons', activeCommandButtons); Session.set('ToolManagerActiveCommandButtons', activeCommandButtons);
} }
}, },

View File

@ -255,7 +255,7 @@ const stopAllClips = () => {
const isStackScrollLinkingDisabled = () => { const isStackScrollLinkingDisabled = () => {
// Its called everytime active viewport and/or layout change // Its called everytime active viewport and/or layout change
Session.get('activeViewport'); Session.get('viewportActivated');
Session.get('LayoutManagerUpdated'); Session.get('LayoutManagerUpdated');
const synchronizer = OHIF.viewer.stackImagePositionOffsetSynchronizer; const synchronizer = OHIF.viewer.stackImagePositionOffsetSynchronizer;