Warning, /libraries/kquickimageeditor/src/controls/SelectionBackground.qml is written in an unsupported language. File is not indexed.

0001 /* SPDX-FileCopyrightText: 2021 Noah Davis <noahadvs@gmail.com>
0002  * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0003  */
0004 
0005 import QtQuick 2.15
0006 import QtQuick.Shapes 1.15
0007 import org.kde.kirigami 2.15 as Kirigami
0008 
0009 Shape {
0010     id: root
0011     property bool enableAnimation: !(root.parent instanceof SelectionTool)
0012         || !(parent.selectionArea.drag.active
0013             || (parent.pressedHandle && parent.pressedHandle.drag.active))
0014     Rectangle {
0015         z: -1
0016         anchors.fill: parent
0017         anchors.margins: -1
0018         color: "transparent"
0019         border.color: Kirigami.Theme.highlightColor
0020         border.width: 1
0021     }
0022     ShapePath {
0023         id: shapePath
0024         fillColor: "transparent"
0025         strokeWidth: 1
0026         strokeColor: "white"
0027         strokeStyle: ShapePath.DashLine
0028         // for some reason, +2 makes the spacing and dash lengths the same, no matter what the strokeWidth is.
0029         dashPattern: [Kirigami.Units.smallSpacing / strokeWidth, Kirigami.Units.smallSpacing / strokeWidth + 2]
0030         dashOffset: 0
0031         startX: -strokeWidth/2; startY: startX
0032         PathLine { x: root.width - shapePath.startX; y: shapePath.startY }
0033         PathLine { x: root.width - shapePath.startX; y: root.height - shapePath.startY }
0034         PathLine { x: shapePath.startX; y: root.height - shapePath.startY }
0035         PathLine { x: shapePath.startX; y: shapePath.startY }
0036         NumberAnimation on dashOffset {
0037             running: root.enableAnimation
0038             loops: Animation.Infinite
0039             from: shapePath.dashOffset; to: shapePath.dashOffset + shapePath.dashPattern[0] + shapePath.dashPattern[1]
0040             duration: 1000
0041         }
0042     }
0043 }