[enhancement] Stage could take the width & height of it's parent
See original GitHub issueWhat
I see you have to pass a width & height value you to the Stage
component, I’m wondering if instead we should be using a hook like react-use-measure
where the canvas would be able to update and size itself correctly based on it’s parent. This could be a nicer developer experience as it’s something that I imagine, most people will implement themselves anyway.
How
I’m not sure how reactive Konva.Stage
is and whether or not you’d have to destroy it to give it new dimensions.
https://github.com/konvajs/react-konva/blob/672af98bf814a5fd261652cd5bd25ac864c7b6d9/src/ReactKonvaCore.js#L56
But you could use the hook to call the width
and height
methods to update?
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Exploring the Complexities of Width and Height in CSS
The width and height of an element gets super interesting with parent and child elements. Let's look at all the interesting quirks we...
Read more >how a child can get the width / height of it's parent dynamically
example : if a parent has a width: 200 , the child's width should be width: 40 . and I want a way...
Read more >How to Scale child like it was part of parent? - Unity Forum
My problem is that my parent width and height is based on very complicated UI aspect ratio fitters and custom scripts. So I...
Read more >mask-size - CSS: Cascading Style Sheets - MDN Web Docs
The mask-size CSS property specifies the sizes of the mask images. ... To specify a size using width and height, you can supply...
Read more >Steroids (for Parents) - Nemours KidsHealth
enlargement of the clitoris. What Else Can Happen? Besides the health risks, kids who use steroids without a prescription are breaking the law....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Well you already can do something like this just fine:
For that use case, I am usually using absolute position for stage, so its size doesn’t affect size of parent, so it doesn’t break flex flow.