7import org.kde.kirigami as Kirigami
12 TopLeft, Top, TopRight,
14 BottomLeft, Bottom, BottomRight,
17 required property Item target
18 property int position: SelectionHandle.TopLeft
20 readonly property bool leftSide: position === SelectionHandle.TopLeft
21 || position === SelectionHandle.Left
22 || position === SelectionHandle.BottomLeft
23 readonly property bool rightSide: position === SelectionHandle.TopRight
24 || position === SelectionHandle.Right
25 || position === SelectionHandle.BottomRight
26 readonly property bool topSide: position === SelectionHandle.TopLeft
27 || position === SelectionHandle.Top
28 || position === SelectionHandle.TopRight
29 readonly property bool bottomSide: position === SelectionHandle.BottomLeft
30 || position === SelectionHandle.Bottom
31 || position === SelectionHandle.BottomRight
32 readonly property bool horizontalOnly: position === SelectionHandle.Left || position === SelectionHandle.Right
33 readonly property bool verticalOnly: position === SelectionHandle.Top || position === SelectionHandle.Bottom
35 readonly property bool forwardDiagonal: position === SelectionHandle.TopRight || position === SelectionHandle.BottomLeft
37 readonly property bool backwardDiagonal: position === SelectionHandle.TopLeft || position === SelectionHandle.BottomRight
39 property bool lockX: false
40 property bool lockY: false
42 LayoutMirroring.enabled: false
43 LayoutMirroring.childrenInherit: true
44 anchors.horizontalCenter: if (!pressed && !lockX) {
47 } else if (verticalOnly) {
48 target.horizontalCenter
53 anchors.verticalCenter: if (!pressed && !lockY) {
56 } else if (horizontalOnly) {
62 implicitWidth: graphics.implicitWidth + Kirigami.Units.largeSpacing * 2
63 implicitHeight: graphics.implicitHeight + Kirigami.Units.largeSpacing * 2
64 width: verticalOnly ? target.width - implicitWidth : implicitWidth
65 height: horizontalOnly ? target.height - implicitHeight : implicitHeight
66 cursorShape: if (horizontalOnly) {
68 } else if (verticalOnly) {
70 } else if (forwardDiagonal) {
78 axis: if (horizontalOnly) {
80 } else if (verticalOnly) {
85 target: pressed ? root : null
87 maximumX: parent.width - width / 2
89 maximumY: parent.height - height / 2
95 implicitWidth: Kirigami.Units.gridUnit + Kirigami.Units.gridUnit % 2
96 implicitHeight: Kirigami.Units.gridUnit + Kirigami.Units.gridUnit % 2
97 anchors.centerIn: parent
98 color: Kirigami.Theme.highlightColor
105 anchors.fill: graphics
107 x: root.leftSide ? parent.width - width : 0
108 y: root.topSide ? parent.height - height : 0
109 width: root.forwardDiagonal || root.backwardDiagonal || root.horizontalOnly ? parent.width / 2 : parent.width
110 height: root.forwardDiagonal || root.backwardDiagonal || root.verticalOnly ? parent.height / 2 : parent.height
114 anchors.fill: graphics
118 maskSource: ShaderEffectSource {
119 sourceItem: maskSource