react-sketch icon indicating copy to clipboard operation
react-sketch copied to clipboard

How to set the sketch canvas Height to fill the parent component?

Open sjorsvanheuveln opened this issue 7 years ago • 3 comments

Hi there,

Thanks a lot for this fantastic package. I would like to let my sketch stretch the whole height of the parent component. The width has this functionality and it would be nice if it was possible also for the height. If this is already possible, then please let me know. I've filled in "100%" or "auto" for they height, but those are not working.

sjorsvanheuveln avatar Feb 06 '18 23:02 sjorsvanheuveln

Hi,

Firstly, thank you for your interest! Currently I do not support it to automatically mess with the height since it will mess with the aspect ration of the drawing, maybe a good idea/brainstorming will be helpful here.

In some of my apps what I usually do is to calculate the height of the screen etc. and set it upon page loading event or something.

tbolis avatar Feb 07 '18 08:02 tbolis

I think it will be handy to add. As I'm making something with bootstrap and I'll need different height lengths dependent on the device. Setting it on a fixed height is not ideal in my situation. What I did now is set the height of canvas.upper-canvas to "100%" in css, but this solution is not ideal. Also when the parent div changes height, the canvas is not responding accordingly and the drawing will overflow the container.

sjorsvanheuveln avatar Feb 07 '18 13:02 sjorsvanheuveln

Try controlling height yourself! see example page

tbolis avatar Nov 30 '18 07:11 tbolis