improve drag

This commit is contained in:
2026-03-07 11:04:07 +01:00
parent 59224880d2
commit 6572052dba
6 changed files with 145 additions and 61 deletions

View File

@@ -6,8 +6,8 @@ import {
BaseNode,
BaseNodeContent,
BaseNodeFooter,
BaseNodeHeader,
BaseNodeHeaderTitle,
BaseNodeFooterText,
BaseNodeHeaderRow,
} from './BaseNode'
import { Sparkles } from 'lucide-react'
import { InputHandle, OutputHandle } from './NodeHandles'
@@ -266,12 +266,14 @@ export const RenderingNode = memo(function RenderingNode({ id, width, height }:
// Do not depend on nodes/edges refs to avoid flicker from unnecessary re-renders.
}, [id, theme, plantumlText, configSignature, edgesSignature, variablesSignature, functionsSignature])
const dimensions =
width != null && height != null && width > 0 && height > 0
? { width, height }
: undefined
return (
<BaseNode className="min-w-96 min-h-[320px]" style={width != null && height != null && width > 0 && height > 0 ? { width, height } : undefined} resizable nodeId={id} handles={<><InputHandle id="ain" /><OutputHandle id="out" /></>}>
<BaseNodeHeader className="border-b">
<Sparkles className="size-4" />
<BaseNodeHeaderTitle>{id}</BaseNodeHeaderTitle>
</BaseNodeHeader>
<BaseNode className="min-w-96 min-h-[320px]" dimensions={dimensions} resizable nodeId={id} handles={<><InputHandle id="ain" /><OutputHandle id="out" /></>}>
<BaseNodeHeaderRow icon={<Sparkles className="size-4" />} title={id} />
<BaseNodeContent>
<div className="min-h-0 flex-1 flex flex-col">
@@ -324,9 +326,9 @@ export const RenderingNode = memo(function RenderingNode({ id, width, height }:
</BaseNodeContent>
<BaseNodeFooter>
<div className="w-full text-xs text-muted-foreground">
<BaseNodeFooterText>
{svgContent ? 'PlantUML diagram' : error ? 'Error' : '—'}
</div>
</BaseNodeFooterText>
</BaseNodeFooter>
</BaseNode>
)