[iagno] Change transition on large windows.



commit ead1b9347c98bdafbd48f0bfc2e87093b0362e55
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Thu Jan 30 16:07:31 2020 +0100

    Change transition on large windows.

 src/game-view.vala   |  7 ++++---
 src/game-window.vala | 17 ++++++++++++++++-
 2 files changed, 20 insertions(+), 4 deletions(-)
---
diff --git a/src/game-view.vala b/src/game-view.vala
index d87e8f3..fb095b6 100644
--- a/src/game-view.vala
+++ b/src/game-view.vala
@@ -1,5 +1,5 @@
-/* -*- Mode: vala; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
+/* -*- Mode: vala; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+
    This file is part of a GNOME game.
 
    Copyright 2019 Arnaud Bonatti
@@ -80,7 +80,8 @@ private class GameView : BaseView, AdaptativeWidget
         game_box.show ();
         game_box.get_style_context ().add_class ("game-box");
 
-        game_stack.add (game_box);
+        // for the new-game-screen-to-game animation, it is probably better to have the game under 
("uncovered")
+        game_stack.add_with_properties (game_box, "position", 0);
         content.can_focus = true;
     }
 
diff --git a/src/game-window.vala b/src/game-window.vala
index b6664ec..73753ec 100644
--- a/src/game-window.vala
+++ b/src/game-window.vala
@@ -87,6 +87,18 @@ private class GameWindow : BaseWindow, AdaptativeWidget
             show_new_game_screen ();
     }
 
+    /*\
+    * * adaptative stuff
+    \*/
+
+    private bool is_quite_thin = false;
+    protected override void set_window_size (AdaptativeWidget.WindowSize new_size)
+    {
+        base.set_window_size (new_size);
+
+        is_quite_thin = AdaptativeWidget.WindowSize.is_quite_thin (new_size);
+    }
+
     /*\
     * * some public calls
     \*/
@@ -295,7 +307,10 @@ private class GameWindow : BaseWindow, AdaptativeWidget
 
         play ();        // FIXME lag (see in Taquin…)
 
-        game_view.configure_transition (StackTransitionType.SLIDE_DOWN, 1000);
+        if (is_quite_thin)
+            game_view.configure_transition (StackTransitionType.SLIDE_DOWN, 1000);
+        else
+            game_view.configure_transition (StackTransitionType.OVER_DOWN_UP, 1000);
         show_view ();
     }
 }


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