Warning, /plasma/latte-dock/containment/package/contents/ui/abilities/privates/ParabolicEffectPrivate.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 SPDX-FileCopyrightText: 2020 Michail Vourlakos <mvourlakos@gmail.com> 0003 SPDX-License-Identifier: GPL-2.0-or-later 0004 */ 0005 0006 import QtQuick 2.7 0007 0008 import org.kde.plasma.plasmoid 2.0 0009 import org.kde.plasma.core 2.0 as PlasmaCore 0010 0011 import org.kde.latte.core 0.2 as LatteCore 0012 0013 import org.kde.latte.abilities.host 0.1 as AbilityHost 0014 0015 AbilityHost.ParabolicEffect { 0016 id: parabolic 0017 0018 property Item animations: null 0019 property Item debug: null 0020 property Item layouts: null 0021 property QtObject view: null 0022 property QtObject settings: null 0023 0024 readonly property bool horizontal: plasmoid.formFactor === PlasmaCore.Types.Horizontal 0025 0026 property bool restoreZoomIsBlockedFromApplet: false 0027 property int lastParabolicItemIndex: -1 0028 0029 Connections { 0030 target: parabolic 0031 onRestoreZoomIsBlockedChanged: { 0032 if (!parabolic.restoreZoomIsBlocked) { 0033 parabolic.startRestoreZoomTimer(); 0034 } else { 0035 parabolic.stopRestoreZoomTimer(); 0036 } 0037 0038 } 0039 0040 onCurrentParabolicItemChanged: { 0041 if (!currentParabolicItem) { 0042 parabolic.startRestoreZoomTimer(); 0043 } else { 0044 parabolic.stopRestoreZoomTimer(); 0045 } 0046 } 0047 } 0048 0049 Connections{ 0050 target: parabolic.view && parabolic.view.visibility ? parabolic.view.visibility : root 0051 ignoreUnknownSignals : true 0052 onContainsMouseChanged: { 0053 if (!parabolic.view.visibility.containsMouse && !restoreZoomTimer.running) { 0054 parabolic.startRestoreZoomTimer() 0055 } 0056 } 0057 } 0058 0059 Connections { 0060 target: parabolic.layouts 0061 onContextMenuIsShownChanged: { 0062 if (!parabolic.layouts.contextMenuIsShown && !restoreZoomTimer.running) { 0063 parabolic.startRestoreZoomTimer(); 0064 } 0065 } 0066 } 0067 0068 //! do not update during dragging/moving applets inConfigureAppletsMode 0069 readonly property bool isBindingUpdateEnabled: !(root.dragOverlay && root.dragOverlay.pressed) 0070 0071 Binding{ 0072 target: parabolic 0073 property: "restoreZoomIsBlockedFromApplet" 0074 when: isBindingUpdateEnabled 0075 value: { 0076 var grid; 0077 0078 for (var l=0; l<=2; ++l) { 0079 if (l===0) { 0080 grid = layouts.startLayout; 0081 } else if (l===1) { 0082 grid = layouts.mainLayout; 0083 } else if (l===2) { 0084 grid = layouts.endLayout; 0085 } 0086 0087 for (var i=0; i<grid.children.length; ++i){ 0088 var appletItem = grid.children[i]; 0089 if (appletItem 0090 && appletItem.communicator 0091 && appletItem.communicator.parabolicEffectIsSupported 0092 && appletItem.communicator.bridge.parabolic.client.local.restoreZoomIsBlocked) { 0093 return true; 0094 } 0095 } 0096 } 0097 0098 return false; 0099 } 0100 } 0101 0102 function startRestoreZoomTimer(){ 0103 if (restoreZoomIsBlocked) { 0104 return; 0105 } 0106 0107 restoreZoomTimer.start(); 0108 } 0109 0110 function stopRestoreZoomTimer(){ 0111 if (restoreZoomTimer.running) { 0112 restoreZoomTimer.stop(); 0113 } 0114 } 0115 0116 function setDirectRenderingEnabled(value) { 0117 _privates.directRenderingEnabled = value; 0118 } 0119 0120 function setCurrentParabolicItem(item) { 0121 view.parabolic.currentItem = item; 0122 } 0123 0124 function setCurrentParabolicItemIndex(index) { 0125 if (!directRenderingEnabled 0126 && lastParabolicItemIndex > -1 0127 && index > -1 0128 && Math.abs(lastParabolicItemIndex-index) >=2 ) { 0129 //! rapid movement 0130 setDirectRenderingEnabled(true); 0131 } 0132 0133 lastParabolicItemIndex = index; 0134 } 0135 0136 //! TIMERS 0137 0138 //! Timer to check if the mouse is still outside the latteView in order to restore applets scales to 1.0 0139 Timer{ 0140 id: restoreZoomTimer 0141 interval: 50 0142 0143 onTriggered: { 0144 if (parabolic.restoreZoomIsBlocked || currentParabolicItem) { 0145 return; 0146 } 0147 0148 parabolic.lastParabolicItemIndex = -1; 0149 parabolic.setDirectRenderingEnabled(false); 0150 parabolic.sglClearZoom(); 0151 0152 if (debug.timersEnabled) { 0153 console.log("containment timer: RestoreZoomTimer called..."); 0154 } 0155 } 0156 } 0157 }