Skip to content

Conversation

jswhisperer
Copy link
Contributor

an idea for resizing the container El similar to html2canvas rather than rendered image

it would be nice to have options to change the "el" or container el in the clone stages dimensions

these settings shouldn't worry about aspects etc, it should behave the same as if we override DOM style of the El (container) provided

this would behave more like html2canvas

an idea for resizing the container El similar to html2canvas rather than rendered image
an idea for resizing the container El similar to html2canvas rather than rendered image
@jswhisperer
Copy link
Contributor Author

jswhisperer commented Aug 11, 2025

Screenshot 2025-08-11 at 9 35 14 pm for example changing the `#basic-box` style which is the container should render the image like so: Screenshot 2025-08-11 at 9 35 43 pm

@tinchox5
Copy link
Member

Hi @jswhisperer! I think is a good feature to add. However it would interfere with current width and height options in this way: currently when user just set a width or height option, the size will have a proportional increase or decrease.

The other important thing is referred to the future plugin system. I prefer to maintain the snapDOM core as light as possible and allow modifications vie plugins. In fact, some parts of the current snapDOM will be optionals plugins. Your case is an ideal candidate for a plugin.

I will inform when the @next branch will be ready to experiment with plugins so you can create one

@jswhisperer
Copy link
Contributor Author

Totally understand the options API could also just be named like { containerWidth: "string cssUnit", containerHeight: "string cssUnit" } or as a plugin but essentially we are resizing the container and letting responsive things flow before the image creation.

Feel free to close, this was an attempt to illustrate how I thought it might work.

I would also use your logic with the current only apply containerWidth or containerHeight if set otherwise use the current clonedEl dimensions. But no need to worry about aspect ratio for this API idea.

🎉

@tinchox5
Copy link
Member

Thank you, I will leave your PR open. I really appreciate your contribution and we can adapt it later

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants