1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-01-13 05:17:48 +03:00

refactor:add Containment.AnimationsAbility

--change/update the animations api in order to
be understandable and easier to maintain/debug
This commit is contained in:
Michail Vourlakos 2020-04-25 14:17:54 +03:00
parent b509589a1c
commit 6a558df10b
22 changed files with 371 additions and 217 deletions

View File

@ -218,7 +218,7 @@ function initializationPhase(availableSpace, sizePerApplet, noOfApplets){
function updateSizeForAppletsInFill() {
if ((!visibilityManager.thickAnimated && !root.inConfigureAppletsMode)
if ((!animations.hasThicknessAnimation && !root.inConfigureAppletsMode)
|| (behaveAsPlasmaPanel && root.inConfigureAppletsMode)) {
// console.log("-------------");
// console.log("s1...");

View File

@ -658,7 +658,7 @@ Window{
}
Text{
text: root.animationsNeedBothAxis
text: animations.needBothAxis.count
}
Text{
@ -666,7 +666,7 @@ Window{
}
Text{
text: root.animationsNeedLength
text: animations.needLength.count
}
Text{
@ -674,7 +674,7 @@ Window{
}
Text{
text: root.animationsNeedThickness
text: animations.needThickness.count
}
Text{

View File

@ -38,8 +38,6 @@ DragDrop.DropArea {
property bool computationsAreValid: false
}
property bool animationSent: false
Connections{
target: root.dragInfo
@ -119,10 +117,7 @@ DragDrop.DropArea {
//! Send signal AFTER the dragging is confirmed otherwise the restore mask signal from animations
//! may not be triggered #408926
if (!animationSent) {
animationSent = true;
slotAnimationsNeedLength(1);
}
animations.needLength.addEvent(dragArea);
if (latteApplet && (dragInfo.onlyLaunchers || dragInfo.isSeparator || !dragInfo.isPlasmoid)) {
if (dragInfo.onlyLaunchers) {
@ -194,10 +189,7 @@ DragDrop.DropArea {
}
onDragLeave: {
if (animationSent) {
animationSent = false;
slotAnimationsNeedLength(-1);
}
animations.needLength.removeEvent(dragArea);
root.addLaunchersMessage = false;
@ -208,10 +200,7 @@ DragDrop.DropArea {
}
onDrop: {
if (animationSent) {
animationSent = false;
slotAnimationsNeedLength(-1);
}
animations.needLength.removeEvent(dragArea);
if (root.ignoreRegularFilesDragging && dragInfo.isTask || dockIsHidden || visibilityManager.inSlidingIn || visibilityManager.inSlidingOut) {
return;

View File

@ -43,7 +43,7 @@ Item{
readonly property bool isShown: (solidBackground.opacity > 0) || (overlayedBackground.opacity > 0)
property int animationTime: 6*root.durationTime*root.shortDuration
property int animationTime: 6*animations.speedFactor.current*animations.shortDuration
property int screenEdgeMargin: root.screenEdgeMarginEnabled ? root.localScreenEdgeMargin - shadowsSvgItem.screenEdgeShadow : 0
@ -688,7 +688,7 @@ Item{
transitions: Transition {
enabled: editModeVisual.plasmaEditMode
AnchorAnimation {
duration: 0.8 * root.animationTime
duration: 0.8 * animations.duration.proposed
easing.type: Easing.OutCubic
}
}

View File

@ -34,7 +34,7 @@ Item{
property QtObject window
property bool debugMagager: Qt.application.arguments.indexOf("--mask") >= 0
property bool debugManager: Qt.application.arguments.indexOf("--mask") >= 0
property bool blockUpdateMask: false
property bool inForceHiding: false //is used when the docks are forced in hiding e.g. when changing layouts
@ -52,7 +52,7 @@ Item{
property int maskFloatedGap: maskIsFloating ? Math.max(0, root.localScreenEdgeMargin - root.panelShadow) : 0
property int animationSpeed: LatteCore.WindowSystem.compositingActive ?
(editModeVisual.inEditMode ? editModeVisual.speed * 0.8 : root.appliedDurationTime * 1.62 * root.longDuration) : 0
(editModeVisual.inEditMode ? editModeVisual.speed * 0.8 : animations.speedFactor.normal * 1.62 * animations.longDuration) : 0
property bool inLocationAnimation: latteView && latteView.positioner && latteView.positioner.inLocationAnimation
property bool inSlidingIn: false //necessary because of its init structure
@ -304,7 +304,7 @@ Item{
if (LatteCore.WindowSystem.compositingActive
&& root.editMode
&& editModeVisual.editAnimationEnded
&& (root.animationsNeedBothAxis === 0 || root.zoomFactor===1) ) {
&& (animations.needBothAxis.count === 0 || root.zoomFactor===1) ) {
return true;
} else {
return false;
@ -450,7 +450,7 @@ Item{
latteView.visibility.hide();
latteView.visibility.isHidden = true;
if (visibilityManager.debugMagager) {
if (visibilityManager.debugManager) {
console.log("hiding animation ended...");
}
@ -466,14 +466,14 @@ Item{
var localX = 0;
var localY = 0;
normalState = ((root.animationsNeedBothAxis === 0) && (root.animationsNeedLength === 0))
|| (latteView.visibility.isHidden && !latteView.visibility.containsMouse && root.animationsNeedThickness == 0);
normalState = ((animations.needBothAxis.count === 0) && (animations.needLength.count === 0))
|| (latteView.visibility.isHidden && !latteView.visibility.containsMouse && animations.needThickness.count === 0);
// debug maskArea criteria
if (debugMagager) {
console.log(root.animationsNeedBothAxis + ", " + root.animationsNeedLength + ", " +
root.animationsNeedThickness + ", " + latteView.visibility.isHidden);
if (debugManager) {
console.log(animations.needBothAxis.count + ", " + animations.needLength.count + ", " +
animations.needThickness.count + ", " + latteView.visibility.isHidden);
if (previousNormalState !== normalState) {
console.log("normal state changed to:" + normalState);
@ -527,7 +527,7 @@ Item{
tempThickness = thicknessNormal;
if (root.animationsNeedThickness > 0) {
if (animations.needThickness.count > 0) {
tempThickness = LatteCore.WindowSystem.compositingActive ? thicknessZoom : thicknessNormal;
}
@ -618,7 +618,9 @@ Item{
tempLength = Screen.height; //screenGeometry.height;
//grow only on length and not thickness
if(root.animationsNeedLength>0 && root.animationsNeedBothAxis === 0) {
var onlyLengthAnimation = (animations.needLength.count>0 && animations.needBothAxis.count === 0);
if(onlyLengthAnimation) {
//this is used to fix a bug with shadow showing when the animation of edit mode
//is triggered
@ -626,7 +628,7 @@ Item{
if (latteView.visibility.isHidden && !slidingAnimationAutoHiddenOut.running ) {
tempThickness = thicknessAutoHidden;
} else if (root.animationsNeedThickness > 0) {
} else if (animations.needThickness.count > 0) {
tempThickness = thicknessZoomOriginal;
}
} else{
@ -865,7 +867,7 @@ Item{
}
onStarted: {
if (manager.debugMagager) {
if (manager.debugManager) {
console.log("hiding animation started...");
}
}
@ -894,7 +896,7 @@ Item{
id: slidingAnimationAutoHiddenIn
PauseAnimation{
duration: manager.inTempHiding && animationsEnabled ? 500 : 0
duration: manager.inTempHiding && animations.active ? 500 : 0
}
PropertyAnimation {
@ -915,7 +917,7 @@ Item{
onStarted: {
latteView.visibility.show();
if (manager.debugMagager) {
if (manager.debugManager) {
console.log("showing animation started...");
}
}
@ -931,7 +933,7 @@ Item{
manager.inTempHiding = false;
autosize.updateIconSize();
if (manager.debugMagager) {
if (manager.debugManager) {
console.log("showing animation ended...");
}

View File

@ -0,0 +1,46 @@
/*
* Copyright 2020 Michail Vourlakos <mvourlakos@gmail.com>
*
* This file is part of Latte-Dock
*
* Latte-Dock is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* Latte-Dock is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.7
AnimationsPrivate {
id: apis
publicApi: Item {
readonly property alias active: apis.active
//! animations tracking
readonly property alias needBothAxis: apis.needBothAxis
readonly property alias needLength: apis.needLength
readonly property alias needThickness: apis.needThickness
//! animations properties
readonly property alias shortDuration: apis.shortDuration
readonly property alias longDuration: apis.longDuration
readonly property alias hasThicknessAnimation: apis.hasThicknessAnimation
readonly property Item duration: apis.duration
readonly property Item speedFactor: apis.speedFactor
//! parabolic effect animations
readonly property alias minZoomFactor: apis.minZoomFactor
readonly property alias hoverPixelSensitivity: apis.hoverPixelSensitivity
}
}

View File

@ -0,0 +1,114 @@
/*
* Copyright 2020 Michail Vourlakos <mvourlakos@gmail.com>
*
* This file is part of Latte-Dock
*
* Latte-Dock is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* Latte-Dock is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.7
import org.kde.plasma.plasmoid 2.0
import org.kde.latte.core 0.2 as LatteCore
import org.kde.latte.private.app 0.1 as LatteApp
import "animations" as AnimationComponents
Ability {
property Item container: null
property Item settings: null
//DEPRECATED
//C1 property bool animationsEnabled: -> active
//C11 property int animationsNeedBothAxis:0 //animations need space in both axes, e.g zooming a task
//C12 property int animationsNeedLength: 0 // animations need length, e.g. adding a task
//C13 property int animationsNeedThickness: 0 // animations need thickness, e.g. bouncing animation
//C8 function slotAnimationsNeedBothAxis(step) { -> events
//C9 function slotAnimationsNeedLength(step) { -> event
//C10 function slotAnimationsNeedThickness(step) { -> events
//C2 property bool thickAnimated: -> hasThicknessAnimation
//C5 property int appliedDurationTime: -> speedFactor.normal
//C7 property int durationTime -> speedFactor.current
//C6 property int animationTime -> duration.proposed
//root.shortDuration -> animations.shortDuration
//root.longDuration -> animations.longDuration
//parabolic
//C3 property int animationStep -> hoverPixelSensitivity
//C4 property int animationsZoomFactor -> minZoomFactor
readonly property bool active: plasmoid.configuration.animationsEnabled && LatteCore.WindowSystem.compositingActive
//! animations tracking
readonly property Item needBothAxis: AnimationComponents.Tracker{}
readonly property Item needLength: AnimationComponents.Tracker{}
readonly property Item needThickness: AnimationComponents.Tracker{}
//! animations properties
readonly property int shortDuration: LatteCore.Environment.shortDuration
readonly property int longDuration: LatteCore.Environment.longDuration
readonly property bool hasThicknessAnimation: (needBothAxis.count>0) || (needThickness.count>0)
readonly property Item duration: Item {
readonly property int proposed: speedFactor.current * 2.8 * longDuration
}
readonly property Item speedFactor: Item {
readonly property real normal: 1.0
readonly property real current: {
if (!active || plasmoid.configuration.durationTime === 0) {
return 0;
}
if (plasmoid.configuration.durationTime === 1 ) {
return 0.75;
} else if (plasmoid.configuration.durationTime === 2) {
return normal;
} else if (plasmoid.configuration.durationTime === 3) {
return 1.15;
}
return normal;
}
}
//! animations related to parabolic effect
/////!!!!!!
property int hoverPixelSensitivity: {
if (!settings || settings.sensitivity === LatteApp.Settings.HighMouseSensitivity) {
return 1;
} else if (settings.sensitivity === LatteApp.Settings.MediumMouseSensitivity) {
return Math.max(3, container.iconSize / 18);
} else if (settings.sensitivity === LatteApp.Settings.LowMouseSensitivity) {
return Math.max(5, container.iconSize / 10);
}
}
property real minZoomFactor : {
if (!active || !LatteCore.WindowSystem.compositingActive) {
return 1;
}
/* if (latteApplet && (animationLauncherBouncing || animationWindowInAttention || animationWindowAddedInGroup)) {
return 1.65;
}*/
return 1;
}
}

View File

@ -53,7 +53,7 @@ Ability {
onIconSizeChanged: {
if (!automaticSizeAnimation) {
automaticSizeAnimation = true;
root.slotAnimationsNeedBothAxis(1);
animations.needBothAxis.addEvent(sizer);
}
}
@ -82,7 +82,7 @@ Ability {
onIconSizeChanged: {
if (((container.iconSize === sizer.iconSize) || (container.iconSize === container.maxIconSize)) && sizer.automaticSizeAnimation){
root.slotAnimationsNeedBothAxis(-1);
animations.needBothAxis.removeEvent(sizer);
sizer.automaticSizeAnimation=false;
}
}

View File

@ -21,6 +21,13 @@ import QtQuick 2.7
import org.kde.plasma.plasmoid 2.0
Ability {
id: privateContainer
property Item animations: null
//! signals
signal iconSizeAnimationEnded();
//! properties
property int iconSize: autosizeEnabled && autosize.iconSize > 0 ?
Math.min(autosize.iconSize, maxIconSize) :
maxIconSize
@ -43,11 +50,11 @@ Ability {
Behavior on iconSize {
enabled: !(root.editMode && root.behaveAsPlasmaPanel)
NumberAnimation {
duration: 0.8 * root.animationTime
duration: 0.8 * animations.duration.proposed
onRunningChanged: {
if (!running) {
delayUpdateMaskArea.start();
privateContainer.iconSizeAnimationEnded();
}
}
}

View File

@ -0,0 +1,40 @@
/*
* Copyright 2020 Michail Vourlakos <mvourlakos@gmail.com>
*
* This file is part of Latte-Dock
*
* Latte-Dock is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* Latte-Dock is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.7
Item {
property int count: 0
property var events: []
function addEvent(event) {
if (events.indexOf(event) < 0) {
events.push(event);
count = count + 1;
}
}
function removeEvent(event) {
var pos = events.indexOf(event);
if (pos >= 0) {
events.splice(pos, 1);
count = count - 1;
}
}
}

View File

@ -45,7 +45,6 @@ Item {
signal mouseReleased(int x, int y, int button);
property bool animationsEnabled: true
property bool animationWasSent: false //protection flag for animation broadcasting
property bool canBeHovered: true
property bool canShowAppletNumberBadge: !isSeparator && !isHidden && !isLattePlasmoid
&& !isSpacer && !isInternalViewSplitter
@ -154,7 +153,7 @@ Item {
readonly property bool isSquare: communicator.overlayLatteIconIsActive
readonly property bool screenEdgeMarginSupported: communicator.requires.screenEdgeMarginSupported
property int animationTime: appliedDurationTime * (1.2 *root.shortDuration)
property int animationTime: animations.speedFactor.normal * (1.2 *animations.shortDuration)
property int hoveredIndex: layoutsContainer.hoveredIndex
property int index: -1
property int maxWidth: root.isHorizontal ? root.height : root.width
@ -292,7 +291,7 @@ Item {
NumberAnimation {
id: translAnim
duration: root.longDuration
duration: animations.longDuration
easing.type: Easing.InOutQuad
target: translation
properties: "x,y"
@ -301,7 +300,7 @@ Item {
Behavior on lengthAppletIntMargin {
NumberAnimation {
duration: 0.8 * root.animationTime
duration: 0.8 * animations.duration.proposed
easing.type: Easing.OutCubic
}
}
@ -507,9 +506,9 @@ Item {
appletItem.latteApplet.latteView = root;
appletItem.latteApplet.forceHidePanel = true;
appletItem.latteApplet.signalAnimationsNeedBothAxis.connect(slotAnimationsNeedBothAxis);
/* appletItem.latteApplet.signalAnimationsNeedBothAxis.connect(slotAnimationsNeedBothAxis);
appletItem.latteApplet.signalAnimationsNeedLength.connect(slotAnimationsNeedLength);
appletItem.latteApplet.signalAnimationsNeedThickness.connect(slotAnimationsNeedThickness);
appletItem.latteApplet.signalAnimationsNeedThickness.connect(slotAnimationsNeedThickness);*/
appletItem.latteApplet.signalPreviewsShown.connect(slotPreviewsShown);
appletItem.latteApplet.clearZoomSignal.connect(titleTooltipDialog.hide);
}
@ -525,10 +524,7 @@ Item {
}
Component.onDestruction: {
if (animationWasSent) {
root.slotAnimationsNeedBothAxis(-1);
animationWasSent = false;
}
animations.needBothAxis.removeEvent(appletItem);
if (isSeparator){
parabolicManager.setSeparator(previousIndex, -1);
@ -549,9 +545,9 @@ Item {
root.destroyInternalViewSplitters.disconnect(slotDestroyInternalViewSplitters);
if (appletItem.latteApplet) {
appletItem.latteApplet.signalAnimationsNeedBothAxis.disconnect(slotAnimationsNeedBothAxis);
/*appletItem.latteApplet.signalAnimationsNeedBothAxis.disconnect(slotAnimationsNeedBothAxis);
appletItem.latteApplet.signalAnimationsNeedLength.disconnect(slotAnimationsNeedLength);
appletItem.latteApplet.signalAnimationsNeedThickness.disconnect(slotAnimationsNeedThickness);
appletItem.latteApplet.signalAnimationsNeedThickness.disconnect(slotAnimationsNeedThickness);*/
appletItem.latteApplet.signalPreviewsShown.disconnect(slotPreviewsShown);
appletItem.latteApplet.clearZoomSignal.disconnect(titleTooltipDialog.hide);
}
@ -817,7 +813,7 @@ Item {
Behavior on opacity {
NumberAnimation {
duration: 1.2 * root.animationTime
duration: 1.2 * animations.duration.proposed
easing.type: Easing.OutCubic
}
}
@ -920,7 +916,7 @@ Item {
radius: container.iconSize/10
opacity: root.addLaunchersMessage ? 1 : 0
backgroundOpacity: 0.75
duration: root.durationTime
duration: animations.speedFactor.current
title: i18n("Tasks Area")
}
@ -1087,7 +1083,7 @@ Item {
if( ((wrapper.zoomScale == 1 || wrapper.zoomScale === root.zoomFactor) && !root.globalDirectRender) || root.globalDirectRender) {
if (root.isHorizontal){
var step = Math.abs(layoutsContainer.currentSpot-mouse.x);
if (step >= root.animationStep){
if (step >= animations.hoverPixelSensitivity){
layoutsContainer.currentSpot = mouse.x;
wrapper.calculateScales(mouse.x);
@ -1095,7 +1091,7 @@ Item {
}
else{
var step = Math.abs(layoutsContainer.currentSpot-mouse.y);
if (step >= root.animationStep){
if (step >= animations.hoverPixelSensitivity){
layoutsContainer.currentSpot = mouse.y;
wrapper.calculateScales(mouse.y);
@ -1201,14 +1197,14 @@ Item {
id: clickedAnimation
alwaysRunToEnd: true
running: appletItem.isSquare && !originalAppletBehavior && appletItem.pressed
&& (root.durationTime > 0) && !indicators.info.providesClickedAnimation
&& (animations.speedFactor.current > 0) && !indicators.info.providesClickedAnimation
ParallelAnimation{
PropertyAnimation {
target: wrapper.clickedEffect
property: "brightness"
to: -0.35
duration: root.longDuration
duration: animations.longDuration
easing.type: Easing.OutQuad
}
}
@ -1217,7 +1213,7 @@ Item {
target: wrapper.clickedEffect
property: "brightness"
to: 0
duration: root.longDuration
duration: animations.longDuration
easing.type: Easing.OutQuad
}
}

View File

@ -160,7 +160,7 @@ Item{
Behavior on opacity {
NumberAnimation {
duration: 0.8 * root.animationTime
duration: 0.8 * animations.duration.proposed
easing.type: Easing.OutCubic
}
}
@ -264,16 +264,10 @@ Item{
if ((zoomScale > 1) && !appletItem.isZoomed) {
appletItem.isZoomed = true;
if (!animationWasSent) {
root.slotAnimationsNeedBothAxis(1);
animationWasSent = true;
}
animations.needBothAxis.addEvent(appletItem);
} else if (zoomScale == 1) {
appletItem.isZoomed = false;
if (animationWasSent) {
root.slotAnimationsNeedBothAxis(-1);
animationWasSent = false;
}
animations.needBothAxis.removeEvent(appletItem);
}
}
@ -677,7 +671,7 @@ Item{
visible: !indicators.info.providesHoveredAnimation
Behavior on opacity {
NumberAnimation { duration: root.durationTime*root.longDuration }
NumberAnimation { duration: animations.speedFactor.current*animations.longDuration }
}
}

View File

@ -114,8 +114,9 @@ Item{
latteView.windowsTracker : null
readonly property Item actions: Actions{}
readonly property Item container: root.container
readonly property Item applet: mainCommunicator.requires
readonly property Item animations: root.animations.publicApi
readonly property Item container: root.container.publicApi
Connections {
target: root

View File

@ -62,8 +62,8 @@ Item{
readonly property real panelOpacity: root.currentPanelOpacity
readonly property color shadowColor: root.appShadowColorSolid
readonly property bool animationsEnabled: root.animationsEnabled
readonly property real durationTime: root.durationTime
readonly property bool animationsEnabled: animations.active
readonly property real durationTime: animations.speedFactor.current
readonly property bool progressVisible: false /*since 0.9.2*/
readonly property real progress: 0 /*since 0.9.2*/

View File

@ -235,7 +235,7 @@ MouseArea {
Timer {
id: hideTimer
interval: root.longDuration * 2
interval: animations.longDuration * 2
onTriggered: {
if (!tooltipMouseArea.containsMouse) {
tooltip.visible = false;
@ -364,7 +364,7 @@ MouseArea {
enabled: !configurationArea.pressed
NumberAnimation {
id: xAnim
duration: root.longDuration
duration: animations.longDuration
easing.type: Easing.InOutQuad
}
}
@ -372,27 +372,27 @@ MouseArea {
id: yAnim
enabled: !configurationArea.pressed
NumberAnimation {
duration: root.longDuration
duration: animations.longDuration
easing.type: Easing.InOutQuad
}
}
Behavior on width {
enabled: !configurationArea.pressed
NumberAnimation {
duration: root.longDuration
duration: animations.longDuration
easing.type: Easing.InOutQuad
}
}
Behavior on height {
enabled: !configurationArea.pressed
NumberAnimation {
duration: root.longDuration
duration: animations.longDuration
easing.type: Easing.InOutQuad
}
}
Behavior on opacity {
NumberAnimation {
duration: root.longDuration
duration: animations.longDuration
easing.type: Easing.InOutQuad
}
}

View File

@ -41,13 +41,12 @@ Item{
readonly property int settingsThickness: settingsOverlay.thickness
property int speed: LatteCore.WindowSystem.compositingActive ? root.appliedDurationTime*3.6*root.longDuration : 10
property int speed: LatteCore.WindowSystem.compositingActive ? animations.speedFactor.normal*3.6*animations.longDuration : 10
property int thickness: visibilityManager.thicknessEditMode + root.editShadow
property int rootThickness: visibilityManager.thicknessZoomOriginal + root.editShadow //- visibilityManager.thicknessEditMode
property int editLength: root.isHorizontal ? (root.behaveAsPlasmaPanel ? root.width - container.maxIconSize/4 : root.width)://root.maxLength) :
(root.behaveAsPlasmaPanel ? root.height - container.maxIconSize/4 : root.height)
property bool animationSent: false
property bool farEdge: (plasmoid.location===PlasmaCore.Types.BottomEdge) || (plasmoid.location===PlasmaCore.Types.RightEdge)
property bool editAnimationEnded: false
property bool editAnimationInFullThickness: false
@ -147,7 +146,7 @@ Item{
Behavior on opacity {
enabled: editVisual.editAnimationEnded
NumberAnimation {
duration: 0.8 * root.animationTime
duration: 0.8 * animations.duration.proposed
easing.type: Easing.OutCubic
}
}
@ -358,10 +357,7 @@ Item{
initializeNormalPosition();
if(!animationSent) {
animationSent = true;
root.slotAnimationsNeedLength(1);
}
animations.needLength.addEvent(editVisual);
}
}
@ -369,7 +365,7 @@ Item{
id: pauseAnimation
//! give the time to CREATE the settings windows and not break
//! the sliding in animation
duration: root.animationsEnabled ? 100 : 0
duration: animations.active ? 100 : 0
}
ParallelAnimation{
@ -419,7 +415,7 @@ Item{
id: pauseAnimation2
//! give the time to DELETE the settings windows and not break
//! the sliding out animation
duration: root.animationsEnabled ? 100 : 0
duration: animations.isActive ? 100 : 0
}
ParallelAnimation{
@ -443,10 +439,7 @@ Item{
script:{
editVisual.inEditMode = false;
editVisual.editAnimationEnded = false;
if (editVisual.animationSent) {
root.slotAnimationsNeedLength(-1);
editVisual.animationSent = false;
}
animations.needLength.removeEvent(editVisual);
//! That part was at the end of the Containers sliding-out animation
//! but it looks much better here

View File

@ -35,7 +35,7 @@ Item{
opacity: root.editMode ? 1 : 0
property int rulerAnimationTime: 0.8 * root.animationTime
property int rulerAnimationTime: 0.8 * animations.duration.proposed
property int thicknessMargin: 0
readonly property bool containsMouse: rulerMouseArea.containsMouse

View File

@ -146,7 +146,7 @@ Item{
if (!animationSent) {
animationSent = true;
slotAnimationsNeedLength(1);
animations.needLength.addEvent(layoutsContainer);
}
layoutsContainer.updateSizeForAppletsInFill();
@ -171,7 +171,7 @@ Item{
if (!animationSent) {
animationSent = true;
slotAnimationsNeedLength(1);
animations.needLength.removeEvent(layoutsContainer);
}
layoutsContainer.updateSizeForAppletsInFill();
@ -260,7 +260,7 @@ Item{
transitions: Transition {
enabled: editModeVisual.plasmaEditMode
AnchorAnimation {
duration: 0.8 * root.animationTime
duration: 0.8 * animations.duration.proposed
easing.type: Easing.OutCubic
}
}
@ -288,6 +288,11 @@ Item{
}
}
Connections {
target: container
onIconSizeAnimationEnded: delayUpdateMaskArea.start();
}
//! This timer is needed in order to reduce the calls to heavy cpu function
//! HeuristicTools.updateSizeForAppletsInFill()
Timer{
@ -295,4 +300,24 @@ Item{
interval: 10
onTriggered: HeuristicTools.updateSizeForAppletsInFill();
}
//! This timer is needed in order to update mask area after ContentsWidth/Height and iconSize changes
Timer{
id:delayUpdateMaskArea
repeat:false;
interval:300;
onTriggered: {
if (layoutsContainer.animationSent) {
animations.needLength.removeEvent(layoutsContainer);
layoutsContainer.animationSent = false;
}
visibilityManager.updateMaskArea();
if (root.debugModeTimers) {
console.log("LayoutsContainer timer: delayUpdateMaskArea called...");
}
}
}
}

View File

@ -56,8 +56,8 @@ Item{
readonly property real panelOpacity: root.currentPanelOpacity
readonly property color shadowColor: root.appShadowColorSolid
readonly property bool animationsEnabled: root.animationsEnabled
readonly property real durationTime: root.durationTime
readonly property bool animationsEnabled: animations.active
readonly property real durationTime: animations.speedFactor.current
readonly property bool progressVisible: false /*since 0.9.2*/
readonly property real progress: 0 /*since 0.9.2*/

View File

@ -251,13 +251,6 @@ Item {
property alias hoveredIndex: layoutsContainer.hoveredIndex
property alias directRenderDelayerIsRunning: directRenderDelayerForEnteringTimer.running
property int animationsNeedBothAxis:0 //animations need space in both axes, e.g zooming a task
property int animationsNeedLength: 0 // animations need length, e.g. adding a task
property int animationsNeedThickness: 0 // animations need thickness, e.g. bouncing animation
readonly property bool thickAnimated: animationsNeedBothAxis>0 || animationsNeedThickness>0
property int animationTime: durationTime*2.8*root.longDuration
property int appletsNeedWindowsTracking: 0
readonly property int minAppletLengthInConfigure: 64
@ -446,7 +439,7 @@ Item {
property int panelUserSetAlignment: plasmoid.configuration.alignment
property real zoomFactor: LatteCore.WindowSystem.compositingActive && root.animationsEnabled ? ( 1 + (plasmoid.configuration.zoomLevel / 20) ) : 1
property real zoomFactor: LatteCore.WindowSystem.compositingActive && animations.active ? ( 1 + (plasmoid.configuration.zoomLevel / 20) ) : 1
readonly property string plasmoidName: "org.kde.latte.plasmoid"
@ -465,6 +458,7 @@ Item {
property Item latteAppletContainer
property Item latteApplet
readonly property Item animations: _animations
readonly property Item autosize: _autosize
readonly property Item container: _container
readonly property Item indicatorsManager: indicators
@ -504,59 +498,11 @@ Item {
readonly property bool hasInternalSeparator: latteApplet ? latteApplet.hasInternalSeparator : false
property int animationStep: {
if (!universalSettings || universalSettings.sensitivity === LatteApp.Settings.HighMouseSensitivity) {
return 1;
} else if (universalSettings.sensitivity === LatteApp.Settings.MediumMouseSensitivity) {
return Math.max(3, container.iconSize / 18);
} else if (universalSettings.sensitivity === LatteApp.Settings.LowMouseSensitivity) {
return Math.max(5, container.iconSize / 10);
}
}
property int latteAppletHoveredIndex: latteApplet ? latteApplet.hoveredIndex : -1
property int tasksCount: latteApplet ? latteApplet.tasksCount : 0
//! Animations
property bool animationsEnabled: plasmoid.configuration.animationsEnabled && LatteCore.WindowSystem.compositingActive
readonly property int shortDuration: LatteCore.Environment.shortDuration
readonly property int longDuration: LatteCore.Environment.longDuration
property real appliedDurationTime: animationsEnabled ? durationTime : animationsSpeed2
readonly property real animationsSpeed1: 0.75
readonly property real animationsSpeed2: 1.00
readonly property real animationsSpeed3: 1.15
property real durationTime: {
if (!animationsEnabled || plasmoid.configuration.durationTime === 0) {
return 0;
}
if (plasmoid.configuration.durationTime === 1 ) {
return animationsSpeed1;
} else if (plasmoid.configuration.durationTime === 2) {
return animationsSpeed2;
} else if (plasmoid.configuration.durationTime === 3) {
return animationsSpeed3;
}
return animationsSpeed2;
}
property real animationsZoomFactor : {
if (!animationsEnabled || !LatteCore.WindowSystem.compositingActive) {
return 1;
}
/* if (latteApplet && (animationLauncherBouncing || animationWindowInAttention || animationWindowAddedInGroup)) {
return 1.65;
}*/
return 1;
}
property real maxZoomFactor: Math.max(zoomFactor, animationsZoomFactor)
property real maxZoomFactor: Math.max(zoomFactor, animations.minZoomFactor)
property rect screenGeometry: latteView ? latteView.screenGeometry : plasmoid.screenGeometry
@ -1284,42 +1230,6 @@ Item {
return false;
}
function slotAnimationsNeedBothAxis(step) {
if (step === 0) {
return;
}
animationsNeedBothAxis = Math.max(animationsNeedBothAxis + step, 0);
visibilityManager.updateMaskArea();
}
function slotAnimationsNeedLength(step) {
if (step === 0) {
return;
}
animationsNeedLength = Math.max(animationsNeedLength + step, 0);
//when need length animations are ended it would be a good idea
//to update the tasks geometries in the plasmoid
if(animationsNeedLength === 0 && latteApplet) {
latteApplet.publishTasksGeometries();
}
visibilityManager.updateMaskArea();
}
function slotAnimationsNeedThickness(step) {
if (step === 0) {
return;
}
animationsNeedThickness = Math.max(animationsNeedThickness + step, 0);
visibilityManager.updateMaskArea();
}
function slotAppletsNeedWindowsTracking(step) {
if (step === 0) {
return;
@ -1823,9 +1733,10 @@ Item {
///////////////BEGIN ABILITIES
Ability.Container{
id: _container
autosize: _autosize
Ability.Animations {
id: _animations
container: _container
settings: universalSettings
}
Ability.AutoSizePrivate {
@ -1835,6 +1746,12 @@ Item {
visibility: visibilityManager
}
Ability.Container {
id: _container
animations: _animations
autosize: _autosize
}
///////////////END ABILITIES
///////////////BEGIN TIMER elements
@ -1869,29 +1786,7 @@ Item {
//! zoom-in animations will have ended.
Timer{
id:directRenderDelayerForEnteringTimer
interval: 3.2 * root.durationTime * root.shortDuration
}
//this is a delayer to update mask area, it is used in cases
//that animations can not catch up with animations signals
//e.g. the automaicIconSize case
Timer{
id:delayUpdateMaskArea
repeat:false;
interval:300;
onTriggered: {
if (layoutsContainer.animationSent) {
root.slotAnimationsNeedLength(-1);
layoutsContainer.animationSent = false;
}
visibilityManager.updateMaskArea();
if (root.debugModeTimers) {
console.log("containment timer: delayUpdateMaskArea called...");
}
}
interval: 3.2 * animations.speedFactor.current * animations.shortDuration
}
//! It is used in order to slide-in the latteView on startup

View File

@ -0,0 +1,47 @@
/*
* Copyright 2020 Michail Vourlakos <mvourlakos@gmail.com>
*
* This file is part of Latte-Dock
*
* Latte-Dock is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* Latte-Dock is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.7
Item {
readonly property bool hasThicknessAnimation: latteBridge ? latteBridge.animations.hasThicknessAnimation : false
//! COntainment properties
readonly property alias active: apis.active
//! animations tracking
readonly property alias needBothAxis: apis.needBothAxis
readonly property alias needLength: apis.needLength
readonly property alias needThickness: apis.needThickness
//! animations properties
readonly property alias shortDuration: apis.shortDuration
readonly property alias longDuration: apis.longDuration
readonly property alias hasThicknessAnimation: apis.hasThicknessAnimation
readonly property Item duration: apis.duration
readonly property Item speedFactor: apis.speedFactor
//! parabolic effect animations
readonly property alias minZoomFactor: apis.minZoomFactor
readonly property alias hoverPixelSensitivity: apis.hoverPixelSensitivity
}

View File

@ -138,6 +138,7 @@ Item {
property Item dragSource: null
property Item parabolicManager: _parabolicManager
property Item tasksExtendedManager: _tasksExtendedManager
readonly property Item animations: _animations
readonly property Item container: _container
readonly property alias containsDrag: mouseHandler.containsDrag
@ -960,6 +961,10 @@ Item {
id: _tasksExtendedManager
}
Ability.Animations {
id: _animations
}
Ability.Container {
id: _container
localIconSize: Math.max(plasmoid.configuration.iconSize, 16)
@ -1237,7 +1242,7 @@ Item {
property int thickness: {
if (latteView) {
return !latteView.thickAnimated ? latteView.maskManager.thicknessNormal : latteView.maskManager.thicknessZoom;
return animations.hasThicknessAnimation ? latteView.maskManager.thicknessNormal : latteView.maskManager.thicknessZoom;
}
return (root.thickMargins + container.iconSize) * root.zoomFactor;