Warning, /graphics/spectacle/src/Gui/Magnifier.qml is written in an unsupported language. File is not indexed.

0001 /* SPDX-FileCopyrightText: 2022 Noah Davis <noahadvs@gmail.com>
0002  * SPDX-FileCopyrightText: 2022 Marco Martin <mart@kde.org>
0003  * SPDX-License-Identifier: LGPL-2.0-or-later
0004  */
0005 
0006 import QtQuick
0007 import QtQuick.Window
0008 import QtQuick.Layouts
0009 import org.kde.kirigami as Kirigami
0010 import org.kde.spectacle.private
0011 
0012 ShaderEffectSource {
0013     id: root
0014     required property AnnotationViewport viewport
0015     required property point targetPoint
0016     property int factor: 3
0017 
0018     implicitWidth: {
0019         const w = Kirigami.Units.gridUnit * 10
0020         return w - w % factor - factor
0021     }
0022     implicitHeight: implicitWidth
0023     sourceItem: viewport
0024     sourceRect: Qt.rect((targetPoint.x - viewport.viewportRect.x) - implicitWidth / (factor * 2),
0025                         (targetPoint.y - viewport.viewportRect.y) - implicitHeight / (factor * 2),
0026                         implicitWidth / factor, implicitHeight / factor)
0027     smooth: false
0028 
0029     Item {
0030         id: center
0031         x: contextWindow.dprRound((parent.implicitWidth - width) / 2)
0032         y: contextWindow.dprRound((parent.implicitHeight - height) / 2)
0033         width: root.factor * 3
0034         height: root.factor * 3
0035     }
0036 
0037     Rectangle { // top
0038         anchors.top: parent.top
0039         anchors.bottom: center.top
0040         color: Kirigami.Theme.focusColor
0041         x: contextWindow.dprRound((parent.implicitWidth - width) / 2)
0042         width: root.factor
0043     }
0044     Rectangle { // bottom
0045         anchors.bottom: parent.bottom
0046         anchors.top: center.bottom
0047         color: Kirigami.Theme.focusColor
0048         x: contextWindow.dprRound((parent.implicitWidth - width) / 2)
0049         width: root.factor
0050     }
0051     Rectangle { // left
0052         anchors.left: parent.left
0053         anchors.right: center.left
0054         color: Kirigami.Theme.focusColor
0055         y: contextWindow.dprRound((parent.implicitHeight - height) / 2)
0056         height: root.factor
0057     }
0058     Rectangle { // right
0059         anchors.right: parent.right
0060         anchors.left: center.right
0061         color: Kirigami.Theme.focusColor
0062         y: contextWindow.dprRound((parent.implicitHeight - height) / 2)
0063         height: root.factor
0064     }
0065 }