Skip to content

Commit

Permalink
Merge pull request #120 from retejs/fix-node-sizing
Browse files Browse the repository at this point in the history
fix: node sizing
  • Loading branch information
Ni55aN authored Aug 23, 2024
2 parents 5ab9924 + ce0d8f2 commit a7dee4b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion src/presets/classic/components/node/node.component.sass
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 10 additions & 1 deletion src/presets/classic/components/node/node.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 extends Classic.Node> = (N['controls'] | N['inputs'] | N['outputs'])[string]

@Component({
Expand All @@ -12,12 +13,20 @@ type SortValue<N extends Classic.Node> = (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
}
Expand Down

0 comments on commit a7dee4b

Please sign in to comment.