All files / packages/tools/src/tools/displayTools/Labelmap labelmapConfig.ts

66.66% Statements 2/3
0% Branches 0/11
50% Functions 1/2
66.66% Lines 2/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40    1x                           2x                                              
import { LabelmapConfig } from '../../../types/LabelmapTypes';
 
const defaultLabelmapConfig: LabelmapConfig = {
  renderOutline: true,
  outlineWidthActive: 3,
  outlineWidthInactive: 2,
  activeSegmentOutlineWidthDelta: 0,
  renderFill: true,
  renderFillInactive: true,
  fillAlpha: 0.7,
  fillAlphaInactive: 0.65,
  outlineOpacity: 1,
  outlineOpacityInactive: 0.85,
};
 
function getDefaultLabelmapConfig(): LabelmapConfig {
  return defaultLabelmapConfig;
}
 
// Checks if the labelmap config is valid, which means
// if all the required fields are present and have the correct type
function isValidLabelmapConfig(config): boolean {
  return (
    config &&
    typeof config.renderOutline === 'boolean' &&
    typeof config.outlineWidthActive === 'number' &&
    typeof config.outlineWidthInactive === 'number' &&
    typeof config.activeSegmentOutlineWidthDelta === 'number' &&
    typeof config.renderFill === 'boolean' &&
    typeof config.renderFillInactive === 'boolean' &&
    typeof config.fillAlpha === 'number' &&
    typeof config.fillAlphaInactive === 'number' &&
    typeof config.outlineOpacity === 'number' &&
    typeof config.outlineOpacityInactive === 'number'
  );
}
 
export default getDefaultLabelmapConfig;
export { isValidLabelmapConfig };