Example usage for com.badlogic.gdx.scenes.scene2d Actor isTouchable

List of usage examples for com.badlogic.gdx.scenes.scene2d Actor isTouchable

Introduction

In this page you can find the example usage for com.badlogic.gdx.scenes.scene2d Actor isTouchable.

Prototype

public boolean isTouchable() 

Source Link

Document

Returns true if input events are processed by this actor.

Usage

From source file:es.eucm.ead.editor.view.widgets.groupeditor.GroupEditorDragListener.java

License:Open Source License

/**
 * @return the directly children of the current edited group that are inside
 *         the given selection rectangle
 *///  w  ww .  java2 s.com
private Array<Actor> getActorsInside(Rectangle selection) {
    if (selection.width < 0) {
        selection.x += selection.width;
        selection.width = Math.abs(selection.width);
    }

    if (selection.height < 0) {
        selection.y += selection.height;
        selection.height = Math.abs(selection.height);
    }

    Vector2 o = new Vector2();
    Vector2 t = new Vector2();
    Vector2 n = new Vector2();
    Vector2 d = new Vector2();
    Array<Actor> actors = new Array<Actor>();
    for (Actor a : editedGroup.getChildren()) {
        o.set(0, 0);
        t.set(a.getWidth(), 0);
        n.set(0, a.getHeight());
        d.set(a.getWidth(), a.getHeight());
        a.localToAscendantCoordinates(groupEditor, o);
        a.localToAscendantCoordinates(groupEditor, t);
        a.localToAscendantCoordinates(groupEditor, n);
        a.localToAscendantCoordinates(groupEditor, d);
        if (selection.contains(o) && selection.contains(t) && selection.contains(n) && selection.contains(d)
                && a.isTouchable() && a.isVisible()) {
            actors.add(a);
        }
    }
    return actors;
}