@routevn/creator-model 1.3.3 → 1.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/model.js +12 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@routevn/creator-model",
3
- "version": "1.3.3",
3
+ "version": "1.3.4",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/model.js CHANGED
@@ -40,6 +40,7 @@ const LINE_UPDATE_ACTIONS_PRESERVE_PATHS = ["dialogue.content"];
40
40
  const LINE_UPDATE_ACTIONS_PRESERVE_PATHS_SET = new Set(
41
41
  LINE_UPDATE_ACTIONS_PRESERVE_PATHS,
42
42
  );
43
+ const isPositiveFiniteNumber = (value) => isFiniteNumber(value) && value > 0;
43
44
  const createEmptyCollectionState = () => ({
44
45
  items: {},
45
46
  tree: [],
@@ -973,7 +974,7 @@ const validateSpritesheetAnimationMap = ({
973
974
  {
974
975
  const result = validateAllowedKeys({
975
976
  value: animation,
976
- allowedKeys: ["frames", "animationSpeed", "loop"],
977
+ allowedKeys: ["frames", "animationSpeed", "fps", "loop"],
977
978
  path: animationPath,
978
979
  errorFactory,
979
980
  });
@@ -1009,6 +1010,16 @@ const validateSpritesheetAnimationMap = ({
1009
1010
  );
1010
1011
  }
1011
1012
 
1013
+ if (
1014
+ animation.fps !== undefined &&
1015
+ !isPositiveFiniteNumber(animation.fps)
1016
+ ) {
1017
+ return invalidFromErrorFactory(
1018
+ errorFactory,
1019
+ `${animationPath}.fps must be a positive finite number when provided`,
1020
+ );
1021
+ }
1022
+
1012
1023
  if (animation.loop !== undefined && typeof animation.loop !== "boolean") {
1013
1024
  return invalidFromErrorFactory(
1014
1025
  errorFactory,