From 3757e215f55f8c54e756c52ca890821a9b617647 Mon Sep 17 00:00:00 2001 From: Adam Procter <adamprocter@researchnot.es> Date: Mon, 31 Aug 2020 14:17:32 +0100 Subject: [PATCH] working on connections view and tool mode --- app/src/components/ConnectionsLayer.vue | 28 ++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/app/src/components/ConnectionsLayer.vue b/app/src/components/ConnectionsLayer.vue index 0b94157..feaaa8b 100644 --- a/app/src/components/ConnectionsLayer.vue +++ b/app/src/components/ConnectionsLayer.vue @@ -8,9 +8,16 @@ import { mapState } from 'vuex' import * as PIXI from 'pixi.js' //var initialMoveTo +let buttons = new PIXI.Graphics() export default { name: 'ConnectionsLayer', + + data() { + return { + localtoolstate: this.toolmode, + } + }, computed: mapState({ configConnections: (state) => state.configConnections, configPositions: (state) => state.configPositions, @@ -26,18 +33,31 @@ export default { handler() { this.connectionsDraw() - this.buttonsDraw() }, }, }, methods: { + toolState() { + //console.log(this.toolmode) + if (this.localtoolstate == 'connect') { + console.log('tools') + //this.buttonsDraw() + } else { + // this.clearButtons() + } + // <div v-if="toolmode == 'move'"> + }, + clearButtons() { + const stage = this.PIXIApp.stage + stage.removeChild(buttons) + }, buttonsDraw() { + // stage.removeChild(buttons) var i var j this.canvas = this.$refs.pixi const stage = this.PIXIApp.stage - let buttons = new PIXI.Graphics() for (i = 0; i < Object.keys(this.myNodes).length; i++) { for (j = 0; j < Object.keys(this.configPositions).length; j++) { @@ -119,6 +139,7 @@ export default { lines[0].lineTo(mouseX, mouseY) } } + stage.addChild(buttons) }, connectionsDraw() { @@ -164,7 +185,8 @@ export default { view: canvas, }) this.connectionsDraw() - this.buttonsDraw() + this.toolState() + // FIXME: code OLD // this.connectingDraw() }, -- GitLab