Azevedo
Azevedo

Reputation: 2189

Set layer width on Konva js

On KnovaJS, how can I set the width and height of a layer?

http://konvajs.github.io/api/Konva.Layer.html

I tried:

var layer = new Konva.Layer({x: 100, y: 200, width: 500, height: 500});

Only x and y properties work.

Upvotes: 2

Views: 2076

Answers (1)

pgrodrigues
pgrodrigues

Reputation: 2078

According to Konvajs documentation, both width() and height() are getters/setters. However for layers in particular, the getter will return the stage width/height and if you want to set the width/height, you should use stage.width(500); and stage.height(500);, respectively.

Upvotes: 3

Related Questions