diff --git a/js/util/property.js b/js/util/property.js index 14dc2b04..f50d397f 100644 --- a/js/util/property.js +++ b/js/util/property.js @@ -76,7 +76,7 @@ export class Property { } else if (this.isArray) { return this.default ? this.default.slice() : []; } else if (this.isObject) { - return Object.keys(this.default).length ? JSON.parse(JSON.stringify(this.default)) : {}; + return Object.keys(this.default).length ? structuredClone(this.default) : {}; } else { return this.default; } @@ -99,7 +99,7 @@ export class Property { else if (this.isBoolean) { Merge.boolean(instance, data, this.name, this.merge_validation) } - else if (this.isArray || this.isVector || this.isVector2) { + else if (this.isArray || this.isVector) { if (data[this.name] instanceof Array) { if (instance[this.name] instanceof Array == false) { instance[this.name] = []; @@ -107,6 +107,11 @@ export class Property { instance[this.name].replace(data[this.name]); } } + else if (this.isObject) { + if (typeof data[this.name] == 'object') { + instance[this.name] = structuredClone(data[this.name]); + } + } else if (this.isInstance) { if (typeof data[this.name] === 'object') { instance[this.name] =data[this.name]; @@ -131,6 +136,10 @@ export class Property { } } } + } else if (this.isObject) { + if (typeof instance[this.name] == 'object') { + target[this.name] = structuredClone(instance[this.name]); + } } else { target[this.name] = instance[this.name]; }