Loading...
Logo
Processing Forum
I am trying to write a program with the following functions: 
1.The pop-out window displays a zoomed-in view of the specified region while keeping the page-view in the background for reference.

2. Users can choose to have the main window zoom with a pop-out window showing the overall drawing if more space to navigate is desired.


how can I write the codes necessary to zoom in/ out using ctrl +/-? 

thanks

Replies(1)

Questions 1 & 2 seem to relate more to using separate windows.  Take a look at ControlP5 library for processing.  You're going to have to use a buffered image if you want to reference a zoomed in window.

As far as using +/- for control of the zoom level (as opposed to using something like, say PeasyCam), there are several methods to perform actions on key events.  I _think_ the keycode method is the most portable and reliable method but I could be mistaken.

Copy code
  1. void keyPressed() {
  2.   if (keyCode == KeyEvent.VK_MINUS) {
  3.    DoYourZoomOut();
  4.   }
  5.   if (keyCode == KeyEvent.VK_PLUS) {
  6.   DoYourZoomIn();
  7.   }
  8. }
See http://www.processing.org/reference/keyCode.html