Search code examples
konvajs

Konva doesn't seem to take width into account


When I set a width for my Konva stage, it doesn't seem to be taken into account:

https://codesandbox.io/s/vue-template-4g1b7?file=/src/App.vue

When you change the height, everything works fine, but the width seems stuck to the width of the page. Is there away to force the stage to fit the width we want?

Thanks in advance.


Solution

  • Thanks to Anton Lavrenov (https://github.com/konvajs/konva/issues/915), I had the explanation:

    That is because your container has display: block in styles (default for div). You may set it to display: inline-block.

    I updated the sandbox.