1
0
mirror of https://github.com/KDE/latte-dock.git synced 2024-12-25 19:21:41 +03:00

introduce PrabolicEffect Ability for applets

This commit is contained in:
Michail Vourlakos 2020-05-06 11:43:02 +03:00
parent cfd79ae713
commit b1ce98e8a4
19 changed files with 308 additions and 285 deletions

View File

@ -48,6 +48,11 @@ ContainerAbility.ParabolicEffect {
ignoreUnknownSignals : true
onContainsMouseChanged: {
if (!parabolic.view.visibility.containsMouse && !restoreZoomTimer.running) {
//! applets context menus is a good example that restoreZoomIsBlocked of host should track down
//! all clients restoreZoomIsBlocked properties ??
//! OR it must be tracked down why in multi-clients environment releasing
//! parabolic effect is not applied when the user rapid moves the mouse
//! between multiple parabolic clients/applets
parabolic.startRestoreZoomTimer()
}
}

View File

@ -121,7 +121,7 @@ Item{
readonly property Item metrics: appletItem.metrics.publicApi
readonly property AbilityBridge.ParabolicEffect parabolic: AbilityBridge.ParabolicEffect {
host: appletItem.parabolic.publicApi
host: appletItem.parabolic
appletIndex: index
}

View File

@ -27,10 +27,18 @@ AbilityDefinition.ParabolicEffect {
readonly property bool isActive: bridge !== null
factor: ref.parabolic.factor
directRenderingEnabled: ref.parabolic.directRenderingEnabled
lastIndex: local.lastIndex /*special property that needs to remain the same*/
restoreZoomIsBlocked: bridge ? (bridge.parabolic.host.restoreZoomIsBlocked || local.restoreZoomIsBlocked) : local.restoreZoomIsBlocked
readonly property AbilityDefinition.ParabolicEffect local: AbilityDefinition.ParabolicEffect {}
//! private properties can not go to definition because can not be made readonly in there
//! special care must be taken in order to be redefined in local properties
readonly property bool directRenderingEnabled: ref.parabolic._privates.directRenderingEnabled
readonly property int lastIndex: local._privates.lastIndex /*special property that needs to remain the same*/
readonly property AbilityDefinition.ParabolicEffect local: AbilityDefinition.ParabolicEffect {
id: _localref
readonly property bool directRenderingEnabled: _localref._privates.directRenderingEnabled
readonly property int lastIndex: _localref._privates.lastIndex
}
Item {
id: ref

View File

@ -2,4 +2,5 @@ module org.kde.latte.abilities.applets
Animations 0.1 Animations.qml
Metrics 0.1 Metrics.qml
ParabolicEffect 0.1 ParabolicEffect.qml
Requirements 0.1 Requirements.qml

View File

@ -24,12 +24,26 @@ import org.kde.latte.abilities.definitions 0.1 as AbilityDefinition
AbilityDefinition.ParabolicEffect {
id: apis
readonly property bool directRenderingEnabled: _privates.directRenderingEnabled
readonly property int lastIndex: _privates.lastIndex
//! This needs to be rethought and rechecked in order for public api to provide
//! functionality that functionality must already exist in the definition
readonly property Item publicApi: Item {
readonly property alias directRenderingEnabled: apis.directRenderingEnabled
readonly property alias factor: apis.factor
readonly property alias lastIndex: apis.lastIndex
readonly property alias restoreZoomIsBlocked: apis.restoreZoomIsBlocked
signal sglClearZoom();
function startRestoreZoomTimer() {
apis.startRestoreZoomTimer();
}
function stopRestoreZoomTimer() {
apis.stopRestoreZoomTimer();
}
}
Component.onCompleted: {

View File

@ -23,9 +23,7 @@ import "./paraboliceffect" as ParabolicEffectTypes
Item {
property ParabolicEffectTypes.Factor factor: ParabolicEffectTypes.Factor{}
readonly property bool directRenderingEnabled: _privates.directRenderingEnabled
readonly property int lastIndex: _privates.lastIndex
property bool restoreZoomIsBlocked: false
readonly property ParabolicEffectTypes.PrivateProperties _privates: ParabolicEffectTypes.PrivateProperties {}

View File

@ -81,9 +81,6 @@ PlasmaComponents.ContextMenu {
}
function show() {
//trying to use the dragging mechanism in order to not hide the dock
root.disableRestoreZoom = true;
//root.signalDraggingState(true);
loadDynamicLaunchActions(visualParent.m.LauncherUrlWithoutIcon);
// backend.ungrabMouse(visualParent);
openRelative();
@ -95,8 +92,6 @@ PlasmaComponents.ContextMenu {
windowsPreviewDlg.hide("9.4");
}
root.setGlobalDirectRender(false);
if (root.latteView){
root.latteView.hideTooltipLabel();
}
@ -332,9 +327,6 @@ PlasmaComponents.ContextMenu {
if (!changingLayout) {
root.contextMenu = null;
backend.ungrabMouse(visualParent);
//root.signalDraggingState(false);
root.disableRestoreZoom = false;
root.startCheckRestoreZoomTimer();
}
}
@ -1003,7 +995,7 @@ PlasmaComponents.ContextMenu {
icon: "window-close"
onClicked: {
if (root.zoomFactor>1) {
if (parabolic.factor.zoom>1) {
delayWindowRemovalTimer.modelIndex = menu.modelIndex;
delayWindowRemovalTimer.start();
} else {

View File

@ -36,26 +36,16 @@ Item {
property int lastRealTaskIndex: -1
property int countRealTasks: -1
signal sglUpdateLowerItemScale(int delegateIndex, real newScale, real step);
signal sglUpdateHigherItemScale(int delegateIndex, real newScale, real step);
property int lastIndex: -1
Connections{
target: root
onTasksCountChanged: parManager.updateTasksEdgesIndexes();
onHiddenTasksUpdated: parManager.updateTasksEdgesIndexes();
onClearZoomSignal: parManager.lastIndex = -1;
}
Component.onCompleted: {
updateHasInternalSeparator();
updateTasksEdgesIndexes();
root.separatorsUpdated.connect(updateHasInternalSeparator);
parManager.sglUpdateLowerItemScale.connect(sltTrackLowerItemScale);
parManager.sglUpdateHigherItemScale.connect(sltTrackHigherItemScale);
}
Component.onDestruction: {
@ -93,94 +83,6 @@ Item {
hasInternalSeparator = false;
}
function hostRequestUpdateLowerItemScale(newScale, step){
//! function called from host
sglUpdateLowerItemScale(root.tasksCount-1, newScale, step);
}
function hostRequestUpdateHigherItemScale(newScale, step){
//! function called from host
sglUpdateHigherItemScale(0, newScale, step);
}
function sltTrackLowerItemScale(delegateIndex, newScale, step){
//! send update signal to host
if (latteBridge) {
if (delegateIndex === -1) {
latteBridge.parabolic.clientRequestUpdateLowerItemScale(newScale, step);
} else if (newScale === 1 && delegateIndex>=0) {
latteBridge.parabolic.clientRequestUpdateLowerItemScale(1, 0);
}
}
}
function sltTrackHigherItemScale(delegateIndex, newScale, step) {
//! send update signal to host
if (latteBridge) {
if (delegateIndex >= root.tasksCount) {
latteBridge.parabolic.clientRequestUpdateHigherItemScale(newScale, step);
} else if (newScale === 1 && delegateIndex<root.tasksCount) {
latteBridge.parabolic.clientRequestUpdateHigherItemScale(1, 0);
}
}
}
function applyParabolicEffect(index, currentMousePosition, center) {
if (lastIndex === -1) {
root.setGlobalDirectRender(false);
}
lastIndex = index;
var rDistance = Math.abs(currentMousePosition - center);
//check if the mouse goes right or down according to the center
var positiveDirection = ((currentMousePosition - center) >= 0 );
if (Qt.application.layoutDirection === Qt.RightToLeft && !root.vertical) {
positiveDirection = !positiveDirection;
}
var minimumZoom = 1;
//finding the zoom center e.g. for zoom:1.7, calculates 0.35
var zoomCenter = ((root.zoomFactor + minimumZoom)/2) - 1;
//computes the in the scale e.g. 0...0.35 according to the mouse distance
//0.35 on the edge and 0 in the center
var firstComputation = (rDistance / center) * (zoomCenter-minimumZoom+1);
//calculates the scaling for the neighbour tasks
var bigNeighbourZoom = Math.min(1 + zoomCenter + firstComputation, root.zoomFactor);
var smallNeighbourZoom = Math.max(1 + zoomCenter - firstComputation, minimumZoom);
//bigNeighbourZoom = Number(bigNeighbourZoom.toFixed(4));
//smallNeighbourZoom = Number(smallNeighbourZoom.toFixed(4));
var leftScale;
var rightScale;
if(positiveDirection === true){
rightScale = bigNeighbourZoom;
leftScale = smallNeighbourZoom;
} else {
rightScale = smallNeighbourZoom;
leftScale = bigNeighbourZoom;
}
sglUpdateHigherItemScale(index+1 , rightScale, 0);
sglUpdateLowerItemScale(index-1, leftScale, 0);
// console.debug(leftScale + " " + rightScale + " " + index);
return {leftScale:leftScale, rightScale:rightScale};
}
function clearTasksGreaterThan(index) {
}
function clearTasksLowerThan(index) {
}
function neighbourIsHovered(index) {
if (parManager.lastIndex<0)
return;

View File

@ -0,0 +1,198 @@
/*
* 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.plasma.core 2.0 as PlasmaCore
import org.kde.latte.abilities.applets 0.1 as AppletAbility
AppletAbility.ParabolicEffect {
id: parabolic
local.factor.zoom: ( 1 + (plasmoid.configuration.zoomLevel / 20) )
local.factor.maxZoom: Math.max(local.factor.zoom, 1.6)
readonly property bool horizontal: plasmoid.formFactor === PlasmaCore.Types.Horizontal
Component.onCompleted: {
parabolic.sglUpdateLowerItemScale.connect(sltTrackLowerItemScale);
parabolic.sglUpdateHigherItemScale.connect(sltTrackHigherItemScale);
}
Component.onDestruction: {
parabolic.sglUpdateLowerItemScale.disconnect(sltTrackLowerItemScale);
parabolic.sglUpdateHigherItemScale.disconnect(sltTrackHigherItemScale);
}
Connections {
target: parabolic
onSglClearZoom: parabolic.local._privates.lastIndex = -1;
onRestoreZoomIsBlockedChanged: {
if (!parabolic.restoreZoomIsBlocked) {
parabolic.startRestoreZoomTimer();
} else {
parabolic.stopRestoreZoomTimer();
}
}
}
function startRestoreZoomTimer(){
if (restoreZoomIsBlocked) {
return;
}
if (bridge) {
bridge.parabolic.host.startRestoreZoomTimer();
} else {
restoreZoomTimer.start();
}
}
function stopRestoreZoomTimer(){
if (bridge) {
bridge.parabolic.host.stopRestoreZoomTimer();
} else {
restoreZoomTimer.stop();
}
}
function setDirectRenderingEnabled(value) {
if (tasksExtendedManager.waitingLaunchersLength() > 0) {
return;
}
if (bridge) {
bridge.parabolic.host.setDirectRenderingEnabled(value);
} else {
local._privates.directRenderingEnabled = value;
}
}
function hostRequestUpdateLowerItemScale(newScale, step){
//! function called from host
sglUpdateLowerItemScale(root.tasksCount-1, newScale, step);
}
function hostRequestUpdateHigherItemScale(newScale, step){
//! function called from host
sglUpdateHigherItemScale(0, newScale, step);
}
function sltTrackLowerItemScale(delegateIndex, newScale, step){
//! send update signal to host
if (latteBridge) {
if (delegateIndex === -1) {
latteBridge.parabolic.clientRequestUpdateLowerItemScale(newScale, step);
} else if (newScale === 1 && delegateIndex>=0) {
latteBridge.parabolic.clientRequestUpdateLowerItemScale(1, 0);
}
}
}
function sltTrackHigherItemScale(delegateIndex, newScale, step) {
//! send update signal to host
if (latteBridge) {
if (delegateIndex >= root.tasksCount) {
latteBridge.parabolic.clientRequestUpdateHigherItemScale(newScale, step);
} else if (newScale === 1 && delegateIndex<root.tasksCount) {
latteBridge.parabolic.clientRequestUpdateHigherItemScale(1, 0);
}
}
}
function applyParabolicEffect(index, currentMousePosition, center) {
if (parabolic.local._privates.lastIndex === -1) {
setDirectRenderingEnabled(false);
}
//! last item requested calculations
parabolic.local._privates.lastIndex = index;
var rDistance = Math.abs(currentMousePosition - center);
//check if the mouse goes right or down according to the center
var positiveDirection = ((currentMousePosition - center) >= 0 );
if (Qt.application.layoutDirection === Qt.RightToLeft && horizontal) {
positiveDirection = !positiveDirection;
}
//finding the zoom center e.g. for zoom:1.7, calculates 0.35
var zoomCenter = (factor.zoom - 1) / 2
//computes the in the scale e.g. 0...0.35 according to the mouse distance
//0.35 on the edge and 0 in the center
var firstComputation = (rDistance / center) * zoomCenter;
//calculates the scaling for the neighbour tasks
var bigNeighbourZoom = Math.min(1 + zoomCenter + firstComputation, factor.zoom);
var smallNeighbourZoom = Math.max(1 + zoomCenter - firstComputation, 1);
//bigNeighbourZoom = Number(bigNeighbourZoom.toFixed(4));
//smallNeighbourZoom = Number(smallNeighbourZoom.toFixed(4));
var leftScale;
var rightScale;
if(positiveDirection === true){
rightScale = bigNeighbourZoom;
leftScale = smallNeighbourZoom;
}
else {
rightScale = smallNeighbourZoom;
leftScale = bigNeighbourZoom;
}
sglUpdateHigherItemScale(index+1 , rightScale, 0);
sglUpdateLowerItemScale(index-1, leftScale, 0);
return {leftScale:leftScale, rightScale:rightScale};
}
function invkClearZoom() {
if (parabolic.restoreZoomIsBlocked) {
return
}
if (bridge) {
bridge.parabolic.host.sglClearZoom();
} else {
parabolic.sglClearZoom();
}
}
//! TIMERS
//! Timer to check if the mouse is outside the applet in order to restore items scales to 1.0
//! IMPORTANT ::: This timer should be used only when the Latte plasmoid is not inside a Latte dock
Timer{
id: restoreZoomTimer
interval: 90
onTriggered: {
if(parabolic.bridge) {
console.log("Plasmoid, restoreZoomTimer was called, even though it shouldn't...");
}
parabolic.invkClearZoom();
}
}
}

View File

@ -62,9 +62,6 @@ Item {
LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft && !root.vertical
LayoutMirroring.childrenInherit: true
//it is used to check both the applet and the containment for direct render
property bool globalDirectRender: latteView ? latteView.globalDirectRender : icList.directRender
property bool plasma515: latteView ? latteView.plasma515 : LatteCore.Environment.plasmaDesktopVersion >= LatteCore.Environment.makeVersion(5,15,0)
property bool plasma518: latteView ? latteView.plasma518 : LatteCore.Environment.plasmaDesktopVersion >= LatteCore.Environment.makeVersion(5,18,0)
@ -141,6 +138,7 @@ Item {
property Item tasksExtendedManager: _tasksExtendedManager
readonly property alias animations: _animations
readonly property alias metrics: _metrics
readonly property alias parabolic: _parabolic
readonly property alias containsDrag: mouseHandler.containsDrag
readonly property bool dragAreaEnabled: latteView ? (root.dragSource !== null
@ -163,7 +161,7 @@ Item {
property bool dockIsHidden: latteView ? latteView.dockIsHidden : false
property bool groupTasksByDefault: plasmoid.configuration.groupTasksByDefault
property bool highlightWindows: hoverAction === LatteTasks.Types.HighlightWindows || hoverAction === LatteTasks.Types.PreviewAndHighlightWindows
property bool parabolicEffectEnabled: latteView ? latteView.parabolicEffectEnabled : zoomFactor>1 && !root.editMode
property bool parabolicEffectEnabled: latteView ? latteView.parabolicEffectEnabled : parabolic.factor.zoom && !root.editMode
property bool scrollingEnabled: plasmoid.configuration.scrollTasksEnabled
property bool autoScrollTasksEnabled: scrollingEnabled && plasmoid.configuration.autoScrollTasksEnabled
@ -220,10 +218,6 @@ Item {
readonly property real currentPanelOpacity: latteView ? latteView.currentPanelTransparency / 100 : 1
property real maxZoomFactor: latteView ? latteView.maxZoomFactor : Math.max(zoomFactor, animations.maxZoomFactor)
property real zoomFactor: latteView ? latteView.zoomFactor : ( 1 + (plasmoid.configuration.zoomLevel / 20) )
property int appShadowSize: latteView ? latteView.appShadowSize : Math.ceil(0.12*metrics.iconSize)
property string appShadowColor: latteView ? latteView.appShadowColor : "#ff080808"
property string appShadowColorSolid: latteView ? latteView.appShadowColorSolid : "#ff080808"
@ -254,7 +248,6 @@ Item {
Plasmoid.preferredRepresentation: Plasmoid.fullRepresentation
Plasmoid.backgroundHints: PlasmaCore.Types.NoBackground
signal clearZoomSignal();
signal draggingFinished();
signal hiddenTasksUpdated();
signal launchersUpdatedFor(string launcher);
@ -525,11 +518,11 @@ Item {
//! triggered together.
if (containsMouse) {
hidePreviewWinTimer.stop();
root.stopCheckRestoreZoomTimer();
root.setGlobalDirectRender(false);
parabolic.stopRestoreZoomTimer();
parabolic.setDirectRenderingEnabled(false);
} else {
hide(7.3);
root.startCheckRestoreZoomTimer();
parabolic.startRestoreZoomTimer();
}
}
@ -956,6 +949,12 @@ Item {
bridge: latteBridge
}
Ability.ParabolicEffect {
id: _parabolic
bridge: latteBridge
restoreZoomIsBlocked: root.contextMenu || windowsPreviewDlg.visible
}
AppletAbility.Requirements{
id: _requires
bridge: latteBridge
@ -992,42 +991,6 @@ Item {
}
}
//Timer to check if the mouse is still inside the ListView
//IMPORTANT ::: This timer should be used only when the Latte plasmoid
//is not inside a Latte dock
Timer{
id:checkListHovered
interval: 90
property int normalInterval: Math.max(120, 2 * (animations.speedFactor.current * 1.2 * animations.duration.small) + 50)
onTriggered: {
if(root.latteView) {
console.log("Plasmoid, checkListHoveredTimer was called, even though it shouldn't...");
}
root.clearZoom();
interval = normalInterval;
if (latteView && latteView.debugModeTimers) {
console.log("plasmoid timer: checkListHovered called...");
}
}
function startNormal(){
interval = normalInterval;
start();
}
function startDuration( duration){
interval = duration;
start();
}
}
//this timer restores the draggingPhase flag to false
//after a dragging has finished... This delay is needed
//in order to not animate any tasks are added after a
@ -1051,7 +1014,7 @@ Item {
visible: plasmoid.configuration.zoomHelper
property int neededSpace: zoomFactor*metrics.totals.length
property int neededSpace: parabolic.factor.zoom*metrics.totals.length
}
Item{
@ -1164,8 +1127,8 @@ Item {
visible: root.dragAreaEnabled
property int maxSize: ((parabolicManager.lastIndex>=0 || windowPreviewIsShown) && !root.dragSource) ?
(root.zoomFactor * metrics.totals.thickness) + metrics.margin.screenEdge :
property int maxSize: ((parabolic.local.lastIndex>=0 || windowPreviewIsShown) && !root.dragSource) ?
(parabolic.factor.zoom * metrics.totals.thickness) + metrics.margin.screenEdge :
metrics.totals.thickness + metrics.margin.screenEdge
function onlyLaunchersInList(list){
@ -1228,7 +1191,7 @@ Item {
return animations.hasThicknessAnimation ? latteView.maskManager.thicknessNormal : latteView.maskManager.thicknessZoom;
}
return metrics.totals.thickness * root.zoomFactor;
return metrics.totals.thickness * parabolic.factor.zoom;
}
//onCurrentPosChanged: console.log("CP :: "+ currentPos + " icW:"+icList.width + " rw: "+root.width + " w:" +width);
@ -1261,6 +1224,7 @@ Item {
delegate: Task.TaskItem{
animations: _animations
metrics: _metrics
parabolic: _parabolic
requires: _requires
}
@ -1269,8 +1233,6 @@ Item {
property int tasksCount: tasksModel.count
property bool directRender: false
//the duration of this animation should be as small as possible
//it fixes a small issue with the dragging an item to change it's
//position, if the duration is too big there is a point in the
@ -1861,21 +1823,6 @@ Item {
return false;
}
function clearZoom(){
//console.log("Plasmoid clear...");
if (disableRestoreZoom && (root.contextMenu || windowsPreviewDlg.visible)) {
return;
} else {
disableRestoreZoom = false;
}
if (!previewContainsMouse()) {
windowsPreviewDlg.hide(4.2);
}
root.clearZoomSignal();
}
function hasLauncher(url) {
return tasksModel.launcherPosition(url) != -1;
}
@ -1902,37 +1849,6 @@ Item {
dragSource = null;
}
function setGlobalDirectRender(value) {
if (tasksExtendedManager.waitingLaunchersLength() > 0)
return;
if (latteView) {
latteView.setGlobalDirectRender(value);
} else {
icList.directRender = value;
}
}
function startCheckRestoreZoomTimer(duration) {
if (latteView) {
latteView.startCheckRestoreZoomTimer();
} else {
if (duration > 0) {
checkListHovered.startDuration(duration);
} else {
checkListHovered.startNormal();
}
}
}
function stopCheckRestoreZoomTimer() {
if (latteView) {
latteView.stopCheckRestoreZoomTimer();
} else {
checkListHovered.stop();
}
}
///REMOVE
/*function createContextMenu(task) {
var menu = root.contextMenuComponent.createObject(task);

View File

@ -147,7 +147,7 @@ Item{
id: animatedBehavior
enabled: (taskItem.inFastRestoreAnimation || showWindowAnimation.running || restoreAnimation.running
|| root.inActivityChange || taskItem.inRemoveStage)
|| (taskItem.containsMouse && inAttentionAnimation && wrapper.mScale!==root.zoomFactor)
|| (taskItem.containsMouse && inAttentionAnimation && wrapper.mScale!==taskItem.parabolic.factor.zoom)
NumberAnimation{ duration: 3 * taskItem.animationTime }
}

View File

@ -118,12 +118,12 @@ Item{
TitleTooltipParent{
id: titleTooltipParent
thickness: root.zoomFactor * taskItem.metrics.totals.thickness
thickness: taskItem.parabolic.factor.zoom * taskItem.metrics.totals.thickness
}
TitleTooltipParent{
id: previewsTooltipParent
thickness: (root.zoomFactor * taskItem.metrics.totals.thickness) + 1
thickness: (taskItem.parabolic.factor.zoom * taskItem.metrics.totals.thickness) + 1
}
//!
@ -160,7 +160,7 @@ Item{
width: Math.round(newTempSize)
height: Math.round(width)
source: decoration
smooth: root.zoomFactor === 1 ? true : false
smooth: taskItem.parabolic.factor.zoom === 1 ? true : false
providesColors: indicators ? indicators.info.needsIconColors : false
opacity: root.enableShadows
@ -185,7 +185,7 @@ Item{
}
}
property int zoomedSize: root.zoomFactor * taskItem.metrics.iconSize
property int zoomedSize: taskItem.parabolic.factor.zoom * taskItem.metrics.iconSize
property real basicScalingWidth : wrapper.inTempScaling ? (taskItem.metrics.iconSize * wrapper.scaleWidth) :
taskItem.metrics.iconSize * wrapper.mScale
@ -509,7 +509,7 @@ Item{
//! HACK TO AVOID PIXELIZATION
//! WORKAROUND: When Effects are enabled e.g. BrightnessContrast, Colorize etc.
//! the icon appears pixelated. It is even most notable when zoomFactor === 1
//! the icon appears pixelated. It is even most notable when parabolic.factor.zoom === 1
//! I don't know enabling cached=true helps, but it does.
cached: true
@ -530,7 +530,7 @@ Item{
//! HACK TO AVOID PIXELIZATION
//! WORKAROUND: When Effects are enabled e.g. BrightnessContrast, Colorize etc.
//! the icon appears pixelated. It is even most notable when zoomFactor === 1
//! the icon appears pixelated. It is even most notable when parabolic.factor.zoom === 1
//! I don't know enabling cached=true helps, but it does.
cached: true
@ -552,7 +552,7 @@ Item{
//! HACK TO AVOID PIXELIZATION
//! WORKAROUND: When Effects are enabled e.g. BrightnessContrast, Colorize etc.
//! the icon appears pixelated. It is even most notable when zoomFactor === 1
//! the icon appears pixelated. It is even most notable when parabolic.factor.zoom === 1
//! I don't know enabling cached=true helps, but it does.
cached: true
@ -576,7 +576,7 @@ Item{
//! HACK TO AVOID PIXELIZATION
//! WORKAROUND: When Effects are enabled e.g. BrightnessContrast, Colorize etc.
//! the icon appears pixelated. It is even most notable when zoomFactor === 1
//! the icon appears pixelated. It is even most notable when parabolic.factor.zoom === 1
//! I don't know enabling cached=true helps, but it does.
cached: true
@ -666,16 +666,16 @@ Item{
SequentialAnimation{
ScriptAction{
script: {
root.setGlobalDirectRender(false);
taskItem.inBlockingAnimation = true;
root.clearZoom();
taskItem.parabolic.startRestoreZoomTimer();
taskItem.parabolic.setDirectRenderingEnabled(false);
}
}
PropertyAnimation {
target: wrapper
property: "mScale"
to: 1 + ((root.zoomFactor - 1) / 3)
to: 1 + ((taskItem.parabolic.factor.zoom - 1) / 3)
duration: isDraggedTransition.speed / 2
easing.type: Easing.OutQuad
}
@ -710,15 +710,6 @@ Item{
onRunningChanged: {
if(running){
taskItem.animationStarted();
//root.animations++;
parabolicManager.clearTasksGreaterThan(index);
parabolicManager.clearTasksLowerThan(index);
if (latteView){
latteView.parabolicManager.clearAppletsGreaterThan(latteView.latteAppletPos);
latteView.parabolicManager.clearAppletsLowerThan(latteView.latteAppletPos);
}
}
}
},
@ -731,7 +722,7 @@ Item{
SequentialAnimation{
ScriptAction{
script: {
root.setGlobalDirectRender(false);
taskItem.parabolic.setDirectRenderingEnabled(false);
}
}
@ -778,7 +769,7 @@ Item{
onRunningChanged: {
if(!running){
var halfZoom = 1 + ((root.zoomFactor - 1) / 2);
var halfZoom = 1 + ((taskItem.parabolic.factor.zoom - 1) / 2);
wrapper.calculateScales(taskItem.metrics.totals.thickness/2);

View File

@ -139,11 +139,9 @@ MouseArea{
property bool isWindow: (IsWindow === true) ? true : false
property bool isZoomed: false
property bool blockClearZoom: root.contextMenu
property bool canPublishGeometries: (isWindow || isStartup || isGroupParent) && visible && width>=taskItem.metrics.iconSize && height>=taskItem.metrics.iconSize
&& !taskItem.delayingRemove
&& (wrapper.mScale===1 || wrapper.mScale===root.zoomFactor) //don't publish during zoomFactor
&& (wrapper.mScale===1 || wrapper.mScale===taskItem.parabolic.factor.zoom) //don't publish during zoom animation
property bool pressed: false
property bool wheelIsBlocked: false
@ -183,6 +181,7 @@ MouseArea{
//abilities
property Item animations: null
property Item metrics: null
property Item parabolic: null
property Item requires: null
onModelLauncherUrlChanged: {
@ -617,11 +616,11 @@ MouseArea{
///////////////// Mouse Area Events ///////////////////
onEntered: {
root.stopCheckRestoreZoomTimer();
taskItem.parabolic.stopRestoreZoomTimer();
restoreAnimation.stop();
if ((parabolicManager.lastIndex !== itemIndex) && isLauncher && windowsPreviewDlg.visible) {
if ((taskItem.parabolic.local.lastIndex !== itemIndex) && isLauncher && windowsPreviewDlg.visible) {
windowsPreviewDlg.hide(1);
}
@ -666,8 +665,8 @@ MouseArea{
root.hidePreview(17.5);
}
if (root.zoomFactor>1 && !blockClearZoom){
root.startCheckRestoreZoomTimer();
if (taskItem.parabolic.factor.zoom>1){
taskItem.parabolic.startRestoreZoomTimer();
}
}
@ -684,14 +683,14 @@ MouseArea{
}
if((inAnimation == false)&&(!root.taskInAnimation)&&(!root.disableRestoreZoom) && hoverEnabled){
var rapidMovement = parabolicManager.lastIndex>=0 && Math.abs(parabolicManager.lastIndex-itemIndex)>1;
var rapidMovement = taskItem.parabolic.local.lastIndex>=0 && Math.abs(taskItem.parabolic.local.lastIndex-itemIndex)>1;
if (rapidMovement) {
root.setGlobalDirectRender(true);
taskItem.parabolic.setDirectRenderingEnabled(true);
}
if( ((wrapper.mScale == 1 || wrapper.mScale === root.zoomFactor) && !root.globalDirectRender)
|| root.globalDirectRender || !scalesUpdatedOnce) {
if( ((wrapper.mScale == 1 || wrapper.mScale === taskItem.parabolic.factor.zoom) && !taskItem.parabolic.directRenderingEnabled)
|| taskItem.parabolic.directRenderingEnabled || !scalesUpdatedOnce) {
if(root.dragSource == null){
var step = Math.abs(icList.currentSpot-mousePos);
if (step >= taskItem.animations.hoverPixelSensitivity){
@ -981,7 +980,7 @@ MouseArea{
inAnimation = false;
}
function clearZoom(){
function sltClearZoom(){
restoreAnimation.start();
}
@ -1235,7 +1234,7 @@ MouseArea{
function slotMimicEnterForParabolic(){
if (containsMouse) {
if (inMimicParabolicAnimation) {
mimicParabolicScale = root.zoomFactor;
mimicParabolicScale = taskItem.parabolic.factor.zoom;
}
wrapper.calculateScales(icList.currentSpot);
@ -1473,12 +1472,13 @@ MouseArea{
Component.onCompleted: {
root.draggingFinished.connect(handlerDraggingFinished);
root.clearZoomSignal.connect(clearZoom);
root.publishTasksGeometries.connect(slotPublishGeometries);
root.showPreviewForTasks.connect(slotShowPreviewForTasks);
root.mimicEnterForParabolic.connect(slotMimicEnterForParabolic);
root.launchersUpdatedFor.connect(slotLaunchersChangedFor);
parabolic.sglClearZoom.connect(sltClearZoom);
var hasShownLauncher = ((tasksModel.launcherPosition(taskItem.launcherUrl) !== -1)
|| (tasksModel.launcherPosition(taskItem.launcherUrlWithIcon) !== -1) );
@ -1503,12 +1503,13 @@ MouseArea{
Component.onDestruction: {
root.draggingFinished.disconnect(handlerDraggingFinished);
root.clearZoomSignal.disconnect(clearZoom);
root.publishTasksGeometries.disconnect(slotPublishGeometries);
root.showPreviewForTasks.disconnect(slotShowPreviewForTasks);
root.mimicEnterForParabolic.disconnect(slotMimicEnterForParabolic);
root.launchersUpdatedFor.disconnect(slotLaunchersChangedFor);
parabolic.sglClearZoom.disconnect(sltClearZoom);
tasksExtendedManager.waitingLauncherRemoved.disconnect(slotWaitingLauncherRemoved);
wrapper.sendEndOfNeedBothAxisAnimation();

View File

@ -64,8 +64,8 @@ Item{
}
}
property int maxThickness: !root.vertical ? root.zoomFactor*(taskItem.metrics.iconSize+root.heightMargins)
: root.zoomFactor*(taskItem.metrics.iconSize+root.widthMargins)
property int maxThickness: !root.vertical ? taskItem.parabolic.factor.zoom*(taskItem.metrics.iconSize+root.heightMargins)
: taskItem.parabolic.factor.zoom*(taskItem.metrics.iconSize+root.widthMargins)
property real showDelegateWidth: basicScalingWidth
property real showDelegateHeight: basicScalingHeight
@ -122,7 +122,7 @@ Item{
Behavior on mScale {
id: animatedBehavior
enabled: !root.globalDirectRender || inMimicParabolicAnimation || restoreAnimation.running
enabled: !taskItem.parabolic.directRenderingEnabled || inMimicParabolicAnimation || restoreAnimation.running
NumberAnimation{
duration: 3 * taskItem.animationTime
easing.type: Easing.OutCubic
@ -157,13 +157,13 @@ Item{
}
function calculateScales( currentMousePosition ){
if (root.zoomFactor===1) {
if (taskItem.parabolic.factor.zoom===1) {
return;
}
if (root.dragSource === null) {
//use the new parabolicManager in order to handle all parabolic effect messages
var scales = parabolicManager.applyParabolicEffect(index, currentMousePosition, center);
//use the new parabolic ability in order to handle all parabolic effect messages
var scales = taskItem.parabolic.applyParabolicEffect(index, currentMousePosition, center);
//Left hiddenSpacer for first task
if(((index === parabolicManager.firstRealTaskIndex )&&(root.tasksCount>0)) && !root.disableLeftSpacer
@ -178,9 +178,9 @@ Item{
}
if (!taskItem.inAttentionAnimation) {
mScale = root.zoomFactor;
mScale = taskItem.parabolic.factor.zoom;
} else {
var subSpacerScale = (root.zoomFactor-1)/2;
var subSpacerScale = (taskItem.parabolic.factor.zoom-1)/2;
hiddenSpacerLeft.nScale = subSpacerScale;
hiddenSpacerRight.nScale = subSpacerScale;
@ -223,10 +223,10 @@ Item{
signalUpdateScale(delegateIndex, newScale, step);
if (newScale > 1) { // clear lower items
parabolicManager.sglUpdateLowerItemScale(delegateIndex-1, 1, 0);
taskItem.parabolic.sglUpdateLowerItemScale(delegateIndex-1, 1, 0);
}
} else {
parabolicManager.sglUpdateLowerItemScale(delegateIndex-1, newScale, step);
taskItem.parabolic.sglUpdateLowerItemScale(delegateIndex-1, newScale, step);
}
} else if ((newScale === 1) && (index < delegateIndex)) {
signalUpdateScale(index, 1, 0);
@ -240,10 +240,10 @@ Item{
signalUpdateScale(delegateIndex, newScale, step);
if (newScale > 1) { // clear lower items
parabolicManager.sglUpdateHigherItemScale(delegateIndex+1, 1, 0); // clear higher items
taskItem.parabolic.sglUpdateHigherItemScale(delegateIndex+1, 1, 0); // clear higher items
}
} else {
parabolicManager.sglUpdateHigherItemScale(delegateIndex+1, newScale, step);
taskItem.parabolic.sglUpdateHigherItemScale(delegateIndex+1, newScale, step);
}
} else if ((newScale === 1) && (index > delegateIndex)) {
signalUpdateScale(index, 1, 0);
@ -259,8 +259,8 @@ Item{
}
onMScaleChanged: {
if ((mScale === root.zoomFactor) && !root.globalDirectRender) {
root.setGlobalDirectRender(true);
if ((mScale === taskItem.parabolic.factor.zoom) && !taskItem.parabolic.directRenderingEnabled) {
taskItem.parabolic.setDirectRenderingEnabled(true);
}
if (inMimicParabolicAnimation){
@ -270,7 +270,7 @@ Item{
inBlockingAnimation = false;
mimicParabolicScale = -1;
} else {
var tempScale = (root.zoomFactor - mScale) / 2;
var tempScale = (taskItem.parabolic.factor.zoom - mScale) / 2;
hiddenSpacerLeft.nScale = tempScale;
hiddenSpacerRight.nScale = tempScale;
@ -290,12 +290,12 @@ Item{
opacity = 1;
}
parabolicManager.sglUpdateLowerItemScale.connect(sltUpdateLowerItemScale);
parabolicManager.sglUpdateHigherItemScale.connect(sltUpdateHigherItemScale);
taskItem.parabolic.sglUpdateLowerItemScale.connect(sltUpdateLowerItemScale);
taskItem.parabolic.sglUpdateHigherItemScale.connect(sltUpdateHigherItemScale);
}
Component.onDestruction: {
parabolicManager.sglUpdateLowerItemScale.disconnect(sltUpdateLowerItemScale);
parabolicManager.sglUpdateHigherItemScale.disconnect(sltUpdateHigherItemScale);
taskItem.parabolic.sglUpdateLowerItemScale.disconnect(sltUpdateLowerItemScale);
taskItem.parabolic.sglUpdateHigherItemScale.disconnect(sltUpdateHigherItemScale);
}
}// Main task area // id:wrapper

View File

@ -28,7 +28,7 @@ SequentialAnimation{
property bool pressed: taskItem.pressed
property int speed: taskItem.animations.speedFactor.current * taskItem.animations.duration.large
property real maxMScale: Math.max(1,root.zoomFactor - (root.zoomFactor - 1) / 2)
property real maxMScale: Math.max(1,taskItem.parabolic.factor.zoom - (taskItem.parabolic.factor.zoom - 1) / 2)
ParallelAnimation{
PropertyAnimation {
@ -41,7 +41,7 @@ SequentialAnimation{
/* PropertyAnimation {
target: wrapper
property: "mScale"
to: root.taskInAnimation ? 1 : Math.max(clickedAnimation.maxMScale, wrapper.mScale - (root.zoomFactor - 1) / 2)
to: root.taskInAnimation ? 1 : Math.max(clickedAnimation.maxMScale, wrapper.mScale - (taskItem.parabolic.factor.zoom - 1) / 2)
duration: clickedAnimation.speed
easing.type: Easing.OutQuad
}*/
@ -58,7 +58,7 @@ SequentialAnimation{
/* PropertyAnimation {
target: wrapper
property: "mScale"
to: root.taskInAnimation ? 1 : root.zoomFactor
to: root.taskInAnimation ? 1 : taskItem.parabolic.factor.zoom
duration: clickedAnimation.speed
easing.type: Easing.OutQuad
}*/

View File

@ -51,7 +51,7 @@ SequentialAnimation{
PropertyAnimation {
target: wrapper
property: (icList.orientation == Qt.Vertical) ? "tempScaleWidth" : "tempScaleHeight"
to: taskItem.containsMouse ? 1+2*(root.maxZoomFactor-1) : 1 + (0.65 * (root.maxZoomFactor-1))
to: taskItem.containsMouse ? 1+2*(taskItem.parabolic.factor.maxZoom-1) : 1 + (0.65 * (taskItem.parabolic.factor.maxZoom-1))
duration: launcherAnimation.speed
easing.type: Easing.OutQuad
}
@ -98,7 +98,7 @@ SequentialAnimation{
tasksExtendedManager.removeWaitingLauncher(taskItem.launcherUrl);
}
root.setGlobalDirectRender(false);
taskItem.parabolic.setDirectRenderingEnabled(false);
clearAnimationsSignals();
taskItem.setBlockingAnimation(false);
@ -123,10 +123,7 @@ SequentialAnimation{
launchedAlready = true;
taskItem.animations.needThickness.addEvent(needThicknessEvent);
root.setGlobalDirectRender(false);
parabolicManager.clearTasksGreaterThan(index);
parabolicManager.clearTasksLowerThan(index);
taskItem.parabolic.setDirectRenderingEnabled(false);
root.noTasksInAnimation++;
taskItem.inBouncingAnimation = true;

View File

@ -108,7 +108,7 @@ SequentialAnimation{
}
function bounceNewWindow(){
//if (isDemandingAttention && !root.dockIsHidden && (root.zoomFactor > 1)){
//if (isDemandingAttention && !root.dockIsHidden && (taskItem.parabolic.factor.zoom > 1)){
if (!root.dockIsHidden && ((taskItem.animations.windowInAttentionEnabled && isDemandingAttention)
|| taskItem.animations.windowAddedInGroupEnabled)){

View File

@ -190,7 +190,7 @@ SequentialAnimation {
//send signal that the launcher is really removing
if (taskItem.inBouncingAnimation) {
tasksExtendedManager.removeWaitingLauncher(taskItem.launcherUrl);
root.setGlobalDirectRender(false);
taskItem.parabolic.setDirectRenderingEnabled(false);
}
}
}

View File

@ -167,7 +167,7 @@ Flickable{
//! boundaries create animation breakage
if (!root.autoScrollTasksEnabled || !contentsExceed || root.tasksCount < 3
|| (task.itemIndex===parabolicManager.lastRealTaskIndex && root.zoomFactor>1)) {
|| (task.itemIndex===parabolicManager.lastRealTaskIndex && parabolic.factor.zoom>1)) {
//last task with parabolic effect breaks the autoscolling behavior
return;
}