Add preview and disable buttons for nodes (#905)

* Add preview and disable button

* Fix tests

Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
0HyperCube 2022-12-25 10:28:18 +00:00 committed by Keavon Chambers
parent 41b07ad0cf
commit 8d7e6c530e
10 changed files with 196 additions and 49 deletions

View file

@ -36,7 +36,7 @@
v-for="node in nodes"
:key="String(node.id)"
class="node"
:class="{ selected: selected.includes(node.id) }"
:class="{ selected: selected.includes(node.id), output: node.output, disabled: node.disabled }"
:style="{
'--offset-left': (node.position?.x || 0) + (selected.includes(node.id) ? draggingNodes?.roundX || 0 : 0),
'--offset-top': (node.position?.y || 0) + (selected.includes(node.id) ? draggingNodes?.roundY || 0 : 0),
@ -127,6 +127,12 @@
margin: 0 4px;
flex: 0 0 auto;
align-items: center;
.widget-layout {
flex-direction: row;
flex-grow: 1;
justify-content: space-between;
}
}
.graph {
@ -193,6 +199,19 @@
margin: -1px;
}
&.disabled {
background: var(--color-3-darkgray);
color: var(--color-a-softgray);
.icon-label {
fill: var(--color-a-softgray);
}
}
&.output {
outline: 3px solid var(--color-data-vector);
}
.primary {
display: flex;
align-items: center;
@ -385,6 +404,7 @@ export default defineComponent({
nodes: {
immediate: true,
async handler() {
this.selected = this.selected.filter((id) => this.nodeGraph.state.nodes.find((node) => node.id === id));
await this.refreshLinks();
},
},

View file

@ -96,6 +96,10 @@ export class FrontendNode {
@TupleToVec2
readonly position!: XY | undefined;
readonly output!: boolean;
readonly disabled!: boolean;
}
export class FrontendNodeLink {