We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello, processing community, I create a piece of code, I need the window to be as large as 1920*1080, but it cannot be fully displayed on the computer screen, so I want to know how to create a window scroll bar so that I can see I need , look forward to your reply, thank you :)
Answers
Just like the scroll bar when browsing the web, at the far right of the window, I can pull down to scroll through the window to see the following content. :-*
Did you google it in the forum?
Let’s say you use fullscreen(); then the window is as big as the screen, not bigger. But your scene that you draw is bigger than the screen (longer).
A rect on the right side of the screen
let’s start with a rect on the right side of the screen
You can drag it with the mouse up and down (mouseY)
Its x is fixed
You need to program this.
Using the scroll bar for the scene
Now use its y value and use translate (0, newYValue); to translate your entire graphic except the rectangle (use pushMatrix and popMatrix to isolate it as usual)
Calculate
newYValue
AsDo some thinking what value
-1000
must be. Definitely negative and pretty high.Could be the realHeight of your scene minus screenHeight (
height
) or soChrisir
https://forum.processing.org/two/discussion/comment/86915#Comment_86915
https://forum.processing.org/two/discussion/24488/having-issues-with-dragging-when-creating-a-map#latest
https://forum.processing.org/two/discussion/comment/85620/#Comment_85620
https://forum.processing.org/two/discussion/22527/simple-scrollable-textbox-is-there-such-a-thing#latest
Other keyword to use in the forum: Panning
Kf
here is the sketch I was suggesting above
If you do not want to create your own GUI you could also create a slider / scrollbar element using one of the Processing GUI libraries -- e.g. G4P or ControlP5.
Update a variable with the slider, then use that variable as an argument to translate() at the top of your draw. Now moving the bar translates the screen contents.