From ed432370d4ed6f352509042338cdadefba58eac7 Mon Sep 17 00:00:00 2001
From: shibakaneki <didier@sente.ch>
Date: Mon, 16 Apr 2012 10:07:52 +0200
Subject: [PATCH] Finished the mirroring implementation

---
 src/domain/UBGraphicsDelegateFrame.cpp | 20 +++-----------------
 src/domain/UBGraphicsItemDelegate.cpp  |  1 -
 2 files changed, 3 insertions(+), 18 deletions(-)

diff --git a/src/domain/UBGraphicsDelegateFrame.cpp b/src/domain/UBGraphicsDelegateFrame.cpp
index 990f1b21..bb47e5c6 100644
--- a/src/domain/UBGraphicsDelegateFrame.cpp
+++ b/src/domain/UBGraphicsDelegateFrame.cpp
@@ -446,11 +446,11 @@ void UBGraphicsDelegateFrame::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
         if(!mMirrorX && !mMirrorY){
             ref = delegated()->boundingRect().topLeft();
         }else if(mMirrorX && !mMirrorY){
-            ref = delegated()->boundingRect().topRight();
+            ref = delegated()->boundingRect().topLeft();
         }else if(!mMirrorX && mMirrorY){
-            ref = delegated()->boundingRect().bottomLeft();
+            ref = delegated()->boundingRect().topLeft();
         }else if(mMirrorX && mMirrorY){
-            ref = delegated()->boundingRect().bottomRight();
+            ref = delegated()->boundingRect().topRight();
         }
 
         // Map the item topleft point to the current mouse move transform
@@ -578,8 +578,6 @@ void UBGraphicsDelegateFrame::setVisible(bool visible)
 
 void UBGraphicsDelegateFrame::positionHandles()
 {
-    // TODO: Check why the height is modified if the user rotates the item more than 90°
-
     QRectF itemRect = delegated()->boundingRect();
     QTransform itemTransform = delegated()->sceneTransform();
     QPointF topLeft = itemTransform.map(itemRect.topLeft());
@@ -619,7 +617,6 @@ void UBGraphicsDelegateFrame::positionHandles()
 
     if (mVisible)
     {
-        qDebug() << center.y();
         setRect(center.x() - mFrameWidth - width / 2, center.y() - mFrameWidth - h / 2, width + 2 * mFrameWidth, h + 2 * mFrameWidth);
     }
     else
@@ -711,38 +708,30 @@ UBGraphicsDelegateFrame::FrameTool UBGraphicsDelegateFrame::toolFromPos(QPointF
         return ResizeBottomRight;
     else if (bottomResizeGripRect().contains(pos)){
             if(mMirrorY){
-                qDebug() << "Top";
                 return ResizeTop;
             }else{
-                qDebug() << "Bottom";
                 return ResizeBottom;
             }
         }
     else if (leftResizeGripRect().contains(pos)){
             if(mMirrorX){
-                qDebug() << "Right";
                 return ResizeRight;
             }else{
-                qDebug() << "Left";
                 return ResizeLeft;
             }
             return ResizeLeft;
         }
     else if (rightResizeGripRect().contains(pos)){
             if(mMirrorX){
-                qDebug() << "Left";
                 return ResizeLeft;
             }else{
-                qDebug() << "Right";
                 return ResizeRight;
             }
         }
     else if (topResizeGripRect().contains(pos)){
             if(mMirrorY){
-                qDebug() << "Bottom";
                 return ResizeBottom;
             }else{
-                qDebug() << "Top";
                 return ResizeTop;
             }
         }
@@ -796,11 +785,8 @@ void UBGraphicsDelegateFrame::refreshGeometry()
     QPointF topLeft = itemTransform.map(itemRect.topLeft());
     QPointF topRight = itemTransform.map(itemRect.topRight());
     QPointF bottomLeft = itemTransform.map(itemRect.bottomLeft());
-    QPointF center = itemTransform.map(itemRect.center());
-
 
     QLineF topLine(topLeft, topRight);
-    qreal angle = topLine.angle();
     qreal width = topLine.length();
     QLineF leftLine(topLeft, bottomLeft);
     qreal height = leftLine.length();
diff --git a/src/domain/UBGraphicsItemDelegate.cpp b/src/domain/UBGraphicsItemDelegate.cpp
index 778068c8..0c642de4 100644
--- a/src/domain/UBGraphicsItemDelegate.cpp
+++ b/src/domain/UBGraphicsItemDelegate.cpp
@@ -499,7 +499,6 @@ void UBGraphicsItemDelegate::updateMenuActionState()
     }
 }
 
-
 void UBGraphicsItemDelegate::showMenu()
 {
     if (!mMenu)