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('TimepointsReady', 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 activatedViewportIndexes = [];
const syncViewportsByIndexesOnce = _.once(syncViewports);
let syncViewportsCaller = syncViewports;
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
// add an onRendered callback to activate the measurements
@ -160,7 +160,8 @@ OHIF.measurements.jumpToRowItem = (rowItem, timepoints) => {
renderedCallback);
}
if(!renderCount) {
// If all viewports are already rendered then sync them
if (!renderCount) {
syncViewportsCaller(activatedViewportIndexes);
}
};

View File

@ -8,8 +8,8 @@ import { thumbnailDragHandlers } from '../../../lib/thumbnailDragHandlers';
Template.thumbnailEntry.onCreated(() => {
const instance = Template.instance();
// Check if the thumbnails will be draggable or clickable
instance.isDragAndDrop = _.isUndefined(instance.data.viewportIndex);
// Check if the thumbnails will be draggable or clickable
instance.isDragAndDrop = _.isUndefined(instance.data.viewportIndex);
});
Template.thumbnailEntry.events({
@ -41,19 +41,20 @@ Template.thumbnailEntry.events({
// Event handlers for double click
'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...
const viewportCount = OHIF.viewerbase.layoutManager.getNumberOfViewports();
let viewportIndex = Session.get('activeViewport') || 0;
if (viewportIndex >= viewportCount) {
viewportIndex = viewportCount > 0 ? viewportCount - 1 : 0;
// 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);
}
// 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;
toolManager.deactivateCommandButton('link');
toolManager.deactivateCommandButton('linkStackScroll');
}
update() {
@ -73,7 +73,7 @@ export class StackImagePositionOffsetSynchronizer {
});
this.active = true;
toolManager.activateCommandButton('link');
toolManager.activateCommandButton('linkStackScroll');
Session.set('StackImagePositionOffsetSynchronizerLinkedViewports', viewportIndexes);
}

View File

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

View File

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