We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I'd like to know how to change the zoomer ZoomPan setting in GICentre library. I've tried the following:
zoomer.setZoomPanDirection(ZOOM_HORIZONTAL_PAN_BOTH);
but I get a syntax error as it interprets ZOOM_HORIZONTAL_PAN_BOTH as a variable whereas as it should be an Enum. I'm not so familiar with Enum's, but I found the documentation here:
gicentre.org/utils/reference/org/gicentre/utils/move/ZoomPan.ZoomPanDirection.html
I think I just need to know the correct syntax.
Here's an example program:
import org.gicentre.utils.move.*;
ZoomPan zoomer;
void setup(){
size(600,300);
zoomer = new ZoomPan(this);
}
void draw(){
background(255);
zoomer.transform();
zoomer.setZoomPanDirection(ZOOM_HORIZONTAL_PAN_BOTH);
stroke(50);
line(100,height/2,500,height/2);
ellipse(100,100, 50, 50);
}
Many thanks.
Answers
ZOOM_HORIZONTAL_PAN_BOTH is an
enum
constant which belongs to Enum class ZoomPan.ZoomPanDirection:http://giCentre.org/utils/reference/org/gicentre/utils/move/ZoomPan.ZoomPanDirection.html#ZOOM_HORIZONTAL_PAN_BOTH
Therefore just prefix that const name w/ its Enum class name: *-:)
zoomer.setZoomPanDirection(ZoomPan.ZoomPanDirection.ZOOM_HORIZONTAL_PAN_BOTH);
Perfect - thank you very much. It's obvious when you explain it.