You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by tv...@apache.org on 2009/09/01 17:45:45 UTC
svn commit: r810101 -
/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/CardPaneSkin.java
Author: tvolkert
Date: Tue Sep 1 15:45:45 2009
New Revision: 810101
URL: http://svn.apache.org/viewvc?rev=810101&view=rev
Log:
PIVOT-256 & PIVOT-257 :: Fix issue in circular style in card pane skin, and add selectionChangeDuration style
Modified:
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/CardPaneSkin.java
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/CardPaneSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/CardPaneSkin.java?rev=810101&r1=810100&r2=810101&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/CardPaneSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/CardPaneSkin.java Tue Sep 1 15:45:45 2009
@@ -60,7 +60,7 @@
public final int direction;
public SelectionChangeTransition(int from, int to) {
- super(SELECTION_CHANGE_DURATION, SELECTION_CHANGE_RATE, false);
+ super(selectionChangeDuration, SELECTION_CHANGE_RATE, false);
this.from = from;
this.to = to;
@@ -79,10 +79,10 @@
&& to == length - 1) {
direction = -1;
} else {
- direction = Integer.signum(from - to);
+ direction = Integer.signum(to - from);
}
} else {
- direction = Integer.signum(from - to);
+ direction = Integer.signum(to - from);
}
}
}
@@ -172,15 +172,15 @@
float percentComplete = slideEasing.easeOut(getElapsedTime(), 0, 1, getDuration());
- int dx = (int)(width * percentComplete) * direction;
- int dy = (int)(height * percentComplete) * direction;
+ int dx = (int)(width * percentComplete) * -direction;
+ int dy = (int)(height * percentComplete) * -direction;
if (selectionChangeEffect == SelectionChangeEffect.HORIZONTAL_SLIDE) {
fromCard.setLocation(padding.left + dx, padding.top);
- toCard.setLocation(padding.left - (width * direction) + dx, padding.top);
+ toCard.setLocation(padding.left - (width * -direction) + dx, padding.top);
} else {
fromCard.setLocation(padding.left, padding.top + dy);
- toCard.setLocation(padding.left, padding.top - (height * direction) + dy);
+ toCard.setLocation(padding.left, padding.top - (height * -direction) + dy);
}
}
}
@@ -294,11 +294,12 @@
private Insets padding = Insets.NONE;
private boolean sizeToSelection = false;
private SelectionChangeEffect selectionChangeEffect = null;
+ private int selectionChangeDuration = DEFAULT_SELECTION_CHANGE_DURATION;
private boolean circular = false;
private SelectionChangeTransition selectionChangeTransition = null;
- public static final int SELECTION_CHANGE_DURATION = 250;
+ public static final int DEFAULT_SELECTION_CHANGE_DURATION = 250;
public static final int SELECTION_CHANGE_RATE = 30;
@Override
@@ -504,6 +505,14 @@
setSelectionChangeEffect(SelectionChangeEffect.valueOf(selectionChangeEffect.toUpperCase()));
}
+ public int getSelectionChangeDuration() {
+ return selectionChangeDuration;
+ }
+
+ public void setSelectionChangeDuration(int selectionChangeDuration) {
+ this.selectionChangeDuration = selectionChangeDuration;
+ }
+
/**
* Sets the circular style, which controls the direction of certain
* transitions (transitions for which a direction makes sense) when looping