[four-in-a-row] Change transition on large windows.



commit c6e8d3b55c32078d04204113a3d14f6e8e234f03
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Wed Feb 5 05:11:28 2020 +0100

    Change transition on large windows.
    
    Sync with Taquin and Reversi.

 data/ui/four-in-a-row.ui | 24 ++++++++++++------------
 src/game-window.vala     |  8 +++++++-
 2 files changed, 19 insertions(+), 13 deletions(-)
---
diff --git a/data/ui/four-in-a-row.ui b/data/ui/four-in-a-row.ui
index 9f9aeb3..43ab012 100644
--- a/data/ui/four-in-a-row.ui
+++ b/data/ui/four-in-a-row.ui
@@ -94,6 +94,18 @@
           <object class="GtkStack" id="stack">
             <property name="visible">True</property>
             <property name="homogeneous">True</property>
+            <child>
+              <object class="GtkBox" id="game_box">
+                <property name="visible">True</property>
+                <property name="orientation">vertical</property>
+                <style>
+                  <class name="game-box"/>
+                </style>
+              </object>
+              <packing>
+                <property name="name">game-box</property>
+              </packing>
+            </child>
             <child>
               <object class="GtkScrolledWindow">
                 <property name="visible">True</property>
@@ -110,18 +122,6 @@
                 <property name="name">start-box</property>
               </packing>
             </child>
-            <child>
-              <object class="GtkBox" id="game_box">
-                <property name="visible">True</property>
-                <property name="orientation">vertical</property>
-                <style>
-                  <class name="game-box"/>
-                </style>
-              </object>
-              <packing>
-                <property name="name">game-box</property>
-              </packing>
-            </child>
           </object>
         </child>
         <child type="overlay">
diff --git a/src/game-window.vala b/src/game-window.vala
index 65b9686..ce8abd1 100644
--- a/src/game-window.vala
+++ b/src/game-window.vala
@@ -253,8 +253,11 @@ private class GameWindow : AdaptativeWindow, AdaptativeWidget
     \*/
 
     private bool is_extra_thin = false;
+    private bool is_quite_thin = false;
     protected override void set_window_size (AdaptativeWidget.WindowSize new_size)
     {
+        is_quite_thin = AdaptativeWidget.WindowSize.is_quite_thin (new_size);
+
         bool _is_extra_thin = AdaptativeWidget.WindowSize.is_extra_thin (new_size);
         if (_is_extra_thin == is_extra_thin)
             return;
@@ -354,7 +357,10 @@ private class GameWindow : AdaptativeWindow, AdaptativeWidget
 
         play ();        // FIXME lag (see in Taquin…)
 
-        stack.set_transition_type (StackTransitionType.SLIDE_DOWN);
+        if (is_quite_thin)
+            stack.set_transition_type (StackTransitionType.SLIDE_DOWN);
+        else
+            stack.set_transition_type (StackTransitionType.OVER_DOWN_UP);
         stack.set_transition_duration (1000);
         show_view ();
     }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]