Skip to content

Commit d13e98a

Browse files
committed
Moved all positioning code to validate.
1 parent 77ea3a1 commit d13e98a

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

stripe/src/com/ray3k/stripe/PopTable.java

+26-26
Original file line numberDiff line numberDiff line change
@@ -525,38 +525,38 @@ public PopTableStyle getStyle() {
525525

526526
@Override
527527
public void validate() {
528-
if (!fillParent && automaticallyResized) {
529-
float centerX = getX(Align.center);
530-
float centerY = getY(Align.center);
531-
setSize(getPrefWidth(), getPrefHeight());
532-
super.validate();
533-
setSize(getPrefWidth(), getPrefHeight());
534-
setPosition(centerX, centerY, Align.center);
535-
setPosition(MathUtils.floor(getX()), MathUtils.floor(getY()));
536-
}
528+
if (fillParent) {
529+
setPosition(0, 0);
530+
} else {
531+
if (automaticallyResized) {
532+
float centerX = getX(Align.center);
533+
float centerY = getY(Align.center);
534+
setSize(getPrefWidth(), getPrefHeight());
535+
super.validate();
536+
setSize(getPrefWidth(), getPrefHeight());
537+
setPosition(centerX, centerY, Align.center);
538+
setPosition(MathUtils.floor(getX()), MathUtils.floor(getY()));
539+
}
537540

538-
if (keepSizedWithinStage) {
539-
resizeWindowWithinStage();
541+
if (keepCenteredInWindow) {
542+
float x = getStage().getWidth() / 2f;
543+
float y = getStage().getHeight() / 2f;
544+
setPosition(x, y, Align.center);
545+
setPosition(MathUtils.floor(getX()), MathUtils.floor(getY()));
546+
}
547+
548+
if (attachToActor != null && attachToActor.getStage() != null) {
549+
alignToActorEdge(attachToActor, attachEdge, attachAlign, attachOffsetX, attachOffsetY);
550+
}
551+
552+
if (keepSizedWithinStage) {
553+
resizeWindowWithinStage();
554+
}
540555
}
541556

542557
super.validate();
543558
}
544559

545-
@Override
546-
public void layout() {
547-
if (keepCenteredInWindow) {
548-
float x = getStage().getWidth() / 2f;
549-
float y = getStage().getHeight() / 2f;
550-
setPosition(x, y, Align.center);
551-
setPosition(MathUtils.floor(getX()), MathUtils.floor(getY()));
552-
}
553-
554-
if (attachToActor != null && attachToActor.getStage() != null) {
555-
alignToActorEdge(attachToActor, attachEdge, attachAlign, attachOffsetX, attachOffsetY);
556-
}
557-
super.layout();
558-
}
559-
560560
@Override
561561
public void setFillParent(boolean fillParent) {
562562
super.setFillParent(fillParent);

0 commit comments

Comments
 (0)