Open x3sp3d3s opened 9 years ago
This seems to work for me. Here's a code example that demonstrates the expected behaviour (try pressing the Show/Hide buttons to see):
import vialab.SMT.*;
Zone parentZone;
Zone childZone;
boolean parentVisible = true;
boolean childVisible = true;
void setup() {
size( displayWidth, displayHeight, SMT.RENDERER);
SMT.init( this, TouchSource.AUTOMATIC);
// a parent zone
parentZone = new Zone( "MyZone", 10, 10, 100, 100);
SMT.add( parentZone);
// a child zone
childZone = new Zone("ChildZone", 20, 20, 50, 50);
parentZone.add(childZone);
// buttons to toggle visibility
SMT.add(new ButtonZone("ToggleParent", 200,0,150,60, "Show/Hide Outer"));
SMT.add(new ButtonZone("ToggleChild", 200,70,150,60, "Show/Hide Inner"));
}
void draw() {
background( 30);
}
// white parent
void drawMyZone( Zone zone) {
fill( #ffffff);
rect( 0, 0, 100, 100);
}
// parent zone can rotate-scale-translate with 2 fingers
void touchMyZone(Zone zone) {
zone.rst();
}
// green-ish child
void drawChildZone( Zone zone) {
fill( #88dd88);
rect( 0, 0, zone.width, zone.height);
}
// child zone can only scale and translate inside
void touchChildZone(Zone zone) {
zone.rst(false, true, true);
}
// Toggle button behaviour (where set visible happens)
void pressToggleParent() {
parentVisible = !parentVisible;
parentZone.setVisible(parentVisible);
}
void pressToggleChild() {
childVisible = !childVisible;
childZone.setVisible(childVisible);
}
If something is still not working, perhaps you could share a code snippet.
Hi again,
public void setVisible(boolean enabled)
Enable or disable drawing for this zone and its children. This will not disable pick-drawing nor touching. See setPickable( boolean) for and setTouchable( boolean), respectively.
Does it works?? because I use this in my parent zone, and the children remain visible. Can anybody help me?? THX.