PWV-15: Updating Viewer Data inside viewer.js

This commit is contained in:
Bruno Alves de Faria 2017-03-17 19:47:12 -03:00
parent 2ea2107e11
commit 374dab5ef4
4 changed files with 9 additions and 6 deletions

View File

@ -44,9 +44,6 @@ Template.app.onCreated(() => {
const routeName = currentRoute.route.getName();
const isViewer = routeName.indexOf('viewer') === 0;
// Define the OHIF.viewer.data global object
OHIF.viewer.data = OHIF.viewer.data || Session.get('ViewerData') || {};
// Add or remove the strech class from body
$(document.body)[isViewer ? 'addClass' : 'removeClass']('stretch');

View File

@ -35,6 +35,9 @@ Template.viewer.onCreated(() => {
const instance = Template.instance();
// Define the OHIF.viewer.data global object
OHIF.viewer.data = OHIF.viewer.data || Session.get('ViewerData') || {};
const { TimepointApi, MeasurementApi, ConformanceCriteria } = OHIF.measurements;
const currentTimepointId = OHIF.viewer.data.currentTimepointId;

View File

@ -8,9 +8,6 @@ Template.ohifViewer.onCreated(() => {
const instance = Template.instance();
instance.headerClasses = new ReactiveVar('');
// Define the OHIF.viewer.data global object
OHIF.viewer.data = instance.data.viewerData || {};
OHIF.header.dropdown.setItems([{
action: () => OHIF.ui.showDialog('serverInformationModal'),
text: 'Server Information',

View File

@ -80,6 +80,9 @@ Template.viewer.onCreated(() => {
const instance = Template.instance();
// Define the OHIF.viewer.data global object
OHIF.viewer.data = OHIF.viewer.data || Session.get('ViewerData') || {};
instance.data.state = new ReactiveDict();
instance.data.state.set('leftSidebar', Session.get('leftSidebar'));
instance.data.state.set('rightSidebar', Session.get('rightSidebar'));
@ -99,6 +102,9 @@ Template.viewer.onCreated(() => {
OHIF.viewer.data.activeViewport = 0;
}
// Store the viewer data in session for further user
Session.setPersistent('ViewerData', OHIF.viewer.data);
Session.set('activeViewport', OHIF.viewer.data.activeViewport || 0);
// @TypeSafeStudies