Changeset View
Changeset View
Standalone View
Standalone View
a/src/activities/simplepaint/PaintCursor.qml
1 | /* GCompris - PaintCursor.qml | ||||
---|---|---|---|---|---|
2 | * | ||||
3 | * Copyright (C) 2018 Bruno Coudoin <bruno.coudoin@gcompris.net> | ||||
4 | * | ||||
5 | * Authors: | ||||
6 | * Christof Petig and Ingo Konrad (GTK+ version) | ||||
7 | * Bruno Coudoin <bruno.coudoin@gcompris.net> (Qt Quick port) | ||||
8 | * | ||||
9 | * This program is free software; you can redistribute it and/or modify | ||||
10 | * it under the terms of the GNU General Public License as published by | ||||
11 | * the Free Software Foundation; either version 3 of the License, or | ||||
12 | * (at your option) any later version. | ||||
13 | * | ||||
14 | * This program is distributed in the hope that it will be useful, | ||||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
17 | * GNU General Public License for more details. | ||||
18 | * | ||||
19 | * You should have received a copy of the GNU General Public License | ||||
20 | * along with this program; if not, see <https://www.gnu.org/licenses/>. | ||||
21 | */ | ||||
22 | import QtQuick 2.6 | ||||
23 | import "simplepaint.js" as Activity | ||||
24 | import GCompris 1.0 | ||||
25 | | ||||
26 | | ||||
27 | Item { | ||||
28 | id: cursor | ||||
29 | property alias color: rectangle.color | ||||
30 | property double ix | ||||
31 | property double iy | ||||
32 | property int nbx | ||||
33 | property int nby | ||||
34 | property int initialX | ||||
35 | // Warning testing parent here, just to avoid an error at deletion time | ||||
36 | property double r: parent ? Math.min((parent.width - initialX) / nbx / 2, (parent.height - bar.height) / nby / 2) : 0 | ||||
37 | property double offsetX: parent ? (initialX + parent.width % (width * nbx)) / 2 : 0 | ||||
38 | property double offsetY: parent ? 10 : 0 | ||||
39 | x: width * ix + offsetX | ||||
40 | y: height * iy + offsetY | ||||
41 | width: r * 2 | ||||
42 | height: r * 2 | ||||
43 | | ||||
44 | Rectangle { | ||||
45 | id: rectangle | ||||
46 | anchors.fill: parent | ||||
47 | //border.width: bar.level == 1 ? 1 : 0 | ||||
48 | //border.color: "black" | ||||
49 | } | ||||
50 | | ||||
51 | | ||||
52 | Image { | ||||
53 | scale: 0.9 | ||||
54 | width: rectangle.height | ||||
55 | height: rectangle.height | ||||
56 | sourceSize.width: rectangle.height | ||||
57 | sourceSize.height: rectangle.height | ||||
58 | source: Activity.url + "eraser.svg" | ||||
59 | visible: true | ||||
60 | anchors.centerIn: parent | ||||
61 | } | ||||
62 | | ||||
63 | | ||||
64 | } |