[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kmines/viranch/qtquick] src/qml: Maintain aspect ratio of the mine field and scale it according to
From:       Viranch Mehta <viranch.mehta () gmail ! com>
Date:       2013-03-28 11:59:43
Message-ID: 20130328115943.3B09EA610B () git ! kde ! org
[Download RAW message or body]

Git commit 817598acf3e732580d7d2fc9580d940093f26b62 by Viranch Mehta.
Committed on 08/08/2012 at 00:38.
Pushed by viranch into branch 'viranch/qtquick'.

Maintain aspect ratio of the mine field and scale it according to window si=
ze making sure it is visible at all times

M  +2    -2    src/qml/MineField.qml

http://commits.kde.org/kmines/817598acf3e732580d7d2fc9580d940093f26b62

diff --git a/src/qml/MineField.qml b/src/qml/MineField.qml
index e27afd6..bfb52c4 100644
--- a/src/qml/MineField.qml
+++ b/src/qml/MineField.qml
@@ -21,8 +21,8 @@ import org.kde.games.core 0.1 as KgCore
 Item {
     id: container
 =

-    width: height*(columns+2)/(rows+2)
-    height: Math.floor(parent.height/(rows+2))*(rows+2)
+    width: Math.min(parent.height*grid.columns/grid.rows, Math.floor(paren=
t.width/grid.columns)*grid.columns)
+    height: Math.min(parent.width*grid.rows/grid.columns, Math.floor(paren=
t.height/grid.rows)*grid.rows)
 =

     signal cellClicked(int index)
 =


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic