File size: 630 Bytes
e95c1c4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
import type { NodeProps } from "reactflow";
import { Handle, Position } from "reactflow";
export type PositionLoggerNodeData = {
label?: string;
};
export function PositionLoggerNode({
xPos,
yPos,
data,
}: NodeProps<PositionLoggerNodeData>) {
const x = `${Math.round(xPos)}px`;
const y = `${Math.round(yPos)}px`;
return (
// We add this class to use the same styles as React Flow's default nodes.
<div className="react-flow__node-default">
{data.label && <div>{data.label}</div>}
<div>
{x} {y}
</div>
<Handle type="source" position={Position.Bottom} />
</div>
);
}
|