AWV-1: Preventing looping on display set navigation
This commit is contained in:
parent
17f8d87d32
commit
8145e08f66
@ -2,11 +2,8 @@ import { OHIF } from 'meteor/ohif:core';
|
||||
|
||||
OHIF.viewer = {};
|
||||
|
||||
// Move display sets forward or backward in the selected viewport
|
||||
OHIF.viewer.moveDisplaySet = isNext => {
|
||||
// Get the selected viewport index
|
||||
const viewportIndex = Session.get('activeViewport');
|
||||
|
||||
// Move display sets forward or backward in the given viewport index
|
||||
OHIF.viewer.moveSingleViewportDisplaySets = (viewportIndex, isNext) => {
|
||||
// Get the selected viewport data
|
||||
const viewportData = window.layoutManager.viewportData[viewportIndex];
|
||||
|
||||
@ -28,11 +25,21 @@ OHIF.viewer.moveDisplaySet = isNext => {
|
||||
if (isNext) {
|
||||
newIndex++;
|
||||
if (newIndex >= displaySets.length) {
|
||||
// Stop here if looping is now allowing
|
||||
if (!OHIF.uiSettings.displaySetNavigationLoopOverSeries) {
|
||||
return;
|
||||
}
|
||||
|
||||
newIndex = 0;
|
||||
}
|
||||
} else {
|
||||
newIndex--;
|
||||
if (newIndex < 0) {
|
||||
// Stop here if looping is now allowing
|
||||
if (!OHIF.uiSettings.displaySetNavigationLoopOverSeries) {
|
||||
return;
|
||||
}
|
||||
|
||||
newIndex = displaySets.length - 1;
|
||||
}
|
||||
}
|
||||
@ -43,3 +50,23 @@ OHIF.viewer.moveDisplaySet = isNext => {
|
||||
// Rerender the viewport using the new display set data
|
||||
window.layoutManager.rerenderViewportWithNewDisplaySet(viewportIndex, newDisplaySetData);
|
||||
};
|
||||
|
||||
// Move multiple display sets forward or backward in all viewports
|
||||
OHIF.viewer.moveMultipleViewportDisplaySets = isNext => {
|
||||
// TODO: implement
|
||||
};
|
||||
|
||||
// Move display sets forward or backward
|
||||
OHIF.viewer.moveDisplaySets = isNext => {
|
||||
//Check if navigation is on a single or multiple viewports
|
||||
if (OHIF.uiSettings.displaySetNavigationMultipleViewports) {
|
||||
// Move display sets on multiple viewports
|
||||
OHIF.viewer.moveMultipleViewportDisplaySets(isNext);
|
||||
} else {
|
||||
// Get the selected viewport index
|
||||
const viewportIndex = Session.get('activeViewport');
|
||||
|
||||
// Move display sets on a single viewport
|
||||
OHIF.viewer.moveSingleViewportDisplaySets(viewportIndex, isNext);
|
||||
}
|
||||
};
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
<i class="fa fa-toggle-down fa-fw"></i>
|
||||
{{/if}}
|
||||
</div>
|
||||
<div class="buttonLabel">
|
||||
<div class="buttonLabel" disabled="{{#if (disableButton isPrevious)}}disabled{{/if}}">
|
||||
{{#if isPrevious}}Previous{{else}}Next{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -3,10 +3,16 @@ import { Template } from 'meteor/templating';
|
||||
|
||||
Template.displaySetNavigation.events({
|
||||
'click .js-next'(event, instance) {
|
||||
OHIF.viewer.moveDisplaySet(true);
|
||||
OHIF.viewer.moveDisplaySets(true);
|
||||
},
|
||||
|
||||
'click .js-prev'(event, instance) {
|
||||
OHIF.viewer.moveDisplaySet(false);
|
||||
OHIF.viewer.moveDisplaySets(false);
|
||||
}
|
||||
});
|
||||
|
||||
Template.displaySetNavigation.helpers({
|
||||
disableButton(isPrevious) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
@ -121,6 +121,16 @@ export const UISettings = new SimpleSchema({
|
||||
type: Boolean,
|
||||
label: 'Left sidebar open by default?',
|
||||
defaultValue: false
|
||||
},
|
||||
displaySetNavigationLoopOverSeries: {
|
||||
type: Boolean,
|
||||
label: 'The UP/DOWN display set navigation buttons will start over when reach the last display set in viewport?',
|
||||
defaultValue: true
|
||||
},
|
||||
displaySetNavigationMultipleViewports: {
|
||||
type: Boolean,
|
||||
label: 'The UP/DOWN display set navigation buttons will iterate over all the viewports at once?',
|
||||
defaultValue: false
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@ -23,7 +23,9 @@
|
||||
"verifyEmail": false,
|
||||
"ui": {
|
||||
"studyListFunctionsEnabled": true,
|
||||
"leftSidebarOpen": true
|
||||
"leftSidebarOpen": true,
|
||||
"displaySetNavigationLoopOverSeries": false,
|
||||
"displaySetNavigationMultipleViewports": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user