toolness / p5.js-widget

A reusable widget for embedding editable p5 sketches in web pages.
https://toolness.github.io/p5.js-widget/
GNU Lesser General Public License v2.1
161 stars 44 forks source link

Automatically size the preview pane based on canvas dimensions #11

Open toolness opened 8 years ago

toolness commented 8 years ago

It shouldn't be hard to hook in to calls to createCanvas and resize the preview pane based on its dimensions. Or just hook into resize DOM events and do the same.

The slightly harder part is figuring out what to do with the edge cases, e.g. if the sketch decides to call createCanvas(20000, 20000) but the page is only 800px wide.

kfrajer commented 6 years ago

Does the preview pane resize with based on size defined in setup? I check the documentation at https://toolness.github.io/p5.js-widget/

Question: Is it possible to specify the width of the preview to be 50% of the container?

Kf