Esempio n. 1
0
 /**
  * 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 void localToDescendantCoordinates(Actor descendant, Vector2 localPoint) {
   Group parent = descendant.getParent();
   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, localPoint);
   // Then from each parent down to the descendant.
   descendant.parentToLocalCoordinates(localPoint);
 }
Esempio n. 2
0
 public Actor hit(float x, float y) {
   if (getTouchable() == Touchable.disabled) return null;
   Array<Actor> children = this.children;
   for (int i = children.size - 1; i >= 0; i--) {
     Actor child = children.get(i);
     if (!child.isVisible()) continue;
     child.parentToLocalCoordinates(point.set(x, y));
     Actor hit = child.hit(point.x, point.y);
     if (hit != null) return hit;
   }
   return super.hit(x, y);
 }
Esempio n. 3
0
 /**
  * Transforms the specified point in the stage's coordinates to the actor's local coordinate
  * system.
  */
 public Vector2 stageToLocalCoordinates(Vector2 stageCoords) {
   if (parent == null) return stageCoords;
   parent.stageToLocalCoordinates(stageCoords);
   parentToLocalCoordinates(stageCoords);
   return stageCoords;
 }