List of usage examples for com.badlogic.gdx.scenes.scene2d Actor toFront
public void toFront()
From source file:es.eucm.ead.editor.view.widgets.layouts.TrackLayout.java
License:Open Source License
@Override public void layout() { // Check if there is enough width to layout all children without problem float childrenWidth = prefWidth() - paddingWidth(); float availableWidth = availableWidth(); // If there is no space, ignore container padding and check again boolean ignorePadding = childrenWidth > availableWidth; float beforeX = 0; float lastW = 0; if (ignorePadding) { availableWidth += paddingWidth(); }//from ww w . ja v a 2 s .c o m float leftX = ignorePadding ? 0.0f : paddingLeft(); boolean leftCollision = false; for (Constraints c : constraints) { if (c.getActor().isVisible() || computeInvisibles) { TrackConstraints tCons = (TrackConstraints) c; Actor actor = tCons.getActor(); float width = actorWidth(actor) + 0.0f; float x = 0; float auxX = leftX + marginLeft(tCons); if (actor instanceof StretchableButton && ((StretchableButton) actor).isDragLeft()) { if (beforeX + lastW <= auxX + tCons.getWidth() - width) { tCons.marginLeft(marginLeft(tCons) + (tCons.getWidth() - width)); } else { leftCollision = true; } } else if (auxX < beforeX + lastW && !(actor instanceof FixedButton)) { tCons.marginLeft(beforeX + lastW); } if (actor instanceof FixedButton) { actor.toFront(); x = marginLeft(tCons); } else { if (actor instanceof StretchableButton && leftX + marginLeft(tCons) <= beforeX + lastW + 1) { ((StretchableButton) actor).lockLeftToLeft(); } else if (actor instanceof StretchableButton) { ((StretchableButton) actor).unlockLeftToLeft(); } if (leftCollision) { ((StretchableButton) actor) .setTotalWidth(tCons.getWidth() + (marginLeft(tCons) - (beforeX + lastW))); width = tCons.getWidth() + (marginLeft(tCons) - (beforeX + lastW)); tCons.marginLeft(beforeX + lastW); leftCollision = false; } tCons.setWidth(width); x = leftX + marginLeft(tCons); beforeX = x; lastW = width; } float height = expandY(tCons) ? containerHeight() - paddingHeight() - marginHeight(tCons) : actorHeight(actor); float y = getYAligned(tCons, height); setBoundsForActor(actor, x, y, width, height); } } }