From 673a5f4d2d39e8d55f7b87d10bad8709b83e957a Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Thu, 9 Feb 2017 22:51:47 +0200 Subject: [PATCH] improve scale semantics for plasmoid --- plasmoid/contents/ui/TaskDelegate.qml | 30 +++++++++++++------------- plasmoid/contents/ui/TaskGroupItem.qml | 2 +- plasmoid/contents/ui/TaskIconItem.qml | 26 +++++++++++----------- 3 files changed, 29 insertions(+), 29 deletions(-) diff --git a/plasmoid/contents/ui/TaskDelegate.qml b/plasmoid/contents/ui/TaskDelegate.qml index 111d2eea9..319165150 100644 --- a/plasmoid/contents/ui/TaskDelegate.qml +++ b/plasmoid/contents/ui/TaskDelegate.qml @@ -229,15 +229,15 @@ MouseArea{ ////Scalers/////// property bool inTempScaling: (((tempScaleWidth !== 1) || (tempScaleHeight !== 1) ) && (!mainItemContainer.mouseEntered) ) - property real scale: 1; + property real mScale: 1 property real tempScaleWidth: 0 property real tempScaleHeight: 0 - property real scaleWidth: (inTempScaling == true) ? tempScaleWidth : scale - property real scaleHeight: (inTempScaling == true) ? tempScaleHeight : scale + property real scaleWidth: (inTempScaling == true) ? tempScaleWidth : mScale + property real scaleHeight: (inTempScaling == true) ? tempScaleHeight : mScale ///Dont use Math.floor it adds one pixel in animations and creates glitches - property real cleanScaling: root.realSize * scale + property real cleanScaling: root.realSize * mScale property real basicScalingWidth : (inTempScaling == true) ? (root.realSize * scaleWidth) : cleanScaling property real basicScalingHeight : (inTempScaling == true) ? (root.realSize * scaleHeight) : cleanScaling @@ -259,7 +259,7 @@ MouseArea{ color: "transparent" }*/ - Behavior on scale { + Behavior on mScale { NumberAnimation { duration: mainItemContainer.animationTime } } @@ -365,19 +365,19 @@ MouseArea{ hiddenSpacerRight.nScale = rightScale - 1; } - scale = root.zoomFactor; + mScale = root.zoomFactor; } - } //scale + } //nScale function signalUpdateScale(nIndex, nScale, step){ if ((index === nIndex)&&(!mainItemContainer.inAnimation)){ if(nScale >= 0) - scale = nScale + step; + mScale = nScale + step; else - scale = scale + step; - // console.log(index+ ", "+scale); + mScale = mScale + step; + // console.log(index+ ", "+mScale); } } @@ -388,11 +388,11 @@ MouseArea{ } } - onScaleChanged: { - if ((scale > 1) && !mainItemContainer.isZoomed) { + onMScaleChanged: { + if ((mScale > 1) && !mainItemContainer.isZoomed) { mainItemContainer.isZoomed = true; root.signalAnimationsNeedBothAxis(1); - } else if ((scale == 1) && mainItemContainer.isZoomed) { + } else if ((mScale == 1) && mainItemContainer.isZoomed) { sendEndOfNeedBothAxisAnimation(); } } @@ -460,7 +460,7 @@ MouseArea{ if( (distanceFromHovered > 1) || (hoveredIndex < 0)){ if(!isDragged) - wrapper.scale = 1; + wrapper.mScale = 1; hiddenSpacerLeft.nScale = 0; hiddenSpacerRight.nScale = 0; } @@ -727,7 +727,7 @@ MouseArea{ function clearZoom(){ // console.log("Clear zoom: " + index); if (wrapper) - wrapper.scale=1; + wrapper.mScale=1; } function handlerDraggingFinished(){ diff --git a/plasmoid/contents/ui/TaskGroupItem.qml b/plasmoid/contents/ui/TaskGroupItem.qml index 864f8f4b4..692701360 100644 --- a/plasmoid/contents/ui/TaskGroupItem.qml +++ b/plasmoid/contents/ui/TaskGroupItem.qml @@ -78,7 +78,7 @@ Item{ property bool vertical: root.vertical - property real scaleFactor: wrapper.scale + property real scaleFactor: wrapper.mScale function updateInitialSizes(){ if(glowFrame){ diff --git a/plasmoid/contents/ui/TaskIconItem.qml b/plasmoid/contents/ui/TaskIconItem.qml index c854d995f..55a5ba443 100644 --- a/plasmoid/contents/ui/TaskIconItem.qml +++ b/plasmoid/contents/ui/TaskIconItem.qml @@ -224,9 +224,9 @@ Item{ property int zoomedSize: root.zoomFactor * root.iconSize property real basicScalingWidth : wrapper.inTempScaling ? (root.iconSize * wrapper.scaleWidth) : - root.iconSize * wrapper.scale + root.iconSize * wrapper.mScale property real basicScalingHeight : wrapper.inTempScaling ? (root.iconSize * wrapper.scaleHeight) : - root.iconSize * wrapper.scale + root.iconSize * wrapper.mScale property real newTempSize: (wrapper.opacity == 1) ? Math.min(basicScalingWidth, basicScalingHeight) : Math.max(basicScalingWidth, basicScalingHeight) @@ -460,8 +460,8 @@ Item{ } PropertyAnimation { target: wrapper - property: "scale" - to: root.taskInAnimation ? 0.9 : wrapper.scale - (root.zoomFactor - 1) / 2 + property: "mScale" + to: root.taskInAnimation ? 0.9 : wrapper.mScale - (root.zoomFactor - 1) / 2 duration: clickedAnimation.speed easing.type: Easing.OutQuad } @@ -477,7 +477,7 @@ Item{ } PropertyAnimation { target: wrapper - property: "scale" + property: "mScale" to: root.taskInAnimation ? 1 : root.zoomFactor duration: clickedAnimation.speed easing.type: Easing.OutQuad @@ -564,7 +564,7 @@ Item{ PropertyAnimation { target: wrapper - property: "scale" + property: "mScale" to: 1 duration: root.durationTime*launcherAnimation.speed easing.type: Easing.OutQuad @@ -574,7 +574,7 @@ Item{ onStopped: { - //wrapper.scale = 1; + //wrapper.mScale = 1; /* if ( root.noTasksInAnimation>0 ) { root.noTasksInAnimation--; } @@ -610,8 +610,8 @@ Item{ mainItemContainer.setBlockingAnimation(true); } - wrapper.tempScaleWidth = wrapper.scale; - wrapper.tempScaleHeight = wrapper.scale; + wrapper.tempScaleWidth = wrapper.mScale; + wrapper.tempScaleHeight = wrapper.mScale; icList.hoveredIndex = -1; } @@ -719,8 +719,8 @@ Item{ } function init(){ - wrapper.tempScaleWidth = wrapper.scale; - wrapper.tempScaleHeight = wrapper.scale; + wrapper.tempScaleWidth = wrapper.mScale; + wrapper.tempScaleHeight = wrapper.mScale; if(!isDemandingAttention) loops = 2; @@ -876,7 +876,7 @@ Item{ when: ( (mainItemContainer.isDragged) && (!root.editMode) ) // PropertyChanges { target: clickedAnimation; running:false } - PropertyChanges { target: wrapper; scale:1 + ((root.zoomFactor - 1) / 2)} + PropertyChanges { target: wrapper; mScale:1 + ((root.zoomFactor - 1) / 2)} } ] @@ -960,7 +960,7 @@ Item{ PropertyAnimation { target: wrapper - property: "scale" + property: "mScale" to: 1; duration: isDraggedTransition.speed easing.type: Easing.OutQuad