1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-01-21 14:03:39 +03:00

fix Fitt's Law for parabolic effect items

--fix Fitt's law for items touching the screen
edge and at the same time using parabolic
effect
This commit is contained in:
Michail Vourlakos 2021-09-11 14:05:00 +03:00
parent 18f1d460bb
commit 985999530e
2 changed files with 19 additions and 14 deletions

View File

@ -20,15 +20,14 @@ Item {
|| (root.myView.alignment !== LatteCore.Types.Justify && appletItem.firstChildOfMainLayout)
|| (root.myView.alignment !== LatteCore.Types.Justify && appletItem.lastChildOfMainLayout)) {
//! Fitts Law on corners
return appletItem.lengthAppletFullMargin;
return destination ? destination.zoomScaleThickness * appletItem.lengthAppletFullMargin : appletItem.lengthAppletFullMargin;
}
return appletItem.lengthAppletPadding;
return destination ? destination.zoomScaleThickness * appletItem.lengthAppletPadding : appletItem.lengthAppletPadding;
}
readonly property bool active: parent ? parent.active : false
Loader{
anchors.fill: parent
active: appletItem.debug.eventsSinkEnabled && active
@ -53,7 +52,8 @@ Item {
width: plasmoid.formFactor === PlasmaCore.Types.Horizontal ? destination.width + 2 * lengthPadding : thickness
height: {
if (plasmoid.formFactor === PlasmaCore.Types.Vertical) {
return lengthPadding;
//! Fitt;s Law consider the spacer also from parabolic effect
return appletItem.firstAppletInContainer ? lengthPadding + hiddenSpacerLeft.height + 1 : lengthPadding;
} else if (plasmoid.location === PlasmaCore.Types.TopEdge) {
return tailThickness;
} else {
@ -79,7 +79,7 @@ Item {
AnchorChanges{
target: topArea;
anchors.horizontalCenter: undefined; anchors.verticalCenter: undefined;
anchors.right: undefined; anchors.left: leftArea.left; anchors.top: leftArea.top; anchors.bottom: undefined;
anchors.right: undefined; anchors.left: leftArea.left; anchors.top: undefined; anchors.bottom: parent.top;
}
}
]
@ -90,7 +90,8 @@ Item {
width: plasmoid.formFactor === PlasmaCore.Types.Horizontal ? destination.width + 2 * lengthPadding : thickness
height: {
if (plasmoid.formFactor === PlasmaCore.Types.Vertical) {
return lengthPadding;
//! Fitt;s Law consider the spacer also from parabolic effect
return appletItem.lastAppletInContainer ? lengthPadding + hiddenSpacerRight.height + 1 : lengthPadding;
} else if (plasmoid.location === PlasmaCore.Types.BottomEdge) {
return tailThickness;
} else {
@ -116,7 +117,7 @@ Item {
AnchorChanges{
target: bottomArea;
anchors.horizontalCenter: undefined; anchors.verticalCenter: undefined;
anchors.right: undefined; anchors.left: leftArea.left; anchors.top: undefined; anchors.bottom: leftArea.bottom;
anchors.right: undefined; anchors.left: leftArea.left; anchors.top: parent.bottom; anchors.bottom: undefined;
}
}
]
@ -127,7 +128,8 @@ Item {
height: plasmoid.formFactor === PlasmaCore.Types.Horizontal ? thickness : destination.height + 2 * lengthPadding
width: {
if (plasmoid.formFactor === PlasmaCore.Types.Horizontal) {
return lengthPadding;
//! Fitt;s Law consider the spacer also from parabolic effect
return appletItem.firstAppletInContainer ? lengthPadding + hiddenSpacerLeft.width + 1 : lengthPadding;
} else if (plasmoid.location === PlasmaCore.Types.LeftEdge) {
return tailThickness;
} else {
@ -143,7 +145,7 @@ Item {
AnchorChanges{
target: leftArea;
anchors.horizontalCenter: undefined; anchors.verticalCenter: undefined;
anchors.right: undefined; anchors.left: bottomArea.left; anchors.top: undefined; anchors.bottom: bottomArea.bottom;
anchors.right: parent.left; anchors.left: undefined; anchors.top: undefined; anchors.bottom: bottomArea.bottom;
}
},
State{
@ -164,7 +166,8 @@ Item {
height: plasmoid.formFactor === PlasmaCore.Types.Horizontal ? thickness : destination.height + 2 * lengthPadding
width: {
if (plasmoid.formFactor === PlasmaCore.Types.Horizontal) {
return lengthPadding;
//! Fitt;s Law consider the spacer also from parabolic effect
return appletItem.lastAppletInContainer ? lengthPadding + hiddenSpacerRight.width + 1 : lengthPadding;
} else if (plasmoid.location === PlasmaCore.Types.RightEdge) {
return tailThickness;
} else {
@ -180,7 +183,7 @@ Item {
AnchorChanges{
target: rightArea;
anchors.horizontalCenter: undefined; anchors.verticalCenter: undefined;
anchors.right: bottomArea.right; anchors.left: undefined; anchors.top: undefined; anchors.bottom: bottomArea.bottom;
anchors.right: undefined; anchors.left: parent.right; anchors.top: undefined; anchors.bottom: bottomArea.bottom;
}
},
State{

View File

@ -464,12 +464,14 @@ Item{
if (appletItem.canFillThickness || appletItem.canFillScreenEdge) {
return 0;
} else if (appletItem.inMarginsArea) {
return appletItem.metrics.marginsArea.marginThickness;
return (wrapper.zoomScaleThickness * appletItem.metrics.marginsArea.marginThickness);
}
return appletItem.metrics.margin.thickness
return (wrapper.zoomScaleThickness * appletItem.metrics.margin.thickness);
}
readonly property real zoomScaleThickness: wrapper.zoomScaleThickness
Binding {
target: _wrapperContainer
property: "_thickness"
@ -642,7 +644,7 @@ Item{
Loader {
id: eventsSinkLoader
anchors.fill: _wrapperContainer
active: !communicator.parabolicEffectIsSupported && !isSeparator && !isSpacer
active: !communicator.parabolicEffectIsSupported && !isSeparator && !isSpacer && !isHidden && !isInternalViewSplitter
//! The following can be added in case EventsSink creates slaginess with parabolic effect
//!(appletItem.lockZoom || !appletItem.parabolic.isEnabled || !appletItem.parabolicEffectIsSupported)