All files / src/lib/events eventTextSetAnimationSpeed.js

100% Statements 11/11
50% Branches 2/4
100% Functions 1/1
100% Lines 11/11

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 571x   1x 1x 1x       1x                                                                 1x 1x 1x 1x 1x     1x                
const l10n = require("../helpers/l10n").default;
 
const id = "EVENT_TEXT_SET_ANIMATION_SPEED";
const groups = ["EVENT_GROUP_DIALOGUE"];
const subGroups = {
  "EVENT_GROUP_DIALOGUE": "EVENT_GROUP_PROPERTIES"
}
 
const fields = [
  {
    label: l10n("TEXT_SPEED_IN"),
    description: l10n("TEXT_SPEED_IN_DESC"),
    key: "speedIn",
    type: "cameraSpeed",
    defaultValue: 1,
    width: "50%",
  },
  {
    label: l10n("TEXT_SPEED_OUT"),
    description: l10n("TEXT_SPEED_OUT_DESC"),
    key: "speedOut",
    type: "cameraSpeed",
    defaultValue: 1,
    width: "50%",
  },
  {
    label: l10n("TEXT_SPEED"),
    description: l10n("TEXT_SPEED_DESC"),
    key: "speed",
    type: "cameraSpeed",
    defaultValue: 1,
  },
  {
    type: "checkbox",
    label: l10n("FIELD_ALLOW_FASTFORWARD"),
    description: l10n("FIELD_ALLOW_FASTFORWARD_DESC"),
    key: "allowFastForward",
    defaultValue: true,
  },
];
 
const compile = (input, helpers) => {
  const { textSetAnimSpeed } = helpers;
  let speedIn = input.speedIn > 0 ? input.speedIn - 1 : -3;
  let speedOut = input.speedOut > 0 ? input.speedOut - 1 : -3;
  textSetAnimSpeed(speedIn, speedOut, input.speed, input.allowFastForward);
};
 
module.exports = {
  id,
  description: l10n("EVENT_TEXT_SET_ANIMATION_SPEED_DESC"),
  groups,
  subGroups,
  fields,
  compile,
};