Simon,
Yes I’ve verified this example as well. my code will look like below.
HTML:
{<div class="draggable" draggable="true">node1</div>
<div class="draggable" draggable="true">node2</div>}
JS
myDiagram.nodeTemplateMap.add("node1",
GO(go.Node, "Spot", nodeStyle(), {
new go.Binding("location", "loc", go.Point.parse).makeTwoWay(go.Point.stringify),
GO(go.Panel, "Spot",
GO(go.Picture, {
source: 'icons.png',
sourceRect: new go.Rect(3, 115, 105, 104)
}),
GO(go.TextBlock, "node1", {
stroke: '#fff',
name: 'Name',
wrap: go.TextBlock.None
}
),
makePort("T", go.Spot.Top, true, true),
makePort("L", go.Spot.Left, true, true),
makePort("R", go.Spot.Right, true, true),
makePort("B", go.Spot.Bottom, true, true)
));
So once user has dropped node1 then the above node template will be applied to that node once it’s dropped on to the canvas. So, is there any way to apply this template on drag start.
Thanks !