MauiKit Image Tools

SelectionBackground.qml
1/* SPDX-FileCopyrightText: 2021 Noah Davis <noahadvs@gmail.com>
2 * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
3 */
4
5import QtQuick
6import QtQuick.Shapes
7
8import org.mauikit.controls as Maui
9import org.mauikit.imagetools.editor as ITE
10
11Shape {
12 id: root
13 property bool enableAnimation: !(root.parent instanceof SelectionTool)
14 || !(parent.selectionArea.drag.active
15 || (parent.pressedHandle && parent.pressedHandle.drag.active))
16 Rectangle {
17 z: -1
18 anchors.fill: parent
19 anchors.margins: -1
20 color: "transparent"
21 border.color: Maui.Theme.highlightColor
22 border.width: 1
23 }
24 ShapePath {
25 id: shapePath
26 fillColor: "transparent"
27 strokeWidth: 1
28 strokeColor: "white"
29 strokeStyle: ShapePath.DashLine
30 // for some reason, +2 makes the spacing and dash lengths the same, no matter what the strokeWidth is.
31 dashPattern: [Maui.Style.space.small/ strokeWidth, Maui.Style.space.small / strokeWidth + 2]
32 dashOffset: 0
33 startX: -strokeWidth/2; startY: startX
34 PathLine { x: root.width - shapePath.startX; y: shapePath.startY }
35 PathLine { x: root.width - shapePath.startX; y: root.height - shapePath.startY }
36 PathLine { x: shapePath.startX; y: root.height - shapePath.startY }
37 PathLine { x: shapePath.startX; y: shapePath.startY }
38 NumberAnimation on dashOffset {
39 running: root.enableAnimation
40 loops: Animation.Infinite
41 from: shapePath.dashOffset; to: shapePath.dashOffset + shapePath.dashPattern[0] + shapePath.dashPattern[1]
42 duration: 1000
43 }
44 }
45}
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri May 2 2025 11:56:08 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.