1/* GCompris - MoveButtons.qml
2 *
3 * SPDX-FileCopyrightText: 2021 Harsh Kumar <hadron43@yahoo.com>
4 * SPDX-License-Identifier: GPL-3.0-or-later
5 */
6
7import QtQuick 2.9
8import GCompris 1.0
9
10import "../../core"
11import "path.js" as Activity
12
13Item {
14    id: moveButtons
15
16    property double spacing: size / 3
17    property double size: Math.min(width / 5, height)
18
19    Flow {
20        id: flow
21        anchors {
22            verticalCenter: parent.verticalCenter
23            horizontalCenter: parent.horizontalCenter
24        }
25        spacing: moveButtons.spacing
26
27        BarButton {
28            id: upButton
29            source: "qrc:/gcompris/src/activities/path_encoding/resource/arrow.svg"
30            rotation: -90
31            sourceSize.width: size
32            onClicked: Activity.moveTowards(Activity.Directions.UP)
33            Rectangle {
34                anchors.fill: parent
35                radius: width * 0.5
36                color: "#00FFFFFF"
37                border.color: "#F2F2F2"
38                border.width: 4
39            }
40        }
41
42        BarButton {
43            id: downButton
44            source: "qrc:/gcompris/src/activities/path_encoding/resource/arrow.svg"
45            rotation: 90
46            sourceSize.width: size
47            onClicked: Activity.moveTowards(Activity.Directions.DOWN)
48            Rectangle {
49                anchors.fill: parent
50                radius: width * 0.5
51                color: "#00FFFFFF"
52                border.color: "#F2F2F2"
53                border.width: 4
54            }
55        }
56
57        BarButton {
58            id: leftButton
59            source: "qrc:/gcompris/src/activities/path_encoding/resource/arrow.svg"
60            rotation: -180
61            sourceSize.width: size
62            onClicked: Activity.moveTowards(Activity.Directions.LEFT)
63            Rectangle {
64                anchors.fill: parent
65                radius: width * 0.5
66                color: "#00FFFFFF"
67                border.color: "#F2F2F2"
68                border.width: 4
69            }
70        }
71
72        BarButton {
73            id: rightButton
74            source: "qrc:/gcompris/src/activities/path_encoding/resource/arrow.svg"
75            rotation: 0
76            sourceSize.width: size
77            onClicked: Activity.moveTowards(Activity.Directions.RIGHT)
78            Rectangle {
79                anchors.fill: parent
80                radius: width * 0.5
81                color: "#00FFFFFF"
82                border.color: "#F2F2F2"
83                border.width: 4
84            }
85        }
86    }
87}
88