pivot-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tvolk...@apache.org
Subject svn commit: r810056 - /incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/CardPaneSkin.java
Date Tue, 01 Sep 2009 13:53:54 GMT
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;



Mime
View raw message