From 1db7a58aeeee3dc4d05580e4a28f0e951afc7f4f Mon Sep 17 00:00:00 2001 From: Matei Adriel Date: Tue, 4 Jun 2019 13:07:01 +0000 Subject: [PATCH] =?UTF-8?q?=20=F0=9F=8E=90=20=20fixed=20the=20pin=20removi?= =?UTF-8?q?ng=20bug=20(hopefully)=20=F0=9F=8D=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ts/common/component/component.ts | 31 +++++++--------------------- 1 file changed, 8 insertions(+), 23 deletions(-) diff --git a/src/ts/common/component/component.ts b/src/ts/common/component/component.ts index 477de85..b807940 100644 --- a/src/ts/common/component/component.ts +++ b/src/ts/common/component/component.ts @@ -126,30 +126,15 @@ export class Component { } else if (e.button === 2) { - // setTimeout(() => { - console.log("removed") - manager.components = manager.components.filter(({ id }) => id !== this.id) - manager.update() + manager.components = manager.components.filter(({ id }) => id !== this.id) + manager.wireManager.wires + .filter(val => val.input.of.id == this.id || val.output.of.id == this.id) + .forEach(val => { + manager.wireManager.remove(val) + }) + manager.wireManager.update.next(true) - manager.wireManager.wires - .filter(val => val.input.of.id == this.id || val.output.of.id == this.id) - .forEach(val => { - manager.wireManager.remove(val) - }) - // manager.to - - console.log("removed 1") - - manager.wireManager.update.next(true) - - console.log("removed 2") - - manager.update() - - console.log("removed 3") - console.log(manager.components) - console.log(manager.wireManager) - // }, 0) + manager.update() } }