fix(editor): Fix configurable node width in new canvas (no-changelog) (#10600)

This commit is contained in:
Alex Grozav 2024-09-05 10:44:07 +03:00 committed by GitHub
parent aa37c32f26
commit 3af3c6bd60
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 5 deletions

View file

@ -56,9 +56,9 @@ const classes = computed(() => {
const styles = computed(() => { const styles = computed(() => {
const stylesObject: Record<string, string | number> = {}; const stylesObject: Record<string, string | number> = {};
if (renderOptions.value.configurable && requiredNonMainInputs.value.length > 0) { if (renderOptions.value.configurable) {
let spacerCount = 0; let spacerCount = 0;
if (NODE_INSERT_SPACER_BETWEEN_INPUT_GROUPS) { if (NODE_INSERT_SPACER_BETWEEN_INPUT_GROUPS && requiredNonMainInputs.value.length > 0) {
const requiredNonMainInputsCount = requiredNonMainInputs.value.length; const requiredNonMainInputsCount = requiredNonMainInputs.value.length;
const optionalNonMainInputsCount = nonMainInputs.value.length - requiredNonMainInputsCount; const optionalNonMainInputsCount = nonMainInputs.value.length - requiredNonMainInputsCount;
spacerCount = requiredNonMainInputsCount > 0 && optionalNonMainInputsCount > 0 ? 1 : 0; spacerCount = requiredNonMainInputsCount > 0 && optionalNonMainInputsCount > 0 ? 1 : 0;
@ -167,7 +167,7 @@ function openContextMenu(event: MouseEvent) {
&.configurable { &.configurable {
--canvas-node--height: 100px; --canvas-node--height: 100px;
--canvas-node--width: calc( --canvas-node--width: calc(
max(var(--configurable-node--input-count, 5), var(--configurable-node--min-input-count)) * max(var(--configurable-node--input-count, 4), var(--configurable-node--min-input-count)) *
var(--configurable-node--input-width) var(--configurable-node--input-width)
); );

View file

@ -4,7 +4,7 @@ exports[`CanvasNodeDefault > configurable > should render configurable node corr
<div <div
class="node configurable" class="node configurable"
data-test-id="canvas-configurable-node" data-test-id="canvas-configurable-node"
style="--canvas-node--main-input-count: 0; --canvas-node--main-output-count: 0;" style="--configurable-node--input-count: 0; --canvas-node--main-input-count: 0; --canvas-node--main-output-count: 0;"
> >
@ -33,7 +33,7 @@ exports[`CanvasNodeDefault > configuration > should render configurable configur
<div <div
class="node configurable configuration" class="node configurable configuration"
data-test-id="canvas-configurable-node" data-test-id="canvas-configurable-node"
style="--canvas-node--main-input-count: 0; --canvas-node--main-output-count: 0;" style="--configurable-node--input-count: 0; --canvas-node--main-input-count: 0; --canvas-node--main-output-count: 0;"
> >