Fitt's Law improvements for applets

--each applets layout can not identify properly
which applet is the first/last visible from its
contents. This way we can now identify properly
at all cases which applets should remove their
margins in order to follow Fitt's Law at screen
edges. For example when a windows buttons applet
is found at the screen edge and suddently it
hides itself then the next visible applet should
be considered at screen edge and such should remove
its margins in order to touch the screen edge.
pull/9/head
Michail Vourlakos 5 years ago
parent 453ac890ab
commit 5aac422a65

@ -84,8 +84,8 @@ Item {
property bool isSpacer: applet && (applet.pluginName === "org.kde.latte.spacer")
property bool isSystray: applet && (applet.pluginName === "org.kde.plasma.systemtray" || applet.pluginName === "org.nomad.systemtray" )
property bool firstChildOfStartLayout: (index === layoutsContainer.startLayout.beginIndex)
property bool lastChildOfEndLayout: ((index === layoutsContainer.endLayout.beginIndex+layoutsContainer.endLayout.count-1)&&(layoutsContainer.endLayout.count>1))
property bool firstChildOfStartLayout: index === layoutsContainer.startLayout.firstVisibleIndex
property bool lastChildOfEndLayout: index === layoutsContainer.endLayout.lastVisibleIndex
readonly property bool atScreenEdge: {
if (root.isHorizontal) {
@ -106,14 +106,15 @@ Item {
}
//applet is in starting edge
/*property bool startEdge: index < layoutsContainer.endLayout.beginIndex ? (index === 0)&&(layoutsContainer.mainLayout.count > 1) :
(index === layoutsContainer.endLayout.beginIndex)&&(layoutsContainer.endLayout.count > 1)*/
property bool startEdge: (index === layoutsContainer.startLayout.beginIndex) || (index === layoutsContainer.mainLayout.beginIndex) || (index === layoutsContainer.endLayout.beginIndex)
property bool startEdge: (index >=0) &&
((index === layoutsContainer.startLayout.firstVisibleIndex)
|| (index === layoutsContainer.mainLayout.firstVisibleIndex)
|| (index === layoutsContainer.endLayout.firstVisibleIndex))
//applet is in ending edge
property bool endEdge: plasmoid.configuration.panelPosition !== Latte.Types.Justify ? (index === layoutsContainer.mainLayout.beginIndex + layoutsContainer.mainLayout.count - 1)&&(layoutsContainer.mainLayout.count>1) :
(((index === layoutsContainer.startLayout.beginIndex+layoutsContainer.startLayout.count-2)&&(layoutsContainer.startLayout.count>2))
||((index === layoutsContainer.mainLayout.beginIndex+layoutsContainer.mainLayout.count-2)&&(layoutsContainer.mainLayout.count>2))
||((index === layoutsContainer.endLayout.beginIndex+layoutsContainer.endLayout.count-1)&&(layoutsContainer.endLayout.count>1)))
property bool endEdge: (index >=0) &&
((index === layoutsContainer.startLayout.lastVisibleIndex)
|| (index === layoutsContainer.mainLayout.lastVisibleIndex)
|| (index === layoutsContainer.endLayout.lastVisibleIndex))
readonly property bool acceptMouseEvents: applet && !isLattePlasmoid && !originalAppletBehavior && !appletItem.isSeparator && !communicator.parabolicEffectLocked
readonly property bool originalAppletBehavior: (root.zoomFactor === 1 && !lockZoom /*hacky flag to keep Latte behavior*/)
@ -466,8 +467,8 @@ Item {
Component.onDestruction: {
if (animationWasSent) {
root.slotAnimationsNeedBothAxis(-1);
animationWasSent = false;
root.slotAnimationsNeedBothAxis(-1);
animationWasSent = false;
}
if (isSeparator){

@ -91,6 +91,57 @@ Grid {
return no;
}
property int firstVisibleIndex: -1
property int lastVisibleIndex: -1
Binding{
target: appletsContainer
property:"firstVisibleIndex"
when: appletsContainer
value: {
if (root.inConfigureAppletsMode) {
return;
}
var ind = -1;
for (var i=0; i>=children[i].length-1; ++i){
if (children[i]
&& (children[i].index<ind || ind === -1)
&& children[i].applet
&& !children[i].isHidden
&& !children[i].isInternalViewSplitter) {
ind = children[i].index;
}
}
return ind;
}
}
Binding{
target: appletsContainer
property:"lastVisibleIndex"
when: appletsContainer
value: {
if (root.inConfigureAppletsMode) {
return;
}
var ind = -1;
for (var i=children.length-1; i>=0; --i){
if (children[i]
&& children[i].index>ind
&& children[i].applet
&& !children[i].isHidden
&& !children[i].isInternalViewSplitter) {
ind = children[i].index;
}
}
return ind;
}
}
onCountChanged: {
if (root.editMode) {
//! this is mainly used when removing/adding internal view splitters

Loading…
Cancel
Save