1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-08-15 21:49:28 +03:00

improve Attention interaction with parabolic effect

This commit is contained in:
Michail Vourlakos
2017-10-21 23:41:30 +03:00
parent 45e8401bdd
commit 507e42ee08
6 changed files with 76 additions and 49 deletions

View File

@ -200,7 +200,6 @@ Item {
signal clearZoomSignal();
signal draggingFinished();
signal mouseWasEntered(int delegateIndex, bool value);
signal presentWindows(variant winIds);
signal requestLayout;
signal signalActionsBlockHiding(int value);

View File

@ -51,10 +51,14 @@ MouseArea{
if (isSeparator)
return root.vertical ? separatorItem.width : (root.dragSource ? 5+root.iconMargin : 0);
if (root.vertical)
return wrapper.width;
else
if (root.vertical) {
if (!inAttentionAnimation)
return wrapper.width;
else
return wrapper.maxThickness;
} else {
return hiddenSpacerLeft.width+wrapper.width+hiddenSpacerRight.width;
}
}
height: {
@ -64,10 +68,14 @@ MouseArea{
if (isSeparator)
return !root.vertical ? separatorItem.height : (root.dragSource ? 5+root.iconMargin: 0);
if (root.vertical)
if (root.vertical) {
return hiddenSpacerLeft.height + wrapper.height + hiddenSpacerRight.height;
else
wrapper.height;
} else {
if (!inAttentionAnimation)
return wrapper.height;
else
return wrapper.maxThickness;
}
}
acceptedButtons: Qt.LeftButton | Qt.MidButton | Qt.RightButton
@ -102,8 +110,9 @@ MouseArea{
property bool isWindow: (IsWindow === true) ? true : false
property bool isZoomed: false
property bool mouseEntered: false
property bool pressed: false
readonly property bool showAttention: isDemandingAttention && plasmoid.status === PlasmaCore.Types.RequiresAttentionStatus ?
true : false
property int animationTime: root.durationTime * 1.2 * units.shortDuration
property int badgeIndicator: 0 //it is used from external apps
@ -308,7 +317,14 @@ MouseArea{
|| neighbourSeparator) && !isSeparator && !showWindowAnimation.running ?
(2+root.iconMargin/2) : 0
property real nHiddenSize: (nScale > 0) ? (mainItemContainer.spacersMaxSize * nScale) + separatorSpace : separatorSpace
property real nHiddenSize: {
if (!inAttentionAnimation) {
return (nScale > 0) ? (mainItemContainer.spacersMaxSize * nScale) + separatorSpace : separatorSpace;
} else {
return (nScale > 0) ? (root.iconSize * nScale) + separatorSpace : separatorSpace;
}
}
property real nScale: 0
function updateNeighbour() {
@ -353,7 +369,7 @@ MouseArea{
NumberAnimation { duration: 3 * mainItemContainer.animationTime }
}
Rectangle{
/* Rectangle{
width: !root.vertical ? parent.width : 1
height: !root.vertical ? 1 : parent.height
x: root.vertical ? parent.width /2 : 0
@ -361,7 +377,7 @@ MouseArea{
border.width: 1
border.color: "red"
color: "transparent"
}
} */
}
TaskWrapper{ id: wrapper }
@ -385,9 +401,15 @@ MouseArea{
|| neighbourSeparator) && !isSeparator && !showWindowAnimation.running ?
(2+root.iconMargin/2) : 0
property real nHiddenSize: (nScale > 0) ? (mainItemContainer.spacersMaxSize * nScale) + separatorSpace : separatorSpace
property real nScale: 0
property real nHiddenSize: {
if (!inAttentionAnimation) {
return (nScale > 0) ? (mainItemContainer.spacersMaxSize * nScale) + separatorSpace : separatorSpace;
} else {
return (nScale > 0) ? (root.iconSize * nScale) + separatorSpace : separatorSpace;
}
}
property real nScale: 0
function updateNeighbour() {
//index===-1 indicates that this item is removed
@ -433,7 +455,7 @@ MouseArea{
NumberAnimation { duration: 3 * mainItemContainer.animationTime }
}
Rectangle{
/* Rectangle{
width: !root.vertical ? parent.width : 1
height: !root.vertical ? 1 : parent.height
x: root.vertical ? parent.width /2 : 0
@ -441,7 +463,7 @@ MouseArea{
border.width: 1
border.color: "red"
color: "transparent"
}
} */
}
}// Flow with hidden spacers inside
@ -556,12 +578,6 @@ MouseArea{
if((!inAnimation)&&(root.dragSource == null)&&(!root.taskInAnimation) && hoverEnabled){
icList.hoveredIndex = index;
if (!inBlockingAnimation || inAttentionAnimation) {
/*mouseEntered = true;
root.mouseWasEntered(index-2, false);
root.mouseWasEntered(index+2, false);
root.mouseWasEntered(index-1, true);
root.mouseWasEntered(index+1, true);*/
if (icList.orientation == Qt.Horizontal){
icList.currentSpot = mouseX;
wrapper.calculateScales(mouseX);
@ -576,8 +592,6 @@ MouseArea{
// IMPORTANT: This must be improved ! even for small miliseconds it reduces performance
onExited: {
mouseEntered = false;
if (root.latteDock && (!root.showPreviews || (root.showPreviews && isLauncher))){
root.latteDock.hideTooltipLabel();
}
@ -789,7 +803,6 @@ MouseArea{
//positive direction
if (angle > 12) {
if (isLauncher) {
mouseEntered = false;
inWheelAction = true;
wrapper.runLauncherAnimation();
} else if (isGroupParent) {
@ -828,11 +841,6 @@ MouseArea{
///////////////// End Of Mouse Area Events ///////////////////
///// Handlers for Signals /////
function signalMouseWasEntered(nIndex, value){
if( index === nIndex)
mouseEntered = value;
}
function animationStarted(){
// console.log("Animation started: " + index);
inAnimation = true;
@ -868,7 +876,6 @@ MouseArea{
function activateTask() {
if( mainItemContainer.isLauncher){
mouseEntered = false;
wrapper.runLauncherAnimation();
}
else{
@ -1204,7 +1211,6 @@ MouseArea{
///// End of Helper functions ////
Component.onCompleted: {
root.mouseWasEntered.connect(signalMouseWasEntered);
root.draggingFinished.connect(handlerDraggingFinished);
root.clearZoomSignal.connect(clearZoom);
root.publishTasksGeometries.connect(slotPublishGeometries);

View File

@ -65,8 +65,7 @@ Item{
glowFrame.isActiveColor : glowFrame.notActiveColor
roundCorners: true
showAttention: mainItemContainer.isDemandingAttention && plasmoid.status === PlasmaCore.Types.RequiresAttentionStatus ?
true : false
showAttention: mainItemContainer.showAttention
opacity: (!mainItemContainer.hasActive && root.showPreviews
&& windowsPreviewDlg.activeItem && (windowsPreviewDlg.activeItem === mainItemContainer)) ? 0.4 : 1

View File

@ -599,19 +599,11 @@ Item{
Connections{
target: mainItemContainer
onContainsMouseChanged: {
//if (mainItemContainer.containsMouse && newWindowAnimation.running) {
// newWindowAnimation.pause();
// fastRestoreAnimation.start();
//}
}
onIsActiveChanged:{
if (mainItemContainer.isActive && newWindowAnimation.running && mainItemContainer.inAttentionAnimation) {
onShowAttentionChanged:{
if (!mainItemContainer.showAttention && newWindowAnimation.running && mainItemContainer.inAttentionAnimation) {
newWindowAnimation.pause();
fastRestoreAnimation.start();
/*newWindowAnimation.fastRestoreAfterEnd = true;
newWindowAnimation.clear();*/
}
}
}

View File

@ -69,6 +69,8 @@ Item{
//size needed fom the states below icons
//property int statesLineSize: root.statesLineSize
property int addedSpace: root.statesLineSize //7
property int maxThickness: addedSpace + root.zoomFactor*root.iconSize
property real showDelegateWidth: root.vertical ? basicScalingWidth+addedSpace :
basicScalingWidth
property real showDelegateheight: root.vertical ? basicScalingHeight :
@ -76,7 +78,7 @@ Item{
//scales which are used mainly for activating InLauncher
////Scalers///////
property bool inTempScaling: (((tempScaleWidth !== 1) || (tempScaleHeight !== 1) ) && (!mainItemContainer.mouseEntered) )
property bool inTempScaling: ((tempScaleWidth !== 1) || (tempScaleHeight !== 1) )
property real mScale: 1
property real tempScaleWidth: 1
@ -97,14 +99,14 @@ Item{
//property int curIndex: icList.hoveredIndex
// property int index: mainItemContainer.Positioner.index
property real center: !mainItemContainer.inAttentionAnimation ? (width + hiddenSpacerLeft.separatorSpace + hiddenSpacerRight.separatorSpace) / 2 :
(width + hiddenSpacerLeft.width+hiddenSpacerRight.width)
//property real center: (width + hiddenSpacerLeft.separatorSpace + hiddenSpacerRight.separatorSpace) / 2
property real center: (width + hiddenSpacerLeft.nHiddenSize + hiddenSpacerRight.nHiddenSize) / 2
property Item titleTooltipVisualParent: taskIconItem.titleTooltipVisualParent
signal runLauncherAnimation();
/* Rectangle{
/* Rectangle{
anchors.fill: parent
border.width: 1
border.color: "green"
@ -149,8 +151,38 @@ Item{
}
}
//! This is used from bouncing attention animation in order to played correctly
Loader{
id: firstPadding
active: secondIndicator.active && mainItemContainer.inAttentionAnimation
visible: active
sourceComponent: Component{
Item{
width: root.vertical ? wrapper.maxThickness-wrapper.width : 1
height: !root.vertical ? wrapper.maxThickness-wrapper.height : 1
}
}
}
TaskIconItem{ id: taskIconItem}
//! This is used from bouncing attention animation in order to played correctly
Loader{
id: secondPadding
active: firstIndicator.active && mainItemContainer.inAttentionAnimation
visible: active
sourceComponent: Component{
Item{
width: root.vertical ? wrapper.maxThickness-wrapper.width : 1
height: !root.vertical ? wrapper.maxThickness-wrapper.height : 1
}
}
}
Loader{
id: secondIndicator
active: !firstIndicator.active
@ -206,7 +238,7 @@ Item{
}*/
if (mainItemContainer.inAttentionAnimation) {
var subSpacerScale = nScale;
var subSpacerScale = (nScale-1)/2;
hiddenSpacerLeft.nScale = subSpacerScale;
hiddenSpacerRight.nScale = subSpacerScale;
} else {

View File

@ -41,7 +41,6 @@ SequentialAnimation {
ScriptAction{
script:{
root.mouseWasEntered.disconnect(signalMouseWasEntered);
root.draggingFinished.disconnect(handlerDraggingFinished);
root.clearZoomSignal.disconnect(clearZoom);
root.publishTasksGeometries.disconnect(slotPublishGeometries);