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 15:53:54 UTC
svn commit: r810056 -
/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/CardPaneSkin.java
Author: tvolkert
Date: Tue Sep 1 13:53:54 2009
New Revision: 810056
URL: http://svn.apache.org/viewvc?rev=810056&view=rev
Log:
PIVOT-256 :: Further refine the circular style in card pane skin
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=810056&r1=810055&r2=810056&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 13:53:54 2009
@@ -71,13 +71,16 @@
int length = cardPane.getLength();
if (circular
- && from == length - 1
- && to == 0) {
- direction = 1;
- } else if (circular
- && from == 0
- && to == length - 1) {
- direction = -1;
+ && length >= 3) {
+ if (from == length - 1
+ && to == 0) {
+ direction = 1;
+ } else if (from == 0
+ && to == length - 1) {
+ direction = -1;
+ } else {
+ direction = Integer.signum(from - to);
+ }
} else {
direction = Integer.signum(from - to);
}
@@ -511,6 +514,9 @@
* directional transitions will appear to move forward when transitioning
* from the last card to the first, and backward when they transition from
* the first card to the last.
+ * <p>
+ * Note: to avoid ambiguity, the circular style will be ignored if the card
+ * pane has fewer than three cards.
*
* @return
* <tt>true</tt> if directional transitions will be circular;
@@ -530,6 +536,9 @@
* directional transitions will appear to move forward when transitioning
* from the last card to the first, and backward when they transition from
* the first card to the last.
+ * <p>
+ * Note: to avoid ambiguity, the circular style will be ignored if the card
+ * pane has fewer than three cards.
*
* @param circular
* <tt>true</tt> if directional transitions should be circular;