Warning, /education/gcompris/src/activities/graph-coloring/Node.qml is written in an unsupported language. File is not indexed.
0001 /* GCompris - SearchItem.qml
0002 *
0003 * Copyright (C) Holger Kaelberer <holger.k@elberer.de>
0004 *
0005 * Authors:
0006 * Holger Kaelberer <holger.k@elberer.de>
0007 * Akshat Tandon <akshat.tandon@research.iiit.ac.in>
0008 *
0009 * SPDX-License-Identifier: GPL-3.0-or-later
0010 */
0011
0012 import QtQuick 2.12
0013 import GCompris 1.0
0014 import "graph-coloring.js" as Activity
0015
0016 Item {
0017 id: root
0018 property int searchItemIndex: -1
0019 property alias border: color.border
0020 property alias radius: color.radius
0021 property bool highlightSymbol: false
0022 property bool symbolRotation: false
0023
0024 Image {
0025 id: symbol
0026 visible: items.mode === "symbol"
0027 fillMode: Image.PreserveAspectFit
0028 source: searchItemIndex == -1 ? Activity.url + "shapes/" + "circle_node.svg" : Activity.symbols[root.searchItemIndex]
0029 anchors.left: parent.left
0030 anchors.top: parent.top
0031 anchors.margins: 3
0032 width: parent.width - 6
0033 height: parent.height - 6
0034 SequentialAnimation {
0035 id: anim
0036 running: root.symbolRotation
0037 loops: Animation.Infinite
0038 NumberAnimation {
0039 target: symbol
0040 property: "rotation"
0041 from: -10; to: 10
0042 duration: 500
0043 easing.type: Easing.InOutQuad
0044 }
0045 NumberAnimation {
0046 target: symbol
0047 property: "rotation"
0048 from: 10; to: -10
0049 duration: 500
0050 easing.type: Easing.InOutQuad }
0051 }
0052 NumberAnimation {
0053 id: rotationStop
0054 running: !root.symbolRotation
0055 target: symbol
0056 property: "rotation"
0057 to: 0
0058 duration: 500
0059 easing.type: Easing.InOutQuad
0060 }
0061 }
0062 Rectangle {
0063 id: symbolHighlighter
0064 visible: (items.mode === "symbol") && root.highlightSymbol
0065 anchors.fill: parent
0066 width: parent.width
0067 height: parent.height
0068 border.width: 3
0069 border.color: "white"
0070 color: "transparent"
0071 }
0072
0073 Rectangle {
0074 id: color
0075 visible: items.mode === "color"
0076 color: root.searchItemIndex == -1 ? "white" : Activity.colors[root.searchItemIndex]
0077 anchors.fill: parent
0078 width: parent.width
0079 height: parent.height
0080 radius: width / 2
0081 }
0082 }