Commit 40be77a0 authored by David Redondo's avatar David Redondo 🏎
Browse files

Fix drag directions for top and right panels

We can use a dragHandler and depending on the edge and direction  do the right
thing. By taking over from anything but not alowwing taking over the DragHandler
in the style doesn't interfere with us.
BUG:429063


(cherry picked from commit bca6d228)
parent e8d466eb
......@@ -16,7 +16,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA.
*/
import QtQuick 2.0
import QtQuick 2.15
import QtQuick.Controls 2.5 as QQC2
import QtQuick.Layouts 1.0
import org.kde.plasma.components 2.0 as PlasmaComponents
......@@ -142,6 +142,34 @@ Item {
break;
}
}
DragHandler {
property int magnitude: units.gridUnit
target: null
xAxis.enabled: panel.location == PlasmaCore.Types.LeftEdge || panel.location == PlasmaCore.Types.RightEdge
yAxis.enabled: panel.location == PlasmaCore.Types.TopEdge || panel.location == PlasmaCore.Types.BottomEdge
grabPermissions: PointerHandler.CanTakeOverFromAnything
onTranslationChanged: {
var distance
switch (panel.location) {
case PlasmaCore.Types.TopEdge:
distance = translation.y
break;
case PlasmaCore.Types.LeftEdge:
distance = translation.x
break;
case PlasmaCore.Types.RightEdge:
distance = -translation.x
break;
case PlasmaCore.Types.BottomEdge:
default:
distance = -translation.y
break;
}
parent.value = parent.value + (Math.floor(distance / magnitude) * parent.stepSize)
parent.valueModified()
}
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment