wip on react transition 8
This commit is contained in:
1 parent
9ae5dd25ce
commit
71b49e6766
35 files changed
+818
-470
No files matched your search
@@ -0,0 +1,101 @@
|
||||
const defaultButtons = [
|
||||
{
|
||||
command: 'Pan',
|
||||
type: 'tool',
|
||||
text: 'Pan',
|
||||
svgUrl: '/icons.svg#icon-tools-pan',
|
||||
active: false
|
||||
},
|
||||
{
|
||||
command: 'Zoom',
|
||||
type: 'tool',
|
||||
text: 'Zoom',
|
||||
svgUrl: '/icons.svg#icon-tools-zoom',
|
||||
active: false
|
||||
},
|
||||
{
|
||||
command: 'Bidirectional',
|
||||
type: 'tool',
|
||||
text: 'Bidirectional',
|
||||
svgUrl: '/icons.svg#icon-tools-measure-target',
|
||||
active: true
|
||||
},
|
||||
{
|
||||
command: 'StackScroll',
|
||||
type: 'tool',
|
||||
text: 'Stack Scroll',
|
||||
svgUrl: '/icons.svg#icon-tools-stack-scroll',
|
||||
active: false
|
||||
},
|
||||
{
|
||||
command: 'reset',
|
||||
type: 'command',
|
||||
text: 'Reset',
|
||||
svgUrl: '/icons.svg#icon-tools-reset',
|
||||
active: false
|
||||
},
|
||||
{
|
||||
command: 'Wwwc',
|
||||
type: 'tool',
|
||||
text: 'Manual',
|
||||
svgUrl: '/icons.svg#icon-tools-levels',
|
||||
active: false
|
||||
},
|
||||
{
|
||||
command: 'setWLPresetSoftTissue',
|
||||
type: 'command',
|
||||
text: 'Soft Tissue',
|
||||
svgUrl: '/icons.svg#icon-wl-soft-tissue',
|
||||
active: false
|
||||
},
|
||||
{
|
||||
command: 'setWLPresetLung',
|
||||
type: 'command',
|
||||
text: 'Lung',
|
||||
svgUrl: '/icons.svg#icon-wl-lung',
|
||||
active: false
|
||||
},
|
||||
{
|
||||
command: 'setWLPresetLiver',
|
||||
type: 'command',
|
||||
text: 'Liver',
|
||||
svgUrl: '/icons.svg#icon-wl-liver',
|
||||
active: false
|
||||
},
|
||||
{
|
||||
command: 'setWLPresetBrain',
|
||||
type: 'command',
|
||||
text: 'Brain',
|
||||
svgUrl: '/icons.svg#icon-wl-brain',
|
||||
active: false
|
||||
}
|
||||
];
|
||||
|
||||
const tools = (state = { buttons: defaultButtons }, action) => {
|
||||
switch (action.type) {
|
||||
case 'SET_TOOL_ACTIVE':
|
||||
const item = state.buttons.find(button => button.command === action.tool);
|
||||
|
||||
let buttons = [];
|
||||
|
||||
if (item.type === 'tool') {
|
||||
buttons = state.buttons.map(button => {
|
||||
if (button.command === action.tool) {
|
||||
button.active = true;
|
||||
} else if (button.type === 'tool') {
|
||||
button.active = false;
|
||||
}
|
||||
|
||||
return button;
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
buttons
|
||||
};
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
};
|
||||
|
||||
export default tools;
|
||||
Reference in new issue
Block a user