Kill old icons logic
This commit is contained in:
parent
97899570ae
commit
ac44228b94
@ -29,7 +29,7 @@ class ToolbarModule extends Component {
|
||||
active={this.state.cineDialogOpen}
|
||||
onClick={this.onClickCineToolbarButton}
|
||||
text={'CINE'}
|
||||
iconClasses={'fab fa-youtube'}
|
||||
icon="tool-cineplay-toggle"
|
||||
/>
|
||||
<div className="CineDialogContainer" style={cineDialogContainerStyle}>
|
||||
<ConnectedCineDialog />
|
||||
|
||||
@ -3,7 +3,6 @@ import { ToolbarSection } from 'react-viewerbase';
|
||||
import OHIF from 'ohif-core';
|
||||
|
||||
const { setToolActive } = OHIF.redux.actions;
|
||||
const Icons = `${window.config.routerBasename}/icons.svg`.replace('//', '/');
|
||||
|
||||
const mapStateToProps = state => {
|
||||
const activeButton = state.tools.buttons.find(tool => tool.active === true);
|
||||
@ -14,7 +13,7 @@ const mapStateToProps = state => {
|
||||
command: 'Rotate',
|
||||
type: 'tool',
|
||||
text: 'Rotate',
|
||||
svgUrl: `${Icons}#3d-rotate`,
|
||||
icon: '3d-rotate',
|
||||
active: true
|
||||
}
|
||||
],
|
||||
|
||||
@ -1,115 +1,101 @@
|
||||
/**
|
||||
*
|
||||
* @param {String} [baseDirectory='/']
|
||||
*/
|
||||
export default function(baseDirectory = '/') {
|
||||
const iconsFileName = 'icons.svg'
|
||||
const sanitizedBaseDirectory =
|
||||
baseDirectory[baseDirectory.length - 1] === '/'
|
||||
? baseDirectory
|
||||
: `${baseDirectory}/`
|
||||
const relativePathToIcons = `${sanitizedBaseDirectory}${iconsFileName}`.replace(
|
||||
'//',
|
||||
'/'
|
||||
)
|
||||
|
||||
export default function() {
|
||||
return [
|
||||
{
|
||||
command: 'StackScroll',
|
||||
type: 'tool',
|
||||
text: 'Stack Scroll',
|
||||
svgUrl: `${relativePathToIcons}#icon-tools-stack-scroll`,
|
||||
icon: 'tool-stack-scroll',
|
||||
active: false,
|
||||
},
|
||||
{
|
||||
command: 'Zoom',
|
||||
type: 'tool',
|
||||
text: 'Zoom',
|
||||
svgUrl: `${relativePathToIcons}#icon-tools-zoom`,
|
||||
icon: 'tool-zoom',
|
||||
active: false,
|
||||
},
|
||||
{
|
||||
command: 'Wwwc',
|
||||
type: 'tool',
|
||||
text: 'Levels',
|
||||
svgUrl: `${relativePathToIcons}#icon-tools-levels`,
|
||||
icon: 'tool-levels',
|
||||
active: true,
|
||||
},
|
||||
{
|
||||
command: 'Pan',
|
||||
type: 'tool',
|
||||
text: 'Pan',
|
||||
svgUrl: `${relativePathToIcons}#icon-tools-pan`,
|
||||
icon: 'tool-pan',
|
||||
active: false,
|
||||
},
|
||||
{
|
||||
command: 'Length',
|
||||
type: 'tool',
|
||||
text: 'Length',
|
||||
svgUrl: `${relativePathToIcons}#icon-tools-measure-temp`,
|
||||
icon: 'tool-measure-temp',
|
||||
active: false,
|
||||
},
|
||||
/*{
|
||||
command: 'Annotate',
|
||||
type: 'tool',
|
||||
text: 'Annotate',
|
||||
svgUrl: `${Icons}#icon-tools-measure-non-target`,
|
||||
icon: `${Icons}#icon-tools-measure-non-target`,
|
||||
active: false
|
||||
},*/
|
||||
{
|
||||
command: 'Angle',
|
||||
type: 'tool',
|
||||
text: 'Angle',
|
||||
iconClasses: 'fa fa-angle-left',
|
||||
icon: 'angle-left',
|
||||
active: false,
|
||||
},
|
||||
{
|
||||
command: 'Bidirectional',
|
||||
type: 'tool',
|
||||
text: 'Bidirectional',
|
||||
svgUrl: `${relativePathToIcons}#icon-tools-measure-target`,
|
||||
icon: 'tool-measure-target',
|
||||
active: false,
|
||||
},
|
||||
{
|
||||
command: 'Brush',
|
||||
type: 'tool',
|
||||
text: 'Brush',
|
||||
iconClasses: 'fa fa-circle',
|
||||
icon: 'circle',
|
||||
active: false,
|
||||
},
|
||||
{
|
||||
command: 'FreehandMouse',
|
||||
type: 'tool',
|
||||
text: 'Freehand',
|
||||
iconClasses: 'fa fa-star',
|
||||
icon: 'star',
|
||||
active: false,
|
||||
},
|
||||
{
|
||||
command: 'EllipticalRoi',
|
||||
type: 'tool',
|
||||
text: 'EllipticalRoi',
|
||||
iconClasses: 'far fa-circle',
|
||||
icon: 'circle',
|
||||
active: false,
|
||||
},
|
||||
{
|
||||
command: 'CircleRoi',
|
||||
type: 'tool',
|
||||
text: 'CircleRoi',
|
||||
iconClasses: 'far fa-dot-circle',
|
||||
icon: 'dot-circle',
|
||||
active: false,
|
||||
},
|
||||
{
|
||||
command: 'RectangleRoi',
|
||||
type: 'tool',
|
||||
text: 'RectangleRoi',
|
||||
iconClasses: 'far fa-square',
|
||||
icon: 'square',
|
||||
active: false,
|
||||
},
|
||||
{
|
||||
command: 'reset',
|
||||
type: 'command',
|
||||
text: 'Reset',
|
||||
svgUrl: `${relativePathToIcons}#icon-tools-reset`,
|
||||
icon: 'tool-reset',
|
||||
active: false,
|
||||
},
|
||||
]
|
||||
|
||||
@ -2,25 +2,8 @@ import getDefaultToolbarButtons from './getDefaultToolbarButtons.js'
|
||||
|
||||
describe('getDefaultToolbarButtons.js', () => {
|
||||
it('returns a non-empty array', () => {
|
||||
const basePath = '/'
|
||||
|
||||
const buttons = getDefaultToolbarButtons(basePath)
|
||||
const buttons = getDefaultToolbarButtons()
|
||||
|
||||
expect(buttons.length).toBeGreaterThan(0)
|
||||
})
|
||||
|
||||
it('uses the provided basePath in buttons with an svgUrl property', () => {
|
||||
const basePath = '/demo/'
|
||||
|
||||
const buttons = getDefaultToolbarButtons(basePath)
|
||||
const hasOneOrMoreButtonsWithSvgUrlProperty = buttons.some(btn =>
|
||||
btn.hasOwnProperty('svgUrl')
|
||||
)
|
||||
const usesBasePathInButtonSvgUrls = buttons.every(
|
||||
btn => !btn.hasOwnProperty('svgUrl') || btn.svgUrl.includes(basePath)
|
||||
)
|
||||
|
||||
expect(hasOneOrMoreButtonsWithSvgUrlProperty).toBeTruthy()
|
||||
expect(usesBasePathInButtonSvgUrls).toBeTruthy()
|
||||
})
|
||||
})
|
||||
|
||||
Loading…
Reference in New Issue
Block a user