/** Returns true if this actor and all ancestors are visible. */ public boolean ancestorsVisible () { Actor actor = this; do { if (!actor.isVisible()) return false; actor = actor.parent; } while (actor != null); return true; }
/** Returns true if this actor and all ancestors are visible. */ public boolean ancestorsVisible () { Actor actor = this; do { if (!actor.isVisible()) return false; actor = actor.parent; } while (actor != null); return true; }
/** Returns the deepest {@link #isVisible() visible} (and optionally, {@link #getTouchable() touchable}) actor that contains * the specified point, or null if no actor was hit. The point is specified in the actor's local coordinate system (0,0 is the * bottom left of the actor and width,height is the upper right). * <p> * This method is used to delegate touchDown, mouse, and enter/exit events. If this method returns null, those events will not * occur on this Actor. * <p> * The default implementation returns this actor if the point is within this actor's bounds and this actor is visible. * @param touchable If true, hit detection will respect the {@link #setTouchable(Touchable) touchability}. * @see Touchable */ public Actor hit (float x, float y, boolean touchable) { if (touchable && this.touchable != Touchable.enabled) return null; if (!isVisible()) return null; return x >= 0 && x < width && y >= 0 && y < height ? this : null; }
/** Returns the deepest {@link #isVisible() visible} (and optionally, {@link #getTouchable() touchable}) actor that contains * the specified point, or null if no actor was hit. The point is specified in the actor's local coordinate system (0,0 is the * bottom left of the actor and width,height is the upper right). * <p> * This method is used to delegate touchDown, mouse, and enter/exit events. If this method returns null, those events will not * occur on this Actor. * <p> * The default implementation returns this actor if the point is within this actor's bounds and this actor is visible. * @param touchable If true, hit detection will respect the {@link #setTouchable(Touchable) touchability}. * @see Touchable */ public Actor hit (float x, float y, boolean touchable) { if (touchable && this.touchable != Touchable.enabled) return null; if (!isVisible()) return null; return x >= 0 && x < width && y >= 0 && y < height ? this : null; }
for (int i = 0, n = children.size; i < n; i++) { Actor child = actors[i]; if (!child.isVisible()) continue; float cx = child.x, cy = child.y; if (cx <= cullRight && cy <= cullTop && cx + child.width >= cullLeft && cy + child.height >= cullBottom) for (int i = 0, n = children.size; i < n; i++) { Actor child = actors[i]; if (!child.isVisible()) continue; float cx = child.x, cy = child.y; if (cx <= cullRight && cy <= cullTop && cx + child.width >= cullLeft && cy + child.height >= cullBottom) { for (int i = 0, n = children.size; i < n; i++) { Actor child = actors[i]; if (!child.isVisible()) continue; child.draw(batch, parentAlpha); for (int i = 0, n = children.size; i < n; i++) { Actor child = actors[i]; if (!child.isVisible()) continue; float cx = child.x, cy = child.y; child.x = cx + offsetX;
for (int i = 0, n = children.size; i < n; i++) { Actor child = actors[i]; if (!child.isVisible()) continue; float cx = child.x, cy = child.y; if (cx <= cullRight && cy <= cullTop && cx + child.width >= cullLeft && cy + child.height >= cullBottom) for (int i = 0, n = children.size; i < n; i++) { Actor child = actors[i]; if (!child.isVisible()) continue; float cx = child.x, cy = child.y; if (cx <= cullRight && cy <= cullTop && cx + child.width >= cullLeft && cy + child.height >= cullBottom) { for (int i = 0, n = children.size; i < n; i++) { Actor child = actors[i]; if (!child.isVisible()) continue; child.draw(batch, parentAlpha); for (int i = 0, n = children.size; i < n; i++) { Actor child = actors[i]; if (!child.isVisible()) continue; float cx = child.x, cy = child.y; child.x = cx + offsetX;
for (int i = 0, n = children.size; i < n; i++) { Actor child = actors[i]; if (!child.isVisible()) continue; if (!child.getDebug() && !(child instanceof Group)) continue; child.drawDebug(shapes); for (int i = 0, n = children.size; i < n; i++) { Actor child = actors[i]; if (!child.isVisible()) continue; if (!child.getDebug() && !(child instanceof Group)) continue; float cx = child.x, cy = child.y;
for (int i = 0, n = children.size; i < n; i++) { Actor child = actors[i]; if (!child.isVisible()) continue; if (!child.getDebug() && !(child instanceof Group)) continue; child.drawDebug(shapes); for (int i = 0, n = children.size; i < n; i++) { Actor child = actors[i]; if (!child.isVisible()) continue; if (!child.getDebug() && !(child instanceof Group)) continue; float cx = child.x, cy = child.y;
@Override public void draw (Batch batch, float parentAlpha) { validate(); Color color = getColor(); float alpha = color.a * parentAlpha; applyTransform(batch, computeTransform()); if (firstWidget != null && firstWidget.isVisible()) { batch.flush(); getStage().calculateScissors(firstWidgetBounds, tempScissors); if (ScissorStack.pushScissors(tempScissors)) { firstWidget.draw(batch, alpha); batch.flush(); ScissorStack.popScissors(); } } if (secondWidget != null && secondWidget.isVisible()) { batch.flush(); getStage().calculateScissors(secondWidgetBounds, tempScissors); if (ScissorStack.pushScissors(tempScissors)) { secondWidget.draw(batch, alpha); batch.flush(); ScissorStack.popScissors(); } } batch.setColor(color.r, color.g, color.b, alpha); style.handle.draw(batch, handleBounds.x, handleBounds.y, handleBounds.width, handleBounds.height); resetTransform(batch); }
@Override public void draw (Batch batch, float parentAlpha) { validate(); Color color = getColor(); float alpha = color.a * parentAlpha; applyTransform(batch, computeTransform()); if (firstWidget != null && firstWidget.isVisible()) { batch.flush(); getStage().calculateScissors(firstWidgetBounds, tempScissors); if (ScissorStack.pushScissors(tempScissors)) { firstWidget.draw(batch, alpha); batch.flush(); ScissorStack.popScissors(); } } if (secondWidget != null && secondWidget.isVisible()) { batch.flush(); getStage().calculateScissors(secondWidgetBounds, tempScissors); if (ScissorStack.pushScissors(tempScissors)) { secondWidget.draw(batch, alpha); batch.flush(); ScissorStack.popScissors(); } } batch.setColor(color.r, color.g, color.b, alpha); style.handle.draw(batch, handleBounds.x, handleBounds.y, handleBounds.width, handleBounds.height); resetTransform(batch); }
@Override public float get (Actor context) { if (actor != null) context = actor; return context.isVisible() ? constant : 0; } }
/** Returns true if this actor and all ancestors are visible. */ public boolean ancestorsVisible () { Actor actor = this; do { if (!actor.isVisible()) return false; actor = actor.parent; } while (actor != null); return true; }
/** Returns the deepest {@link #isVisible() visible} (and optionally, {@link #getTouchable() touchable}) actor that contains * the specified point, or null if no actor was hit. The point is specified in the actor's local coordinate system (0,0 is the * bottom left of the actor and width,height is the upper right). * <p> * This method is used to delegate touchDown, mouse, and enter/exit events. If this method returns null, those events will not * occur on this Actor. * <p> * The default implementation returns this actor if the point is within this actor's bounds and this actor is visible. * @param touchable If true, hit detection will respect the {@link #setTouchable(Touchable) touchability}. * @see Touchable */ public Actor hit (float x, float y, boolean touchable) { if (touchable && this.touchable != Touchable.enabled) return null; if (!isVisible()) return null; return x >= 0 && x < width && y >= 0 && y < height ? this : null; }
public boolean visible(){ return t.isVisible(); }
/** * Checks if actor is visible in stage acknowledging parent visibility. * If any parent returns false from isVisible then this method return false. * True is returned when this actor and all its parent are visible. */ private boolean isActorVisibleInStage (Actor actor) { if (actor == null) return true; if (actor.isVisible() == false) return false; return isActorVisibleInStage(actor.getParent()); }
@Override public void clicked(InputEvent event, float x, float y) { Actor popup = findActor("popup"); if (popup.isVisible()) { button.setText("Show Popup"); popup.setVisible(false); } else { button.setText("Hide Popup"); popup.setVisible(true); popup.addAction(Actions.sequence(Actions.alpha(0), Actions.alpha(1, 0.5f))); } } });
@Override public void draw() { batch.begin(); for (Actor actor : getActors()) { if (actor.isVisible()) { actor.draw(batch, 1); } } batch.end(); if (DebugViewSettings.drawUIDebug) { shapeRenderer.begin(); rootTable.drawDebug(shapeRenderer); shapeRenderer.end(); } cameraController.update(); }
@Override public Actor hit(float x, float y, boolean touchable) { if (touchable && getTouchable() == Touchable.disabled) return null; Vector2 point = tmpVec2; Actor[] childrenArray = getChildren().items; for (int i = getChildren().size - 1; i >= 0; i--) { Actor child = childrenArray[i]; if (!child.isVisible()) continue; child.parentToLocalCoordinates(point.set(x, y)); Actor hit = child.hit(point.x, point.y, touchable); if (hit != null) return hit; } // Extend regular touch area by EXTRA_TOUCH_SPACE (to allow line snap beyond PatchGrid borders) if (touchable && this.getTouchable() != Touchable.enabled) return null; return x >= -EXTRA_TOUCH_SPACE && x < getWidth() + EXTRA_TOUCH_SPACE *2f && y >= -EXTRA_TOUCH_SPACE && y < getHeight() + EXTRA_TOUCH_SPACE *2f ? this : null; }
@Override public Actor hit (float x, float y, boolean touchable) { if (touchable && getTouchable() == Touchable.disabled) return null; Vector2 point = tmpVec2; SnapshotArray<Actor> children = getChildren(); Actor[] childrenArray = children.items; for (int i = children.size - 1; i >= 0; i--) { Actor child = childrenArray[i]; if (!child.isVisible()) continue; child.parentToLocalCoordinates(point.set(x, y)); Actor hit = child.hit(point.x, point.y, touchable); if (hit != null) return hit; } if (touchable && getTouchable() != Touchable.enabled) return null; return x >= 0 && x < getWidth() / getScaleX() && y >= 0 && y < getHeight() / getScaleY() ? this : null; }
@Override public void draw (Batch batch, float parentAlpha) { validate(); Color color = getColor(); float alpha = color.a * parentAlpha; applyTransform(batch, computeTransform()); if (firstWidget != null && firstWidget.isVisible()) { batch.flush(); getStage().calculateScissors(firstWidgetBounds, tempScissors); if (ScissorStack.pushScissors(tempScissors)) { firstWidget.draw(batch, alpha); batch.flush(); ScissorStack.popScissors(); } } if (secondWidget != null && secondWidget.isVisible()) { batch.flush(); getStage().calculateScissors(secondWidgetBounds, tempScissors); if (ScissorStack.pushScissors(tempScissors)) { secondWidget.draw(batch, alpha); batch.flush(); ScissorStack.popScissors(); } } batch.setColor(color.r, color.g, color.b, alpha); style.handle.draw(batch, handleBounds.x, handleBounds.y, handleBounds.width, handleBounds.height); resetTransform(batch); }