LT-306: Fixing expanded timepoint on quick switch
This commit is contained in:
parent
60deb9c070
commit
c04c70b325
@ -1,3 +1,7 @@
|
||||
import { Template } from 'meteor/templating';
|
||||
import { ReactiveVar } from 'meteor/reactive-var';
|
||||
import { Session } from 'meteor/session';
|
||||
|
||||
Template.studySeriesQuickSwitch.onCreated(() => {
|
||||
const instance = Template.instance();
|
||||
|
||||
@ -12,24 +16,35 @@ Template.studySeriesQuickSwitch.onCreated(() => {
|
||||
|
||||
// Gets the current viewport data
|
||||
const viewportIndex = instance.data.viewportIndex;
|
||||
const viewportData = instance.getViewportData(viewportIndex);
|
||||
|
||||
let study;
|
||||
if (viewportData) {
|
||||
// Finds the current study and return it
|
||||
study = ViewerStudies.findOne({
|
||||
studyInstanceUid: viewportData.studyInstanceUid
|
||||
});
|
||||
} else {
|
||||
study = ViewerStudies.findOne();
|
||||
}
|
||||
instance.study = {};
|
||||
instance.lastStudy = {};
|
||||
|
||||
if (!study) {
|
||||
return;
|
||||
}
|
||||
instance.autorun(() => {
|
||||
Session.get('LayoutManagerUpdated');
|
||||
|
||||
// Change the current study to update the thumbnails
|
||||
instance.data.currentStudy.set(study);
|
||||
const viewportData = instance.getViewportData(viewportIndex);
|
||||
|
||||
if (viewportData) {
|
||||
// Finds the current study and return it
|
||||
instance.study = ViewerStudies.findOne({
|
||||
studyInstanceUid: viewportData.studyInstanceUid
|
||||
});
|
||||
} else {
|
||||
instance.study = ViewerStudies.findOne();
|
||||
}
|
||||
|
||||
if (!instance.study) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (instance.study.studyInstanceUid !== instance.lastStudy.studyInstanceUid) {
|
||||
// Change the current study to update the thumbnails
|
||||
instance.data.currentStudy.set(instance.study);
|
||||
|
||||
instance.lastStudy = instance.study;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Template.studySeriesQuickSwitch.events({
|
||||
@ -61,6 +76,6 @@ Template.studySeriesQuickSwitch.helpers({
|
||||
// - http://stackoverflow.com/questions/6165472/custom-css-scrollbar-for-firefox/6165489#6165489
|
||||
// - http://stackoverflow.com/questions/18317634/force-visible-scrollbar-in-firefox-on-mac-os-x/18318273
|
||||
addMacOSClass() {
|
||||
return window.navigator.appVersion.indexOf("Mac") !== -1 ? 'is-mac' : '';
|
||||
return window.navigator.appVersion.indexOf('Mac') !== -1 ? 'is-mac' : '';
|
||||
}
|
||||
});
|
||||
|
||||
@ -1,4 +1,7 @@
|
||||
import { Template } from 'meteor/templating';
|
||||
import { ReactiveVar } from 'meteor/reactive-var';
|
||||
import { Tracker } from 'meteor/tracker';
|
||||
import { _ } from 'meteor/underscore';
|
||||
|
||||
Template.studyTimepointBrowser.onCreated(() => {
|
||||
const instance = Template.instance();
|
||||
@ -26,12 +29,12 @@ Template.studyTimepointBrowser.onCreated(() => {
|
||||
studyInstanceUid: studyInstanceUid
|
||||
};
|
||||
|
||||
var loadedStudy = ViewerStudies.findOne(query);
|
||||
const loadedStudy = ViewerStudies.findOne(query);
|
||||
if (loadedStudy) {
|
||||
return loadedStudy;
|
||||
}
|
||||
|
||||
var notYetLoaded = StudyListStudies.findOne(query);
|
||||
const notYetLoaded = StudyListStudies.findOne(query);
|
||||
if (!notYetLoaded) {
|
||||
throw 'No study data available for Study: ' + studyInstanceUid;
|
||||
}
|
||||
@ -50,7 +53,7 @@ Template.studyTimepointBrowser.onRendered(() => {
|
||||
|
||||
// Removes all active classes to collapse the timepoints and studies
|
||||
instance.$('.timepointEntry, .studyTimepointStudy').removeClass('active');
|
||||
if (type === 'key') {
|
||||
if (type === 'key' && !instance.data.currentStudy) {
|
||||
// Show only first timepoint expanded for key timepoints
|
||||
instance.$('.timepointEntry:first').addClass('active');
|
||||
}
|
||||
@ -66,6 +69,12 @@ Template.studyTimepointBrowser.onRendered(() => {
|
||||
instance.showAdditionalTimepoints.set(false);
|
||||
lastStudy = currentStudy;
|
||||
}
|
||||
|
||||
// Wait for rerendering and set the timepoint as active
|
||||
Tracker.afterFlush(() => {
|
||||
// Show only first timepoint expanded for key timepoints
|
||||
instance.$('.timepointEntry:first').addClass('active');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
<div class="studyModalityBox">
|
||||
<div class="studyModalityText" style="{{modalityStyle}}">
|
||||
{{#if this.study.modalities}}
|
||||
{{ modalities }}
|
||||
{{modalities}}
|
||||
{{else}}
|
||||
UN
|
||||
{{/if}}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user