Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: node sizing #120

Merged
merged 1 commit into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading