Warning, /plasma/kwin/src/plugins/tileseditor/qml/ResizeHandle.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 org.kde.kwin as KWinComponents 0009 import org.kde.kwin.private.effects 0010 import org.kde.kirigami 2.20 as Kirigami 0011 0012 Rectangle { 0013 id: handle 0014 0015 required property QtObject tile 0016 0017 required property int edge 0018 readonly property int orientation: edge === Qt.LeftEdge || edge === Qt.RightEdge ? Qt.Horizontal : Qt.Vertical 0019 readonly property bool valid: tile !== null && tile.parent !== null && (tile.layoutDirection === KWinComponents.Tile.Floating 0020 || (orientation === Qt.Horizontal && tile.parent.layoutDirection === KWinComponents.Tile.Horizontal) 0021 || (orientation === Qt.Vertical && tile.parent.layoutDirection === KWinComponents.Tile.Vertical)) 0022 0023 z: 2 0024 0025 implicitWidth: Kirigami.Units.smallSpacing * 2 0026 implicitHeight: Kirigami.Units.smallSpacing * 2 0027 0028 radius: 3 0029 color: Kirigami.Theme.highlightColor 0030 opacity: hoverHandler.hovered || dragHandler.active ? 0.4 : 0 0031 visible: valid && (tile.layoutDirection === KWinComponents.Tile.Floating || tile.positionInLayout > 0) 0032 0033 HoverHandler { 0034 id: hoverHandler 0035 cursorShape: orientation == Qt.Horizontal ? Qt.SizeHorCursor : Qt.SizeVerCursor 0036 } 0037 0038 DragHandler { 0039 id: dragHandler 0040 target: null 0041 property point oldPoint: Qt.point(0, 0) 0042 property point dragPoint: centroid.scenePosition 0043 dragThreshold: 0 0044 onActiveChanged: { 0045 if (active) { 0046 oldPoint = dragPoint; 0047 } 0048 } 0049 onDragPointChanged: { 0050 if (!active) { 0051 return; 0052 } 0053 switch (handle.edge) { 0054 case Qt.LeftEdge: 0055 case Qt.RightEdge: 0056 tile.resizeByPixels(dragPoint.x - oldPoint.x, handle.edge); 0057 break; 0058 case Qt.TopEdge: 0059 case Qt.BottomEdge: 0060 tile.resizeByPixels(dragPoint.y - oldPoint.y, handle.edge); 0061 break; 0062 } 0063 0064 oldPoint = dragPoint; 0065 } 0066 } 0067 }