/** Converts coordinates for this group to those of a descendant actor. The descendant does not need to be a direct child. * @throws IllegalArgumentException if the specified actor is not a descendant of this group. */ public Vector2 localToDescendantCoordinates (Actor descendant, Vector2 localCoords) { Group parent = descendant.parent; if (parent == null) throw new IllegalArgumentException("Child is not a descendant: " + descendant); // First convert to the actor's parent coordinates. if (parent != this) localToDescendantCoordinates(parent, localCoords); // Then from each parent down to the descendant. descendant.parentToLocalCoordinates(localCoords); return localCoords; }
/** Transforms the specified point in the stage's coordinates to the actor's local coordinate system. */ public Vector2 stageToLocalCoordinates (Vector2 stageCoords) { if (parent != null) parent.stageToLocalCoordinates(stageCoords); parentToLocalCoordinates(stageCoords); return stageCoords; }
/** Transforms the specified point in the stage's coordinates to the actor's local coordinate system. */ public Vector2 stageToLocalCoordinates (Vector2 stageCoords) { if (parent != null) parent.stageToLocalCoordinates(stageCoords); parentToLocalCoordinates(stageCoords); return stageCoords; }
/** Converts coordinates for this group to those of a descendant actor. The descendant does not need to be a direct child. * @throws IllegalArgumentException if the specified actor is not a descendant of this group. */ public Vector2 localToDescendantCoordinates (Actor descendant, Vector2 localCoords) { Group parent = descendant.parent; if (parent == null) throw new IllegalArgumentException("Child is not a descendant: " + descendant); // First convert to the actor's parent coordinates. if (parent != this) localToDescendantCoordinates(parent, localCoords); // Then from each parent down to the descendant. descendant.parentToLocalCoordinates(localCoords); return localCoords; }
public Actor hit (float x, float y, boolean touchable) { if (touchable && getTouchable() == Touchable.disabled) return null; if (!isVisible()) return null; Vector2 point = tmp; Actor[] childrenArray = children.items; for (int i = children.size - 1; i >= 0; i--) { Actor child = childrenArray[i]; child.parentToLocalCoordinates(point.set(x, y)); Actor hit = child.hit(point.x, point.y, touchable); if (hit != null) return hit; } return super.hit(x, y, touchable); }
public Actor hit (float x, float y, boolean touchable) { if (touchable && getTouchable() == Touchable.disabled) return null; if (!isVisible()) return null; Vector2 point = tmp; Actor[] childrenArray = children.items; for (int i = children.size - 1; i >= 0; i--) { Actor child = childrenArray[i]; child.parentToLocalCoordinates(point.set(x, y)); Actor hit = child.hit(point.x, point.y, touchable); if (hit != null) return hit; } return super.hit(x, y, touchable); }
/** Converts coordinates for this group to those of a descendant actor. The descendant does not need to be a direct child. * @throws IllegalArgumentException if the specified actor is not a descendant of this group. */ public Vector2 localToDescendantCoordinates (Actor descendant, Vector2 localCoords) { Group parent = descendant.parent; if (parent == null) throw new IllegalArgumentException("Child is not a descendant: " + descendant); // First convert to the actor's parent coordinates. if (parent != this) localToDescendantCoordinates(parent, localCoords); // Then from each parent down to the descendant. descendant.parentToLocalCoordinates(localCoords); return localCoords; }
/** Transforms the specified point in the stage's coordinates to the actor's local coordinate system. */ public Vector2 stageToLocalCoordinates (Vector2 stageCoords) { if (parent != null) parent.stageToLocalCoordinates(stageCoords); parentToLocalCoordinates(stageCoords); return stageCoords; }
public Actor hit (float x, float y, boolean touchable) { if (touchable && getTouchable() == Touchable.disabled) return null; if (!isVisible()) return null; Vector2 point = tmp; Actor[] childrenArray = children.items; for (int i = children.size - 1; i >= 0; i--) { Actor child = childrenArray[i]; child.parentToLocalCoordinates(point.set(x, y)); Actor hit = child.hit(point.x, point.y, touchable); if (hit != null) return hit; } return super.hit(x, y, touchable); }
@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 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; }