Comparing version 0.3.11 to 0.3.12
@@ -68,3 +68,3 @@ const TYPES_ENUM = { | ||
if (!ArrayBuffer.isView(store)) { | ||
const shadow = store[$parentArray].slice(0); | ||
const shadow = store[$parentArray].slice(0).fill(0); | ||
@@ -77,3 +77,3 @@ for (const k in store[key]) { | ||
} else { | ||
store[key] = store.slice(0); | ||
store[key] = store.slice(0).fill(0); | ||
} | ||
@@ -359,3 +359,3 @@ }; | ||
const isWorld = Object.getOwnPropertySymbols(target).includes($componentMap); | ||
let [componentProps, changedProps] = canonicalize(target); // TODO: calculate max bytes based on target | ||
let [componentProps, changedProps] = canonicalize(target); // TODO: calculate max bytes based on target & recalc upon resize | ||
@@ -406,7 +406,18 @@ const buffer = new ArrayBuffer(maxBytes); | ||
} // skip if diffing and no change | ||
// TODO: check array diff | ||
// TODO: optimize array diff | ||
if (diff && prop[eid] === prop[diff][eid]) { | ||
continue; | ||
if (diff) { | ||
if (ArrayBuffer.isView(prop[eid])) { | ||
let dirty = false; | ||
for (let i = 0; i < prop[eid].length; i++) { | ||
if (prop[eid][i] !== prop[eid][$serializeShadow][i]) { | ||
dirty = true; | ||
break; | ||
} | ||
} | ||
if (dirty) continue; | ||
} else if (prop[eid] === prop[diff][eid]) continue; | ||
} | ||
@@ -413,0 +424,0 @@ |
@@ -72,3 +72,3 @@ 'use strict'; | ||
if (!ArrayBuffer.isView(store)) { | ||
const shadow = store[$parentArray].slice(0); | ||
const shadow = store[$parentArray].slice(0).fill(0); | ||
@@ -81,3 +81,3 @@ for (const k in store[key]) { | ||
} else { | ||
store[key] = store.slice(0); | ||
store[key] = store.slice(0).fill(0); | ||
} | ||
@@ -363,3 +363,3 @@ }; | ||
const isWorld = Object.getOwnPropertySymbols(target).includes($componentMap); | ||
let [componentProps, changedProps] = canonicalize(target); // TODO: calculate max bytes based on target | ||
let [componentProps, changedProps] = canonicalize(target); // TODO: calculate max bytes based on target & recalc upon resize | ||
@@ -410,7 +410,18 @@ const buffer = new ArrayBuffer(maxBytes); | ||
} // skip if diffing and no change | ||
// TODO: check array diff | ||
// TODO: optimize array diff | ||
if (diff && prop[eid] === prop[diff][eid]) { | ||
continue; | ||
if (diff) { | ||
if (ArrayBuffer.isView(prop[eid])) { | ||
let dirty = false; | ||
for (let i = 0; i < prop[eid].length; i++) { | ||
if (prop[eid][i] !== prop[eid][$serializeShadow][i]) { | ||
dirty = true; | ||
break; | ||
} | ||
} | ||
if (dirty) continue; | ||
} else if (prop[eid] === prop[diff][eid]) continue; | ||
} | ||
@@ -417,0 +428,0 @@ |
{ | ||
"name": "bitecs", | ||
"version": "0.3.11", | ||
"version": "0.3.12", | ||
"description": "Functional, minimal, data-driven, ultra-high performance ECS library written in Javascript", | ||
@@ -5,0 +5,0 @@ "license": "MPL-2.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
278731
2344