# placeNode

Canonical: https://docs.shumoku.dev/ja/library/api/placeNode
Language: ja

@shumoku/core · 0.4.0 · function

# placeNode

[ソース](https://github.com/konoe-akitoshi/shumoku/blob/main/libs/@shumoku/core/src/layout/interaction.ts#L137)

APIの説明は英語のcanonical sourceを表示しています。

\*\*Geometric\*\* placement for a single unpositioned node: find the point nearest \`initial\` that doesn't overlap any existing node or subgraph. The graph's link structure is deliberately ignored — this is the primitive for "drop the node exactly where the user clicked", "paste at cursor", "convert BOM item to diagram node at the canvas edge", i.e. user-driven placement where the surrounding topology should not influence the outcome. For \*\*structural\*\* placement (re-layout based on link flow, pin a set of nodes, arrange a selection), use \`layoutNetwork\` with its \`fixed\` / \`hints\` options instead. The two APIs stay separate because their intents differ: \`placeNode\` is O(existing obstacles) geometry, \`layoutNetwork\` is a full Sugiyama run.

```
placeNode(node: Node, graph: { nodes: Map<string, Node>; subgraphs?: Map<string, Subgraph> }, initial: { x: number; y: number }, gap?: number): { x: number; y: number }
```

## パラメーター

| 名前 | 型 | 説明 | 既定値 |
| --- | --- | --- | --- |
| `node` | `Node` | 追加説明はありません。 | `—` |
| `graph` | `{ nodes: Map<string, Node>; subgraphs?: Map<string, Subgraph> }` | 追加説明はありません。 | `—` |
| `initial` | `{ x: number; y: number }` | 追加説明はありません。 | `—` |
| `gap` | `number` | 追加説明はありません。 | `DEFAULT_NODE_GAP` |

## 戻り値

```
{ x: number; y: number }
```

[`libs/@shumoku/core/src/layout/interaction.ts:137`](https://github.com/konoe-akitoshi/shumoku/blob/main/libs/@shumoku/core/src/layout/interaction.ts#L137)
