Reworked Node Dragging Behavior

This commit is contained in:
Nicole Rappe 2025-05-01 01:46:18 -06:00
parent 38f564347b
commit 8a4b9ebb05
2 changed files with 25 additions and 1 deletions

View File

@ -94,6 +94,21 @@ label {
font-size: 9px;
}
/* Node Header - Shows drag handle cursor */
.borealis-node-header {
cursor: grab;
}
/* Optional: when actively dragging */
.borealis-node-header:active {
cursor: grabbing;
}
/* Node Body - Just pointer, not draggable */
.borealis-node-content {
cursor: default;
}
/* ======================================= */
/* FLOW TABS */
/* ======================================= */

View File

@ -65,7 +65,16 @@ export default function FlowEditor({
const position = project({ x: event.clientX - bounds.left, y: event.clientY - bounds.top });
const id = "node-" + Date.now();
const nodeMeta = Object.values(categorizedNodes).flat().find((n) => n.type === type);
const newNode = { id, type, position, data: { label: nodeMeta?.label || type, content: nodeMeta?.content } };
const newNode = {
id,
type,
position,
data: {
label: nodeMeta?.label || type,
content: nodeMeta?.content
},
dragHandle: '.borealis-node-header' // <-- Add this line
};
setNodes((nds) => [...nds, newNode]);
},
[project, setNodes, categorizedNodes]