We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I'm working on a project with lots of Processing examples in Javascript mode. I'd like them to be embedded in a responsive-width site, but I get issues with the mouse input.
For example, if I have this sketch:
<canvas id="HelloWorld" data-processing-sources=HelloWorld.pde" width="600" height="400">
I can delete the width/height in the HTML tag and make the width of canvas 50%:
HTML:
<canvas id="HelloWorld" data-processing-sources=HelloWorld.pde">
CSS:
canvas {
width: 50%;
}
I get a 1/2-sized canvas but the mouse coordinates are not right: the lower-right corner is read as the center of the canvas.
Answers
<canvas>
I'm afraid.https://github.com/fjenett/javascript-mode-processing/issues/23
https://github.com/fjenett/javascript-mode-processing/issues/26
I was afraid that was the case, but was hoping for a hack :)
I wonder if there's a wish-list for this summer's P5.js workathon – this would be a great addition.
<canvas>
properties.JS mode and p5.js aren't the same thing? I thought JS mode was an integration of the origintal p5.js project.
Easy to change on the CSS side. Someone who has been working on the JS mode could probably make the change much more easily (knowing where to look without a ton of digging).