From 88cd15af63d49cee90dbb3f203357775a2dd6251 Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Sat, 18 Jan 2020 20:27:28 +0200 Subject: [PATCH] add a mouse wheel delayer for EmtpyAreas --add a mouse wheel delayer like in other Latte MouseArea(s) in order to limit the actions executed through mouse wheel in one second. The user can now execute five actions at maximum in one second. --- .../ui/layouts/EnvironmentActions.qml | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/containment/package/contents/ui/layouts/EnvironmentActions.qml b/containment/package/contents/ui/layouts/EnvironmentActions.qml index 1318321cc..39ee61f5e 100644 --- a/containment/package/contents/ui/layouts/EnvironmentActions.qml +++ b/containment/package/contents/ui/layouts/EnvironmentActions.qml @@ -47,6 +47,8 @@ Loader { return useAllLayouts ? root.maxLength : root.realPanelLength; } + property bool wheelIsBlocked: false + hoverEnabled: true readonly property bool useAllLayouts: panelUserSetAlignment === Latte.Types.Justify && !root.inConfigureAppletsMode @@ -113,11 +115,18 @@ Loader { } onWheel: { + if (wheelIsBlocked) { + return; + } + if (root.scrollAction === Latte.Types.ScrollNone) { root.emptyAreasWheel(wheel); return; } + wheelIsBlocked = true; + scrollDelayer.start(); + var delta = 0; if (wheel.angleDelta.y>=0 && wheel.angleDelta.x>=0) { @@ -194,6 +203,17 @@ Loader { } } + //! A timer is needed in order to handle also touchpads that probably + //! send too many signals very fast. This way the signals per sec are limited. + //! The user needs to have a steady normal scroll in order to not + //! notice a annoying delay + Timer{ + id: scrollDelayer + + interval: 200 + onTriggered: mainArea.wheelIsBlocked = false; + } + //! Background Indicator Indicator.Bridge{ id: indicatorBridge