Warning, /plasma/plasma-mobile/kwin/mobiletaskswitcher/qml/FlickContainer.qml is written in an unsupported language. File is not indexed.
0001 // SPDX-FileCopyrightText: 2021-2023 Devin Lin <devin@kde.org> 0002 // SPDX-License-Identifier: LGPL-2.0-or-later 0003 0004 import QtQuick 0005 0006 Flickable { 0007 id: root 0008 0009 required property var taskSwitcherState 0010 0011 // we use flickable solely for capturing flicks, not positioning elements 0012 contentWidth: width * tasksCount 0013 contentHeight: height 0014 contentX: startContentX 0015 0016 readonly property real startContentX: 0 0017 0018 // update position from horizontal flickable movement 0019 property real oldContentX 0020 onContentXChanged: { 0021 taskSwitcherState.xPosition += contentX - oldContentX; 0022 oldContentX = contentX; 0023 } 0024 0025 onMovementStarted: taskSwitcherState.cancelAnimations(); 0026 onMovementEnded: { 0027 resetPosition(); 0028 taskSwitcherState.updateState(); 0029 } 0030 0031 onFlickStarted: { 0032 root.cancelFlick(); 0033 } 0034 onFlickEnded: { 0035 resetPosition(); 0036 taskSwitcherState.updateState(); 0037 } 0038 0039 onDraggingChanged: { 0040 if (!dragging) { 0041 resetPosition(); 0042 taskSwitcherState.updateState(); 0043 } else { 0044 taskSwitcherState.cancelAnimations(); 0045 } 0046 } 0047 0048 function resetPosition() { 0049 oldContentX = startContentX; 0050 contentX = startContentX; 0051 } 0052 }