mirror of
https://github.com/Doodle3D/Doodle3D-API
synced 2024-12-23 06:13:47 +01:00
added boxes changed event
This commit is contained in:
parent
65088708bd
commit
50167a686a
@ -58,14 +58,22 @@ export default class Doodle3DManager extends EventDispatcher {
|
|||||||
const newBoxes = boxes.filter(box => knownIPsClient.indexOf(box.localip) === -1);
|
const newBoxes = boxes.filter(box => knownIPsClient.indexOf(box.localip) === -1);
|
||||||
const removedBoxes = this.boxes.filter(box => knownIPsServer.indexOf(box.boxData.localip) === -1);
|
const removedBoxes = this.boxes.filter(box => knownIPsServer.indexOf(box.boxData.localip) === -1);
|
||||||
|
|
||||||
|
let changed = false;
|
||||||
for (const boxData of newBoxes) {
|
for (const boxData of newBoxes) {
|
||||||
const box = new Doodle3DAPI(boxData);
|
const box = new Doodle3DAPI(boxData);
|
||||||
|
|
||||||
this._addBox(box);
|
this._addBox(box);
|
||||||
|
|
||||||
|
changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const box of removedBoxes) {
|
for (const box of removedBoxes) {
|
||||||
this._removeBox(box);
|
this._removeBox(box);
|
||||||
|
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (changed) {
|
||||||
|
this.dispatchEvent({ type: 'boxeschanged', boxes: this.boxes });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user