gi-nx / insertBlock
ts
function insertBlock(blockId: string, message?: string): Promise<[number, number]>;Prompts the user to click the map to place an instance of a block. Creates a Point feature with the block's id, which Giraffe renders as the block's geometry.
Parameters
| Parameter | Type | Description |
|---|---|---|
blockId | string | The id of the block definition to insert. |
message? | string | Optional prompt message shown to the user. |
Returns
Promise<[number, number]>
The coordinates where the block was placed, or null if cancelled.
Throws
If no block with the given id exists.
Example
ts
const coords = await insertBlock("94d84733617e4c2d91b87a4da6106e8a");
if (coords) console.log(`Block placed at ${coords}`);