Files
RedBear-OS/local/recipes/qt/qtdeclarative/source/tests/manual/painterpathquickshape/ControlPoint.qml
T

49 lines
1.1 KiB
QML

// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick
import QtQuick.Shapes
Rectangle {
id: point1
color: "red"
border.width: 1
border.color: "black"
opacity: 0.3
width: 20
height: 20
visible: !theMouseArea.pressed
property real cx: 400
property real cy: 800
property point pt: Qt.point(cx, cy)
DragHandler {
id: handler
xAxis.minimum: -controlPanel.pathMargin
yAxis.minimum: -controlPanel.pathMargin
xAxis.onActiveValueChanged: {
cx = (x + width/2) / controlPanel.scale
controlPanel.updatePath()
}
yAxis.onActiveValueChanged: {
cy = (y + height/2) / controlPanel.scale
controlPanel.updatePath()
}
}
Component.onCompleted: {
x = cx * controlPanel.scale - width/2
y = cy * controlPanel.scale - height/2
}
Connections {
target: controlPanel
function onScaleChanged() {
x = cx * controlPanel.scale - width/2
y = cy * controlPanel.scale - height/2
}
}
}