From ce0d8f27a9c88662d501b3f9e1916dd2ae54da5e Mon Sep 17 00:00:00 2001 From: Ni55aN Date: Fri, 23 Aug 2024 14:51:26 +0300 Subject: [PATCH] fix: node sizing --- .../classic/components/control/control.component.sass | 3 ++- .../classic/components/node/node.component.sass | 2 +- src/presets/classic/components/node/node.component.ts | 11 ++++++++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/presets/classic/components/control/control.component.sass b/src/presets/classic/components/control/control.component.sass index 6a06567..c234f38 100644 --- a/src/presets/classic/components/control/control.component.sass +++ b/src/presets/classic/components/control/control.component.sass @@ -1,9 +1,10 @@ @import "../../vars" input - width: $node-width - 50px + width: 100% border-radius: 30px background-color: white padding: 2px 6px border: 1px solid #999 font-size: 110% + box-sizing: border-box diff --git a/src/presets/classic/components/node/node.component.sass b/src/presets/classic/components/node/node.component.sass index 99a7678..6c40c53 100644 --- a/src/presets/classic/components/node/node.component.sass +++ b/src/presets/classic/components/node/node.component.sass @@ -8,7 +8,7 @@ border-radius: 10px cursor: pointer box-sizing: border-box - min-width: $node-width + width: $node-width height: auto padding-bottom: 6px position: relative diff --git a/src/presets/classic/components/node/node.component.ts b/src/presets/classic/components/node/node.component.ts index dfb94b9..7671784 100644 --- a/src/presets/classic/components/node/node.component.ts +++ b/src/presets/classic/components/node/node.component.ts @@ -2,6 +2,7 @@ import { Component, Input, HostBinding, ChangeDetectorRef, OnChanges } from '@an import { ClassicPreset as Classic } from 'rete'; import { KeyValue } from '@angular/common'; +type NodeExtraData = { width?: number, height?: number } type SortValue = (N['controls'] | N['inputs'] | N['outputs'])[string] @Component({ @@ -12,12 +13,20 @@ type SortValue = (N['controls'] | N['inputs'] | N['outpu } }) export class NodeComponent implements OnChanges { - @Input() data!: Classic.Node; + @Input() data!: Classic.Node & NodeExtraData; @Input() emit!: (data: any) => void @Input() rendered!: () => void seed = 0 + @HostBinding('style.width.px') get width() { + return this.data.width + } + + @HostBinding('style.height.px') get height() { + return this.data.height + } + @HostBinding('class.selected') get selected() { return this.data.selected }