DragCreating node given name: "SHAPE", is not getting copy as expected

I have created a node with DragCreating Tool, code as follows:

diagram.nodeTemplateMap.add(

  "DragRectangle",

  $(

    go.Node,

    "Auto",

    {

      locationSpot: go.Spot.Center,

      reshapable: true,

    },

    {

      selectionAdorned: true,

      // selectionObjectName: "SHAPE",

      // custom selection adornment: a blue rectangle

      selectionAdornmentTemplate: $(

        go.Adornment,

        "Spot", //configuration panel

        $(

          go.Panel,

          "Auto",

          $(go.Shape, {

            stroke: "Transparent",

            strokeWidth: 2,

            fill: null,

          }),

          $(go.Placeholder, { margin: 25 })

        ),

        $(go.Shape, {

          alignmentFocus: go.Spot.Top,

          // alignment: new go.Spot(0.5, 1.2),

          alignment: go.Spot.Bottom,

          // margin: 15,

          geometryString:

            "M123 0H8C3.58172 0 0 3.58172 0 8C0 12.4183 3.58172 16 8 16H123C127.418 16 131 12.4183 131 8C131 3.58172 127.418 0 123 0Z",

          fill: "#00D1FF",

          stroke: "#00D1FF",

          strokeWidth: 40,

        })

        // _getStyleForAdornmentOfDiagramComponents(),

        // _getAdornmentForDiagramComponents()

      ),

    },

    new go.Binding("selectionAdorned", "selectionAdorned"),

    {

      resizable: true,

      resizeObjectName: "SHAPE",

      resizeAdornmentTemplate: _getResizeAdornmentTemplate(),

    },

    new go.Binding("resizable", "resizable"),

    {

      rotatable: true,

      rotateObjectName: "SHAPE",

      rotateAdornmentTemplate: _getRotateAdornmentTemplate(),

    },

    { minSize: new go.Size(60, 20), resizable: true },

    new go.Binding("desiredSize", "size", go.Size.parse).makeTwoWay(

      go.Size.stringify

    ),

    new go.Binding("position", "pos", go.Point.parse).makeTwoWay(

      go.Point.stringify

    ),

    $(go.Shape, "Rectangle", {

      fill: "Transparent",

      strokeWidth: 2,

      name: "SHAPE",

    }),

    $(

      go.Panel,

      "Grid",

      {

        name: "GRID",

        desiredSize: new go.Size(100, 100),

        gridCellSize: new go.Size(20, 20),

        visible: false,

      },

      new go.Binding("desiredSize", "size", go.Size.parse).makeTwoWay(

        go.Size.stringify

      ),

      new go.Binding("gridCellSize", "cell", go.Size.parse).makeTwoWay(

        go.Size.stringify

      ),

      new go.Binding("visible", "gridVisible").makeTwoWay(),

      $(go.Shape, "LineV", new go.Binding("stroke", "gridStroke")),

      $(go.Shape, "LineH", new go.Binding("stroke", "gridStroke"))

    )

  )

);

nodeData is as follows:

var tool = _DIAGRAM.toolManager.findTool(“DragCreating”);

tool.archetypeNodeData = {

  fill: "transparent",

  stroke: "black",

  strokeWidth: 20,

  figure: "Rectangle",

  opacity: 0.5,

  category: "DragRectangle",

  cell: "20 20",

  gridStroke: "green",

  gridVisible: false,

};

now if I try to copy and paste the node, it is getting deformed. I removed the name: “SHAPE” and copy paste is working as expected. Motive behind using property {name: “SHAPE”} is not wanting the adornment to rotate while resize and rotate.

The element with the resizeObjectName should have the Binding on desiredSize. There’s likely to be conflicts if an element is getting the size determined for a different element by the ResizingTool.

There’s no Binding for angle, but if there were, it should be on the element that is being rotated, i.e. on the rotateObjectName element.

Great! Thanks, working as expected.