From bd2e393d63e936ce3a24d3ab98d2c94aee6ad730 Mon Sep 17 00:00:00 2001 From: shibakaneki Date: Fri, 13 Apr 2012 10:45:03 +0200 Subject: [PATCH] Done autoscal in mirroring --- src/domain/UBGraphicsDelegateFrame.cpp | 15 ++++++++++----- src/domain/UBGraphicsPixmapItem.cpp | 4 ++-- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/domain/UBGraphicsDelegateFrame.cpp b/src/domain/UBGraphicsDelegateFrame.cpp index d6df2c62..990f1b21 100644 --- a/src/domain/UBGraphicsDelegateFrame.cpp +++ b/src/domain/UBGraphicsDelegateFrame.cpp @@ -308,9 +308,12 @@ void UBGraphicsDelegateFrame::mouseMoveEvent(QGraphicsSceneMouseEvent *event) if((qAbs(width * scaleX)) < 2*mFrameWidth){ bool negative = (scaleX < 0)?true:false; if(negative){ - scaleX = -2*mFrameWidth/width; + if(mMirrorX) + scaleX = 2*mFrameWidth/width; + else + scaleX = -2*mFrameWidth/width; }else{ - scaleX = 2*mFrameWidth/width; + scaleX = -1; } } mScaleX = scaleX; @@ -333,11 +336,13 @@ void UBGraphicsDelegateFrame::mouseMoveEvent(QGraphicsSceneMouseEvent *event) if(mDelegate->isFlippable() && qAbs(scaleY) != 0){ if((qAbs(height * scaleY)) < 2*mFrameWidth){ bool negative = (scaleY < 0)?true:false; - //mMirrorY = (negative?mMirrorY:!mMirrorY); if(negative){ - scaleY = -2*mFrameWidth/width; + if(mMirrorY) + scaleY = 2*mFrameWidth/width; + else + scaleY = -2*mFrameWidth/width; }else{ - scaleY = 2*mFrameWidth/width; + scaleY = -1; } } mScaleY = scaleY; diff --git a/src/domain/UBGraphicsPixmapItem.cpp b/src/domain/UBGraphicsPixmapItem.cpp index 9298d775..9e1f635e 100644 --- a/src/domain/UBGraphicsPixmapItem.cpp +++ b/src/domain/UBGraphicsPixmapItem.cpp @@ -29,10 +29,10 @@ UBGraphicsPixmapItem::UBGraphicsPixmapItem(QGraphicsItem* parent) : QGraphicsPixmapItem(parent) { mDelegate = new UBGraphicsItemDelegate(this, 0, true, true); - mDelegate->init(); + //mDelegate->init(); // NOTE: Do not remove this code, I'm just doing a backup of my changes! thx.. - //mDelegate->setFlippable(true); + mDelegate->setFlippable(true); setData(UBGraphicsItemData::ItemLayerType, UBItemLayerType::Object); setTransformationMode(Qt::SmoothTransformation);