Warning, /education/gcompris/src/activities/nine_men_morris/DragPoint.qml is written in an unsupported language. File is not indexed.
0001 /* GCompris - DragPoint.qml 0002 * 0003 * SPDX-FileCopyrightText: 2016 Pulkit Gupta <pulkitnsit@gmail.com> 0004 * 0005 * Authors: 0006 * Pulkit Gupta <pulkitnsit@gmail.com> 0007 * 0008 * SPDX-License-Identifier: GPL-3.0-or-later 0009 */ 0010 import QtQuick 2.12 0011 0012 import "../../core" 0013 import "nine_men_morris.js" as Activity 0014 0015 import GCompris 1.0 0016 0017 Rectangle { 0018 id: dragPoint 0019 width: parent.width * 0.05 0020 height: width 0021 radius: width * 0.5 0022 opacity: 1.0 0023 border.color: "#505050" 0024 border.width: width * 0.15 0025 state: "AVAILABLE" 0026 0027 property int index 0028 property bool firstPhase 0029 property bool pieceBeingMoved 0030 property int pieceIndex 0031 property QtObject leftPoint 0032 property QtObject rightPoint 0033 property QtObject upperPoint 0034 property QtObject lowerPoint 0035 0036 states: [ 0037 State { 0038 name: "AVAILABLE" // Green color 0039 PropertyChanges { 0040 target: dragPoint 0041 color: "#74F474" 0042 } 0043 }, 0044 State { 0045 name: "UNAVAILABLE" // Red color 0046 PropertyChanges { 0047 target: dragPoint 0048 color: "#DC3D3D" 0049 } 0050 }, 0051 State { 0052 name: "EMPTY" // Brown color 0053 PropertyChanges { 0054 target: dragPoint 0055 color: "#505050" 0056 } 0057 }, 0058 State { 0059 name: "1" 0060 PropertyChanges { 0061 target: dragPoint 0062 color: "#DC3D3D" 0063 } 0064 }, 0065 State { 0066 name: "2" 0067 PropertyChanges { 0068 target: dragPoint 0069 color: "#DC3D3D" 0070 } 0071 } 0072 ] 0073 0074 MouseArea { 0075 id: area 0076 enabled: parent.state == "AVAILABLE" && !pieceBeingMoved 0077 anchors.centerIn: parent 0078 width: 2.5 * parent.width 0079 height: 2.5 * parent.height 0080 onClicked: { 0081 if (firstPhase) 0082 Activity.handleCreate(index) 0083 else 0084 Activity.movePiece(index) 0085 } 0086 } 0087 }