improve scale semantics for plasmoid

v0.6
Michail Vourlakos 8 years ago
parent be69cbe597
commit f79d60fada

@ -229,15 +229,15 @@ MouseArea{
////Scalers/////// ////Scalers///////
property bool inTempScaling: (((tempScaleWidth !== 1) || (tempScaleHeight !== 1) ) && (!mainItemContainer.mouseEntered) ) property bool inTempScaling: (((tempScaleWidth !== 1) || (tempScaleHeight !== 1) ) && (!mainItemContainer.mouseEntered) )
property real scale: 1; property real mScale: 1
property real tempScaleWidth: 0 property real tempScaleWidth: 0
property real tempScaleHeight: 0 property real tempScaleHeight: 0
property real scaleWidth: (inTempScaling == true) ? tempScaleWidth : scale property real scaleWidth: (inTempScaling == true) ? tempScaleWidth : mScale
property real scaleHeight: (inTempScaling == true) ? tempScaleHeight : scale property real scaleHeight: (inTempScaling == true) ? tempScaleHeight : mScale
///Dont use Math.floor it adds one pixel in animations and creates glitches ///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 basicScalingWidth : (inTempScaling == true) ? (root.realSize * scaleWidth) : cleanScaling
property real basicScalingHeight : (inTempScaling == true) ? (root.realSize * scaleHeight) : cleanScaling property real basicScalingHeight : (inTempScaling == true) ? (root.realSize * scaleHeight) : cleanScaling
@ -259,7 +259,7 @@ MouseArea{
color: "transparent" color: "transparent"
}*/ }*/
Behavior on scale { Behavior on mScale {
NumberAnimation { duration: mainItemContainer.animationTime } NumberAnimation { duration: mainItemContainer.animationTime }
} }
@ -365,19 +365,19 @@ MouseArea{
hiddenSpacerRight.nScale = rightScale - 1; hiddenSpacerRight.nScale = rightScale - 1;
} }
scale = root.zoomFactor; mScale = root.zoomFactor;
} }
} //scale } //nScale
function signalUpdateScale(nIndex, nScale, step){ function signalUpdateScale(nIndex, nScale, step){
if ((index === nIndex)&&(!mainItemContainer.inAnimation)){ if ((index === nIndex)&&(!mainItemContainer.inAnimation)){
if(nScale >= 0) if(nScale >= 0)
scale = nScale + step; mScale = nScale + step;
else else
scale = scale + step; mScale = mScale + step;
// console.log(index+ ", "+scale); // console.log(index+ ", "+mScale);
} }
} }
@ -388,11 +388,11 @@ MouseArea{
} }
} }
onScaleChanged: { onMScaleChanged: {
if ((scale > 1) && !mainItemContainer.isZoomed) { if ((mScale > 1) && !mainItemContainer.isZoomed) {
mainItemContainer.isZoomed = true; mainItemContainer.isZoomed = true;
root.signalAnimationsNeedBothAxis(1); root.signalAnimationsNeedBothAxis(1);
} else if ((scale == 1) && mainItemContainer.isZoomed) { } else if ((mScale == 1) && mainItemContainer.isZoomed) {
sendEndOfNeedBothAxisAnimation(); sendEndOfNeedBothAxisAnimation();
} }
} }
@ -460,7 +460,7 @@ MouseArea{
if( (distanceFromHovered > 1) || (hoveredIndex < 0)){ if( (distanceFromHovered > 1) || (hoveredIndex < 0)){
if(!isDragged) if(!isDragged)
wrapper.scale = 1; wrapper.mScale = 1;
hiddenSpacerLeft.nScale = 0; hiddenSpacerLeft.nScale = 0;
hiddenSpacerRight.nScale = 0; hiddenSpacerRight.nScale = 0;
} }
@ -727,7 +727,7 @@ MouseArea{
function clearZoom(){ function clearZoom(){
// console.log("Clear zoom: " + index); // console.log("Clear zoom: " + index);
if (wrapper) if (wrapper)
wrapper.scale=1; wrapper.mScale=1;
} }
function handlerDraggingFinished(){ function handlerDraggingFinished(){

@ -78,7 +78,7 @@ Item{
property bool vertical: root.vertical property bool vertical: root.vertical
property real scaleFactor: wrapper.scale property real scaleFactor: wrapper.mScale
function updateInitialSizes(){ function updateInitialSizes(){
if(glowFrame){ if(glowFrame){

@ -224,9 +224,9 @@ Item{
property int zoomedSize: root.zoomFactor * root.iconSize property int zoomedSize: root.zoomFactor * root.iconSize
property real basicScalingWidth : wrapper.inTempScaling ? (root.iconSize * wrapper.scaleWidth) : 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) : 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) : property real newTempSize: (wrapper.opacity == 1) ? Math.min(basicScalingWidth, basicScalingHeight) :
Math.max(basicScalingWidth, basicScalingHeight) Math.max(basicScalingWidth, basicScalingHeight)
@ -460,8 +460,8 @@ Item{
} }
PropertyAnimation { PropertyAnimation {
target: wrapper target: wrapper
property: "scale" property: "mScale"
to: root.taskInAnimation ? 0.9 : wrapper.scale - (root.zoomFactor - 1) / 2 to: root.taskInAnimation ? 0.9 : wrapper.mScale - (root.zoomFactor - 1) / 2
duration: clickedAnimation.speed duration: clickedAnimation.speed
easing.type: Easing.OutQuad easing.type: Easing.OutQuad
} }
@ -477,7 +477,7 @@ Item{
} }
PropertyAnimation { PropertyAnimation {
target: wrapper target: wrapper
property: "scale" property: "mScale"
to: root.taskInAnimation ? 1 : root.zoomFactor to: root.taskInAnimation ? 1 : root.zoomFactor
duration: clickedAnimation.speed duration: clickedAnimation.speed
easing.type: Easing.OutQuad easing.type: Easing.OutQuad
@ -564,7 +564,7 @@ Item{
PropertyAnimation { PropertyAnimation {
target: wrapper target: wrapper
property: "scale" property: "mScale"
to: 1 to: 1
duration: root.durationTime*launcherAnimation.speed duration: root.durationTime*launcherAnimation.speed
easing.type: Easing.OutQuad easing.type: Easing.OutQuad
@ -574,7 +574,7 @@ Item{
onStopped: { onStopped: {
//wrapper.scale = 1; //wrapper.mScale = 1;
/* if ( root.noTasksInAnimation>0 ) { /* if ( root.noTasksInAnimation>0 ) {
root.noTasksInAnimation--; root.noTasksInAnimation--;
} }
@ -610,8 +610,8 @@ Item{
mainItemContainer.setBlockingAnimation(true); mainItemContainer.setBlockingAnimation(true);
} }
wrapper.tempScaleWidth = wrapper.scale; wrapper.tempScaleWidth = wrapper.mScale;
wrapper.tempScaleHeight = wrapper.scale; wrapper.tempScaleHeight = wrapper.mScale;
icList.hoveredIndex = -1; icList.hoveredIndex = -1;
} }
@ -719,8 +719,8 @@ Item{
} }
function init(){ function init(){
wrapper.tempScaleWidth = wrapper.scale; wrapper.tempScaleWidth = wrapper.mScale;
wrapper.tempScaleHeight = wrapper.scale; wrapper.tempScaleHeight = wrapper.mScale;
if(!isDemandingAttention) if(!isDemandingAttention)
loops = 2; loops = 2;
@ -876,7 +876,7 @@ Item{
when: ( (mainItemContainer.isDragged) && (!root.editMode) ) when: ( (mainItemContainer.isDragged) && (!root.editMode) )
// PropertyChanges { target: clickedAnimation; running:false } // 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 { PropertyAnimation {
target: wrapper target: wrapper
property: "scale" property: "mScale"
to: 1; to: 1;
duration: isDraggedTransition.speed duration: isDraggedTransition.speed
easing.type: Easing.OutQuad easing.type: Easing.OutQuad

Loading…
Cancel
Save