All files / Sources/Rendering/Core/AnnotatedCubeActor Presets.js

80% Statements 4/5
100% Branches 0/0
75% Functions 3/4
80% Lines 4/5

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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 831x           54x                                                                                                                       6x       6x                        
const STYLES = {
  default: {
    defaultStyle: {
      fontStyle: 'bold',
      fontFamily: 'Arial',
      fontColor: 'black',
      fontSizeScale: (res) => res / 2,
      faceColor: 'white',
      edgeThickness: 0.1,
      edgeColor: 'black',
      resolution: 400,
    },
    xMinusFaceProperty: {
      text: 'X-',
      faceColor: 'yellow',
    },
    xPlusFaceProperty: {
      text: 'X+',
      faceColor: 'yellow',
    },
    yMinusFaceProperty: {
      text: 'Y-',
      faceColor: 'red',
    },
    yPlusFaceProperty: {
      text: 'Y+',
      faceColor: 'red',
    },
    zMinusFaceProperty: {
      text: 'Z-',
      faceColor: '#008000',
    },
    zPlusFaceProperty: {
      text: 'Z+',
      faceColor: '#008000',
    },
  },
  lps: {
    xMinusFaceProperty: {
      text: 'R',
      faceRotation: -90,
    },
    xPlusFaceProperty: {
      text: 'L',
      faceRotation: 90,
    },
    yMinusFaceProperty: {
      text: 'A',
      faceRotation: 0,
    },
    yPlusFaceProperty: {
      text: 'P',
      faceRotation: 180,
    },
    zMinusFaceProperty: {
      text: 'I',
      faceRotation: 180,
    },
    zPlusFaceProperty: {
      text: 'S',
      faceRotation: 0,
    },
  },
};
 
function applyDefinitions(definitions, cubeActor) {
  cubeActor.set(definitions);
}
 
function applyPreset(name, cubeActor) {
  return applyDefinitions(STYLES[name], cubeActor);
}
 
function registerStylePreset(name, definitions) {
  STYLES[name] = definitions;
}
 
export default {
  applyDefinitions,
  applyPreset,
  registerStylePreset,
};