diff --git a/src/activities/erase/Block.qml b/src/activities/erase/Block.qml --- a/src/activities/erase/Block.qml +++ b/src/activities/erase/Block.qml @@ -32,17 +32,22 @@ property double iy property int nbx property int nby + property bool higher x: ix * main.width / nbx - y: iy * (main.height - bar.height / 2) / nby + y: iy * (main.height - bar.height) / (nby + getMultipleOfRatioToAdjustHeight() * ApplicationInfo.ratio) width: main.width / nbx - height: (main.height - bar.height / 2) / nby + height: (main.height - bar.height) / (nby + getMultipleOfRatioToAdjustHeight() * ApplicationInfo.ratio) signal enter signal leave property string type property int counter: 0 + function getMultipleOfRatioToAdjustHeight() { + return higher ? 0.625 : 0.125 + } + onEnter: { if(opacity == 1.0) { playSound() diff --git a/src/activities/erase/Erase.qml b/src/activities/erase/Erase.qml --- a/src/activities/erase/Erase.qml +++ b/src/activities/erase/Erase.qml @@ -42,6 +42,7 @@ fillMode: Image.PreserveAspectCrop source: Activity.url + Activity.getFirstImage() sourceSize.width: Math.max(parent.width, parent.height) + property bool vert: background.width > background.height + 40 * ApplicationInfo.ratio Component.onCompleted: { activity.start.connect(start) @@ -55,6 +56,7 @@ property alias bonus: bonus property int nbSubLevel: 6 property int currentSubLevel: 0 + property bool higher: false } onStart: Activity.start(main, items, type) @@ -99,6 +101,7 @@ type: activity.type main: MAIN bar: BAR + higher: items.higher } } @@ -124,8 +127,9 @@ } Score { + id: score anchors { - bottom: parent.bottom + bottom: getBottom() bottomMargin: 10 * ApplicationInfo.ratio right: parent.right rightMargin: 10 * ApplicationInfo.ratio @@ -134,6 +138,15 @@ } numberOfSubLevels: items.nbSubLevel currentSubLevel: items.currentSubLevel + 1 + function getBottom() { + if(background.vert) { + items.higher = false + return background.bottom + } else { + items.higher = true + return bar.top + } + } } } } diff --git a/src/activities/erase/erase.js b/src/activities/erase/erase.js --- a/src/activities/erase/erase.js +++ b/src/activities/erase/erase.js @@ -22,6 +22,7 @@ .pragma library .import QtQuick 2.6 as Quick +.import GCompris 1.0 as GCompris //for ApplicationInfo .import "qrc:/gcompris/src/core/core.js" as Core var url = "qrc:/gcompris/src/activities/erase/resource/" @@ -128,8 +129,8 @@ } createdBlocks = 0 killedBlocks = 0 - var nbx = (currentLevel % 2 * 3) + 5; - var nby = (currentLevel % 2 * 3) + 5; + var nbx = Math.min((currentLevel % 2 * 3) + 5, main.width / (10 * GCompris.ApplicationInfo.ratio)); + var nby = Math.min((currentLevel % 2 * 3) + 5, main.height / (10 * GCompris.ApplicationInfo.ratio)); var w = main.width / nbx var h = (main.height - items.bar.height) / nby var i = 0