repo: janusweb action: commit revision: path_from: revision_from: 4934151d9ccebcb561a623d19f596c88ce3835c1: path_to: revision_to:
commit 4934151d9ccebcb561a623d19f596c88ce3835c1 Author: James BaicoianuDate: Tue Mar 10 23:33:15 2020 -0700 Remove objects from room.objects map when removed from scene regardless of lineage diff --git a/scripts/room.js b/scripts/room.js
--- a/scripts/room.js
+++ b/scripts/room.js
@@ -132,6 +132,7 @@ elation.require([
} else if (this.source) {
this.loadFromSource(this.source);
}
+ elation.events.add(this, 'thing_remove', elation.bind(this, this.onThingRemove));
}
this.createChildren = function() {
this.createLights();
@@ -1512,7 +1513,7 @@ elation.require([
}
}
this.onThingRemove = function(ev) {
- var thing = ev.target;
+ var thing = ev.data.thing;
if (!this.applyingEdits && thing.js_id && this.jsobjects[thing.js_id]) {
var proxy = this.jsobjects[thing.js_id];
if (proxy.sync) {
@@ -1521,6 +1522,10 @@ elation.require([
}
}
}
+ //this.removeObject(thing.getProxyObject());
+ if (this.jsobjects[thing.js_id]) {
+ delete this.jsobjects[thing.js_id];
+ }
}
this.onRoomEdit = function(ev) {
var thing = ev.data;
-----END OF PAGE-----