Quantcast
Channel: GoJS - Northwoods Software
Viewing all articles
Browse latest Browse all 7069

Default vs custom adornment

$
0
0

@jothibaskaran wrote:

Hi,

Previously I had a common selection adornment for all my nodes in my diagram. It was as given below:

let selad = new go.Adornment();
    selad.type = go.Panel.Auto;
    let seladhandle = new go.Shape();
    seladhandle.figure = 'RoundedRectangle';
    seladhandle.fill = null;
    seladhandle.stroke = '#00DFCC';
    seladhandle.strokeWidth = 3;
    selad.add(seladhandle);
    let selplace = new go.Placeholder();
    selad.add(selplace);
    diagram.nodeSelectionAdornmentTemplate = selad;
    diagram.groupSelectionAdornmentTemplate = selad;

On my nodes, I have a menu for Delete and Duplicate buttons. Duplicate functionality is achieved by copySelection() and pasteSelection().

Now, I changed the adornment to be specific to the different types of nodes in my application.

Now the adornment is a part of the node structure as follows:

$(go.Node, 'Table',

            { linkConnected: this.updatePort, linkDisconnected: this.updatePort,
                selectionObjectName: 'SHAPE',
                selectionAdornmentTemplate:
                $(go.Adornment, "Auto",
                    $(go.Shape,
                    {   fill: null, 
                        geometryString: 'F M30.36.5H196c9.113,0,17.621-2.612,16.5,16.5V78.042c0,.276,3.145,26.137-12.838,26.458H30.36C-6.553,93.241-8.643,41.97,6.227,17,13.681,4.482,30.36.5,30.36.5Z',                            
                        stroke: "#162789", 
                        strokeWidth: 4 },
                    ),
                    $(go.Placeholder)
                )  // end Adornment
            },

My duplicate functionality is currently not working as the node is not getting “selected” when i click on the button. Due to which copySelection is undefined.

Is this because of the difference in handling the selection adornment? How can this be resolved?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 7069

Trending Articles