Hello,
You have a couple of options:
- If this is the first block you're putting on the workspace (or you otherwise don't mind scrolling the workspace after creating this block), you can call
centerOnBlock to center the workspace on the given block.
- You can use serialization to create the new block and include x/y coordinates in the data, instead of calling newBlock, initSvg, and render.
- You can call
moveTo or
moveBy to move the block after you create it.
To find the coordinates of the current viewport, you can use
workspace.getMetricsManager(), and from there get any number of metrics you may desire, like the viewMetrics.
Best,
Maribeth