Skip to content

Commit a7dee4b

Browse files
authored
Merge pull request #120 from retejs/fix-node-sizing
fix: node sizing
2 parents 5ab9924 + ce0d8f2 commit a7dee4b

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
@import "../../vars"
22

33
input
4-
width: $node-width - 50px
4+
width: 100%
55
border-radius: 30px
66
background-color: white
77
padding: 2px 6px
88
border: 1px solid #999
99
font-size: 110%
10+
box-sizing: border-box

src/presets/classic/components/node/node.component.sass

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
border-radius: 10px
99
cursor: pointer
1010
box-sizing: border-box
11-
min-width: $node-width
11+
width: $node-width
1212
height: auto
1313
padding-bottom: 6px
1414
position: relative

src/presets/classic/components/node/node.component.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { Component, Input, HostBinding, ChangeDetectorRef, OnChanges } from '@an
22
import { ClassicPreset as Classic } from 'rete';
33
import { KeyValue } from '@angular/common';
44

5+
type NodeExtraData = { width?: number, height?: number }
56
type SortValue<N extends Classic.Node> = (N['controls'] | N['inputs'] | N['outputs'])[string]
67

78
@Component({
@@ -12,12 +13,20 @@ type SortValue<N extends Classic.Node> = (N['controls'] | N['inputs'] | N['outpu
1213
}
1314
})
1415
export class NodeComponent implements OnChanges {
15-
@Input() data!: Classic.Node;
16+
@Input() data!: Classic.Node & NodeExtraData;
1617
@Input() emit!: (data: any) => void
1718
@Input() rendered!: () => void
1819

1920
seed = 0
2021

22+
@HostBinding('style.width.px') get width() {
23+
return this.data.width
24+
}
25+
26+
@HostBinding('style.height.px') get height() {
27+
return this.data.height
28+
}
29+
2130
@HostBinding('class.selected') get selected() {
2231
return this.data.selected
2332
}

0 commit comments

Comments
 (0)