|
|
@ -210,6 +210,9 @@ void UBGraphicsDelegateFrame::mouseMoveEvent(QGraphicsSceneMouseEvent *event) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (resizingBottomRight()) |
|
|
|
if (resizingBottomRight()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
// -----------------------------------------------------
|
|
|
|
|
|
|
|
// ! We want to keep the aspect ratio with this resize !
|
|
|
|
|
|
|
|
// -----------------------------------------------------
|
|
|
|
qreal scaleX = (width + moveX) / width; |
|
|
|
qreal scaleX = (width + moveX) / width; |
|
|
|
qreal scaleY = (height + moveY) / height; |
|
|
|
qreal scaleY = (height + moveY) / height; |
|
|
|
qreal scaleFactor = (scaleX + scaleY) / 2; |
|
|
|
qreal scaleFactor = (scaleX + scaleY) / 2; |
|
|
@ -230,39 +233,56 @@ void UBGraphicsDelegateFrame::mouseMoveEvent(QGraphicsSceneMouseEvent *event) |
|
|
|
mScaleY = scaleY; |
|
|
|
mScaleY = scaleY; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}else if (resizingLeft() || resizingRight()) |
|
|
|
else if (resizingLeft()) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
qreal scaleX = (width - moveX) / width; |
|
|
|
if(width != 0){ |
|
|
|
if (scaleX > 1 || (width * scaleX) > 2 * mFrameWidth) |
|
|
|
qreal scaleX = 0.0; |
|
|
|
{ |
|
|
|
if(resizingLeft()){ |
|
|
|
mScaleX = scaleX; |
|
|
|
scaleX = (width - moveX) / width; |
|
|
|
mTranslateX = moveX; |
|
|
|
}else if(resizingRight()){ |
|
|
|
} |
|
|
|
scaleX = (width + moveX) / width; |
|
|
|
} |
|
|
|
} |
|
|
|
else if (resizingRight()) |
|
|
|
if(mDelegate->isFlippable() && qAbs(scaleX) != 0){ |
|
|
|
{ |
|
|
|
if((width * qAbs(scaleX)) < 2*mFrameWidth){ |
|
|
|
qreal scaleX = (width + moveX) / width; |
|
|
|
bool negative = (scaleX < 0)?true:false; |
|
|
|
if (scaleX > 1 || (width * scaleX) > 2 * mFrameWidth) |
|
|
|
if(negative){ |
|
|
|
{ |
|
|
|
scaleX = -2*mFrameWidth/width; |
|
|
|
mScaleX = scaleX; |
|
|
|
}else{ |
|
|
|
} |
|
|
|
scaleX = 2*mFrameWidth/width; |
|
|
|
} |
|
|
|
} |
|
|
|
else if (resizingTop()) |
|
|
|
} |
|
|
|
{ |
|
|
|
mScaleX = scaleX; |
|
|
|
qreal scaleY = (height - moveY) / height; |
|
|
|
}else if (scaleX > 1 || (width * scaleX) > 2 * mFrameWidth){ |
|
|
|
if (scaleY > 1 || (height * scaleY) > 2 * mFrameWidth) |
|
|
|
mScaleX = scaleX; |
|
|
|
{ |
|
|
|
if(resizingLeft()){ |
|
|
|
mScaleY = scaleY; |
|
|
|
mTranslateX = moveX; |
|
|
|
mTranslateY = moveY; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}else if(resizingTop() || resizingBottom()){ |
|
|
|
else if (resizingBottom()) |
|
|
|
if(height != 0){ |
|
|
|
{ |
|
|
|
qreal scaleY = 0.0; |
|
|
|
qreal scaleY = (height + moveY) / height; |
|
|
|
if(resizingTop()){ |
|
|
|
if (scaleY > 1 || (height * scaleY) > 2 * mFrameWidth) |
|
|
|
scaleY = (height - moveY) / height; |
|
|
|
{ |
|
|
|
}else if(resizingBottom()){ |
|
|
|
mScaleY = scaleY; |
|
|
|
scaleY = (height + moveY) / height; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(mDelegate->isFlippable() && qAbs(scaleY) != 0){ |
|
|
|
|
|
|
|
if((height * qAbs(scaleY)) < 2*mFrameWidth){ |
|
|
|
|
|
|
|
bool negative = (scaleY < 0)?true:false; |
|
|
|
|
|
|
|
if(negative){ |
|
|
|
|
|
|
|
scaleY = -2*mFrameWidth/width; |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
scaleY = 2*mFrameWidth/width; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
mScaleY = scaleY; |
|
|
|
|
|
|
|
}else if (scaleY > 1 || (height * scaleY) > 2 * mFrameWidth) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
mScaleY = scaleY; |
|
|
|
|
|
|
|
mTranslateY = moveY; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|