We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi everyone. I resized a draw section using command "scale". It's work well. However, the local where I have press a button doesn't move. It stays in the "fullscreen" position. Could someone help me?
Answers
Please format your code. Edit your post (gear on top right side of any of your posts), select your code and hit ctrl+o. Leave an empty line above and below your block of code. Details here: https://forum.processing.org/two/discussion/15473/readme-how-to-format-code-and-text
Kf
Code formated
If you remove your scale() function call - line 27, everything works fine. If you execute your sketch scaled, you will see that your drawing buffer is scaled but your mouse pointer doesn't know about this change. This is because Processing doesn't scale your mouse pointer. You have to do it yourself.
So below is an example implementing some changes in your code. In a nutshell, you need to use
mX
andmY
instead ofmouseX
andmouseY
. An alternative is to use the Mouse2DTransformations library. You can install it through the Processing PDE and then check the provided examples. A final alternative is to check previous posts related to panning.https://forum.processing.org/two/discussion/1364/constraining-an-image-while-panning-and-zooming
https://forum.processing.org/two/discussion/20853/scale-translate-ab-comparission#latest
https://forum.processing.org/two/discussion/20813/zooming-and-panning-headache#latest
Kf
Thank you so much. Nice.