diff --git a/src/activities/penalty/Penalty.qml b/src/activities/penalty/Penalty.qml --- a/src/activities/penalty/Penalty.qml +++ b/src/activities/penalty/Penalty.qml @@ -39,14 +39,13 @@ anchors.fill: parent signal start signal stop - property string saveBallState: "" Component.onCompleted: { activity.start.connect(start) activity.stop.connect(stop) } - function changeBallState() { + function changeBallState(saveBallState) { instruction.text = "" if(ball.state === "FAIL") { @@ -59,10 +58,7 @@ if (saveBallState == "LEFT") { progress = progressLeft } - else if(saveBallState == "CENTER"){ - progress = progressTop - } - else { + else if(saveBallState == "RIGHT"){ progress = progressRight } @@ -76,7 +72,7 @@ /* Success or not */ if(progress.ratio < 100) { /* Success */ - ball.state = background.saveBallState + ball.state = saveBallState } else { /* failure */ ball.state = "FAIL" @@ -94,14 +90,13 @@ //To enable tapping/clicking on left side of goal Rectangle { id: rectLeft - //anchors.fill: parent.left width: parent.width * 0.36 height: width * 0.63 anchors.left: parent.left anchors.top: parent.top anchors.leftMargin: 110 anchors.topMargin: 50 - color: "red" + color: "transparent" MouseArea { id: maleft @@ -109,9 +104,8 @@ acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MidButton onClicked: { if(mouse.button) { - if (mouse.button == Qt.LeftButton | mouse.button == Qt.RightButton | mouse.button == Qt.MidButton) { - background.saveBallState = "LEFT" - changeBallState() + if (mouse.button) { + changeBallState("LEFT") } } } @@ -127,7 +121,7 @@ anchors.left: parent.left anchors.leftMargin: 575 anchors.topMargin: 50 - color: "white" + color: "transparent" MouseArea { id: matop @@ -135,9 +129,8 @@ acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MidButton onClicked: { if(mouse.button) { - if (mouse.button == Qt.LeftButton | mouse.button == Qt.RightButton | mouse.button == Qt.MidButton) { - background.saveBallState = "CENTER" - changeBallState() + if (mouse.button) { + changeBallState("CENTER") } } } @@ -147,14 +140,13 @@ //To enable tapping/clicking on right side of goal Rectangle { id: rectRight - //anchors.fill: parent.right width: parent.width * 0.36 height: width * 0.63 anchors.right: parent.right anchors.top: parent.top anchors.rightMargin: 90 anchors.topMargin: 50 - color: "blue" + color: "transparent" MouseArea { id: maright @@ -162,9 +154,8 @@ acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MidButton onClicked: { if(mouse.button) { - if (mouse.button == Qt.LeftButton | mouse.button == Qt.RightButton | mouse.button == Qt.MidButton) { - background.saveBallState = "RIGHT" - changeBallState() + if (mouse.button) { + changeBallState("RIGHT") } } }