How to set shape size dynamically in Joint JS?

I am new to Joint JS and I am not able to dynamically set width and height properties of below element:

var rect = new joint.shapes.basic.Rect({

    position: { x: 100, y: 30 },
    size: { width: 100, height: 30 },
    attrs: { rect: { fill: 'blue' }, text: { text: 'my box', fill: 'white' } }
});

Is there any way to set those properties dynamically?

Upvotes: 4

Views: 2504

Answers (1)

Andrey Tretyak
Andrey Tretyak

Reputation: 3231

Try this function:

rect.resize(200, 60);

You read more about it here.

Upvotes: 3

Related Questions