Warning, /plasma/kwin/src/plugins/tileseditor/qml/ResizeCorner.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 SPDX-FileCopyrightText: 2022 Marco Martin <mart@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 import QtQuick 0008 import Qt5Compat.GraphicalEffects 0009 import QtQuick.Layouts 0010 import org.kde.kwin as KWinComponents 0011 import org.kde.kwin.private.effects 0012 import org.kde.kirigami 2.20 as Kirigami 0013 0014 Rectangle { 0015 id: handle 0016 0017 required property QtObject tile 0018 0019 required property int corner 0020 0021 z: 2 0022 0023 implicitWidth: Kirigami.Units.gridUnit 0024 implicitHeight: Kirigami.Units.gridUnit 0025 0026 radius: 3 0027 color: Kirigami.Theme.highlightColor 0028 opacity: hoverHandler.hovered || dragHandler.active ? 0.4 : 0 0029 visible: tile && 0030 (tile.layoutDirection === KWinComponents.Tile.Floating || 0031 (corner === Qt.TopLeftCorner || corner === Qt.BottomLeftCorner ? tile.relativeGeometry.x > 0 : true) && 0032 (corner === Qt.TopLeftCorner || corner === Qt.TopRightCorner ? tile.relativeGeometry.y > 0 : true) && 0033 (corner === Qt.TopRightCorner || corner === Qt.BottomRightCorner ? tile.relativeGeometry.x + tile.relativeGeometry.width < 1 : true) && 0034 (corner === Qt.BottomLeftCorner || corner === Qt.BottomRightCorner ? tile.relativeGeometry.y + tile.relativeGeometry.height < 1 : true)) 0035 0036 HoverHandler { 0037 id: hoverHandler 0038 grabPermissions: PointerHandler.TakeOverForbidden | PointerHandler.CanTakeOverFromAnything 0039 cursorShape: { 0040 switch (handle.corner) { 0041 case Qt.TopLeftCorner: 0042 return Qt.SizeFDiagCursor; 0043 case Qt.TopRightCorner: 0044 return Qt.SizeBDiagCursor; 0045 case Qt.BottomLeftCorner: 0046 return Qt.SizeBDiagCursor; 0047 case Qt.BottomRightCorner: 0048 return Qt.SizeFDiagCursor; 0049 } 0050 } 0051 } 0052 0053 DragHandler { 0054 id: dragHandler 0055 target: null 0056 property point oldPoint: Qt.point(0, 0) 0057 property point dragPoint: centroid.scenePosition 0058 dragThreshold: 0 0059 grabPermissions: PointerHandler.TakeOverForbidden | PointerHandler.CanTakeOverFromAnything 0060 onActiveChanged: { 0061 if (active) { 0062 oldPoint = dragPoint; 0063 } 0064 } 0065 onDragPointChanged: { 0066 if (!active) { 0067 return; 0068 } 0069 switch (handle.corner) { 0070 case Qt.TopLeftCorner: 0071 tile.resizeByPixels(dragPoint.x - oldPoint.x, Qt.LeftEdge); 0072 tile.resizeByPixels(dragPoint.y - oldPoint.y, Qt.TopEdge); 0073 break; 0074 case Qt.TopRightCorner: 0075 tile.resizeByPixels(dragPoint.x - oldPoint.x, Qt.RightEdge); 0076 tile.resizeByPixels(dragPoint.y - oldPoint.y, Qt.TopEdge); 0077 break; 0078 case Qt.BottomLeftCorner: 0079 tile.resizeByPixels(dragPoint.x - oldPoint.x, Qt.LeftEdge); 0080 tile.resizeByPixels(dragPoint.y - oldPoint.y, Qt.BottomEdge); 0081 break; 0082 case Qt.BottomRightCorner: 0083 tile.resizeByPixels(dragPoint.x - oldPoint.x, Qt.RightEdge); 0084 tile.resizeByPixels(dragPoint.y - oldPoint.y, Qt.BottomEdge); 0085 break; 0086 } 0087 0088 oldPoint = dragPoint; 0089 } 0090 } 0091 }