How to make scrollbars for canvas in processing

I am working on data visualization using processing. I can’t put all the desired content on the canvas, so instead of increasing the size of the canvas, I want to use the scroll bars to scroll around the screen (canvas). I need help with coding since I have not done coding for scrollbars before. All help would be greatly appreciated. Thank!

Amrita

+3
source share
2 answers

Make the web page work for you by placing your canvas in a fixed div size.

<div style="width: 400px; height: 400px; overflow: auto;">
  <canvas id="mycanvas" data-processing-sources="mysketch.pde file2.pde ...">
  </canvas>
</div>

Now the web page will automatically provide you with scrollbars for the canvas if you use size () larger than 400x400

+1
source

, , translate (x, y), x, translate(0, -x);. , . . , , . (http://processing.org/reference/translate_.html).

, , . -, . , , , , , .

0

All Articles