bg2e-js 2.2.1 → 2.2.2

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bg2e-js",
3
- "version": "2.2.1",
3
+ "version": "2.2.2",
4
4
  "description": "a graphics engine for productivity applications",
5
5
  "main": "./dist/bg2e-js.js",
6
6
  "types": "./src/index.ts",
@@ -102,10 +102,7 @@ export const vectorTypeLoader: TypeLoader = {
102
102
  return null;
103
103
  }
104
104
 
105
- if (Array.isArray(obj)) {
106
- return new Vec(obj);
107
- }
108
- else if (obj instanceof Vec) {
105
+ if (obj instanceof Vec) {
109
106
  return obj;
110
107
  }
111
108
  else {
@@ -120,6 +117,10 @@ export const vectorTypeLoader: TypeLoader = {
120
117
  else if (obj.length >= 2 && obj.length <= 4) {
121
118
  return new Vec(obj);
122
119
  }
120
+ // Retrocompatibility with v1.4
121
+ else if (obj._v && obj._v.length >= 2 && obj._v.length <= 4) {
122
+ return new Vec(obj._v);
123
+ }
123
124
  else {
124
125
  throw new Error(`Invalid parameter found in material deserialization. The required parameter type is array with 2, 3 or 4 elements`);
125
126
  }