1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-03-21 10:50:30 +03:00

use mouse wheel to activate applets

--when the user has chosen to activate tasks
through mouse wheel and there are applets that
can be hovered, then for these applets the mouse
wheel can be also used to activate/deactivate them.
This commit is contained in:
Michail Vourlakos 2018-03-08 19:55:20 +02:00
parent 42793475c5
commit 2658dce93e

View File

@ -385,7 +385,7 @@ Item {
Connections{
target: root
/* onGlobalDirectRenderChanged:{
/* onGlobalDirectRenderChanged:{
if (root.globalDirectRender && restoreAnimation.running) {
// console.log("CLEAR APPLET SCALE !!!!");
//restoreAnimation.stop();
@ -574,6 +574,7 @@ Item {
//! plasma tooltips are disabled
visible: !container.latteApplet && !lockZoom && canBeHovered && !(container.isSeparator && !root.editMode) //&& (root.zoomFactor>1)
property bool blockWheel: false
property bool fastEnteringFlag: false
property bool pressed: false
@ -711,6 +712,42 @@ Item {
onReleased: {
pressed = false;
}
onWheel: {
if (isSeparator || !root.mouseWheelActions || blockWheel
|| (root.dockIsHidden || root.inSlidingIn || root.inSlidingOut)){
return;
}
var angle = wheel.angleDelta.y / 8;
blockWheel = true;
scrollDelayer.start();
if (angle > 12) {
//positive direction
if (!isExpanded) {
dock.toggleAppletExpanded(applet.id);
}
} else if (angle < -12) {
//negative direction
if (isExpanded) {
dock.toggleAppletExpanded(applet.id);
}
}
}
//! 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: 700
onTriggered: appletMouseArea.blockWheel = false;
}
}
//BEGIN states