Warning, /education/gcompris/src/activities/digital_electricity/components/TerminalPoint.qml is written in an unsupported language. File is not indexed.
0001 /* GCompris - TerminalPoint.qml
0002 *
0003 * SPDX-FileCopyrightText: 2016 Pulkit Gupta <pulkitnsit@gmail.com>
0004 *
0005 * Authors:
0006 * Bruno Coudoin <bruno.coudoin@gcompris.net> (GTK+ version)
0007 * Pulkit Gupta <pulkitnsit@gmail.com> (Qt Quick port)
0008 *
0009 * SPDX-License-Identifier: GPL-3.0-or-later
0010 */
0011 import QtQuick 2.12
0012 import GCompris 1.0
0013
0014 import "../digital_electricity.js" as Activity
0015
0016 Image {
0017 id: terminalPoint
0018
0019 property double posX
0020 property double posY
0021 property double size: parent.terminalSize
0022 property bool selected: false
0023 property string type
0024 property int value: 0
0025 property var wires: []
0026
0027 width: size * parent.paintedHeight
0028 height: width
0029 source: Activity.url + "tPoint.svg"
0030 sourceSize.width: width
0031 sourceSize.height: width
0032 antialiasing: true
0033
0034 x: (parent.width - parent.paintedWidth) / 2 + posX * parent.paintedWidth - width / 2
0035 y: (parent.height - parent.paintedHeight) / 2 + posY * parent.paintedHeight - height / 2
0036
0037 property double xCenter: terminalPoint.parent.x + terminalPoint.x + width/2
0038 property double yCenter: terminalPoint.parent.y + terminalPoint.y + height/2
0039 property double xCenterFromComponent: terminalPoint.x + width/2 - terminalPoint.parent.width / 2
0040 property double yCenterFromComponent: terminalPoint.y + height/2 - terminalPoint.parent.height / 2
0041
0042 Rectangle {
0043 id: boundary
0044 anchors.centerIn: terminalPoint
0045 width: terminalPoint.width * 2
0046 height: width
0047 visible: selected
0048 radius: width / 2
0049 color: "#08D050"
0050 z: -1
0051 }
0052
0053 MouseArea {
0054 id: mouseArea
0055 anchors.fill: parent
0056 onPressed: {
0057 selected = true
0058 Activity.terminalPointSelected(terminalPoint)
0059 }
0060 }
0061 }