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

Adornment resizing

$
0
0

@marin wrote:

Is it possible to resize an adornment depending on the size on the size of a node? I am asking because I have node with a go.Picture element that changes size when the picture changes.
This is the adornment code:

$(go.Adornment, 'Auto',
        {
            layerName: 'Background',
            selectable: false,
            isInDocumentBounds: false
        },
        new go.Binding('desiredSize', '', function (data, adornment) {

             console.log(adornment.canResize())
             let node = adornment.adornedObject;

             let currentBounds = node.data.category !== 'image' ? node.actualBounds :
                 node.findObject('PIC').actualBounds;

             return currentBounds.width > 100 && currentBounds.height > 100 ?
                 new go.Size(currentBounds.width + 10, currentBounds.height + 10) :
                 new go.Size(100, 100);
         }),
        new go.Binding('visible', '', function (data, adornment) {

            let node = adornment.adornedObject;

            return node.isVisible();
        }),
        getShape(node, color),
        $(go.Placeholder)

When I try to use the above code, I get the follwing warning:

Change not within a transaction: !d desiredSize: Adornment(Background)Node#3970(image) old: Size(100,100) new: Size(610,410)

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 7069

Trending Articles