Commit 14caeac5 authored by Timothée Giet's avatar Timothée Giet
Browse files

letter-in-word, more fixes to avoid random overlapping images

looks like the animation on the cardBg only was the cause of the remaining case of this bug
setting the rotation animation to the whole card seems to fix it
parent a548640b
......@@ -30,7 +30,7 @@ import "letter-in-word.js" as Activity
Rectangle {
id: cardItem
property bool mouseActive: true
color: "#01FFFFFF" //setting the base as not totally transparent rectangle avoids the bug of randomly overlapping images
color: "#01FFFFFF" //setting the base as not totally transparent rectangle avoids the bug of randomly overlapping images when highlight moves
Image {
id: wordPic
......@@ -68,39 +68,6 @@ Rectangle {
horizontalAlignment: Text.AlignHCenter
styleColor: "white"
}
SequentialAnimation {
id: successAnimation
running: selected
loops: 2
NumberAnimation {
target: cardBg
easing.type: Easing.InOutQuad
property: "rotation"
to: 20; duration: 500
}
NumberAnimation {
target: cardBg
easing.type: Easing.InOutQuad
property: "rotation"; to: -20
duration: 500
}
onRunningChanged: {
if(!running && selected) {
rotationStop.restart()
}
}
}
NumberAnimation {
id: rotationStop
running: !selected
target: cardBg
property: "rotation"
to: 0
duration: 500
easing.type: Easing.Linear
}
}
Image {
......@@ -125,6 +92,29 @@ Rectangle {
}
}
SequentialAnimation {
id: selectAnimation
NumberAnimation {
target: cardItem
easing.type: Easing.InOutQuad
property: "rotation"
to: 20; duration: 250
}
NumberAnimation {
target: cardItem
easing.type: Easing.InOutQuad
property: "rotation"; to: -20
duration: 500
}
NumberAnimation {
target: cardItem
easing.type: Easing.InOutQuad
property: "rotation"
to: 0
duration: 250
}
}
function playWord() {
var locale = ApplicationInfo.getVoicesLocale(items.locale)
activity.audioVoices.append(
......@@ -133,8 +123,8 @@ Rectangle {
function select() {
if(mouseActive) {
if (Activity.checkWord(index)) {
successAnimation.restart();
if(Activity.checkWord(index)) {
selectAnimation.restart();
if(selected)
playWord();
}
......
......@@ -416,8 +416,6 @@ ActivityBase {
width: background.itemWidth
height: background.itemWidth
color: "#AAFFFFFF"
x: wordsView.currentItem.x
y: wordsView.currentItem.y
Behavior on x { SpringAnimation { spring: 2; damping: 0.2 } }
Behavior on y { SpringAnimation { spring: 2; damping: 0.2 } }
}
......
......@@ -103,8 +103,8 @@ function initLevel() {
items.wordsModel.append({
"spelling": words[i].translatedTxt,
"imgurl": words[i].image,
"selected": false,
"voice": words[i].voice
"voice": words[i].voice,
"selected": false
});
}
}
......@@ -230,7 +230,7 @@ function checkAnswer() {
}
function checkWord(index) {
var modelEntry = items.wordsModel.get(index);
items.wordsModel.setProperty(index, "selected", !modelEntry.selected);
return modelEntry.selected;
var itemStatus = !items.wordsModel.get(index).selected;
items.wordsModel.setProperty(index, "selected", itemStatus);
return itemStatus;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment