SANKORE-599

When it rotates with the tool bracket gestures to change its size are not consistent. The parameters of size change does not take into account the position of the bracket.
SANKORE-598
Changing the size of the bracket using the angles opposite the right angle does not work all the time, we must rotate the bracket so you can change its size
preferencesAboutTextFull
Anatoly Mihalchenko 13 years ago
parent 666a3d7343
commit 759fe210a7
  1. 2
      src/board/UBBoardView.cpp
  2. 9
      src/tools/UBGraphicsTriangle.cpp
  3. 2
      src/tools/UBGraphicsTriangle.h

@ -54,6 +54,7 @@
#include "tools/UBGraphicsCompass.h" #include "tools/UBGraphicsCompass.h"
#include "tools/UBGraphicsCache.h" #include "tools/UBGraphicsCache.h"
#include "tools/UBGraphicsTriangle.h"
#include "core/memcheck.h" #include "core/memcheck.h"
@ -430,6 +431,7 @@ UBBoardView::mousePressEvent (QMouseEvent *event)
|| movingItem->type() == UBGraphicsCompass::Type || movingItem->type() == UBGraphicsCompass::Type
|| movingItem->type() == UBGraphicsPDFItem::Type || movingItem->type() == UBGraphicsPDFItem::Type
|| movingItem->type() == UBGraphicsPolygonItem::Type || movingItem->type() == UBGraphicsPolygonItem::Type
|| movingItem->type() == UBGraphicsTriangle::Type
|| movingItem->type() == UBGraphicsCache::Type || movingItem->type() == UBGraphicsCache::Type
|| scene()->isBackgroundObject(movingItem)) || scene()->isBackgroundObject(movingItem))
{ {

@ -586,7 +586,7 @@ QCursor UBGraphicsTriangle::flipCursor() const
void UBGraphicsTriangle::mousePressEvent(QGraphicsSceneMouseEvent *event) void UBGraphicsTriangle::mousePressEvent(QGraphicsSceneMouseEvent *event)
{ {
lastRect = rect().toRect(); lastRect = rect().toRect();
lastPos = event->screenPos(); lastPos = transform().inverted().map(event->screenPos());
if (resize1Polygon().containsPoint(event->pos().toPoint(), Qt::OddEvenFill)) if (resize1Polygon().containsPoint(event->pos().toPoint(), Qt::OddEvenFill))
{ {
@ -620,18 +620,13 @@ void UBGraphicsTriangle::mousePressEvent(QGraphicsSceneMouseEvent *event)
void UBGraphicsTriangle::mouseMoveEvent(QGraphicsSceneMouseEvent *event) void UBGraphicsTriangle::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{ {
QPoint currPos = event->screenPos();
// qDebug() << QString(" X: %1 ").arg(currPos.x());
// qDebug() << QString(" Y: %1 ").arg(currPos.y());
if (!mResizing1 && !mResizing2 && !mRotating) if (!mResizing1 && !mResizing2 && !mRotating)
{ {
QGraphicsItem::mouseMoveEvent(event); QGraphicsItem::mouseMoveEvent(event);
} }
else else
{ {
QPoint currPos = transform().inverted().map(event->screenPos());
//-----------------------------------------------//
if (mResizing1) if (mResizing1)
{ {

@ -131,6 +131,8 @@ class UBGraphicsTriangle : public UBAbstractDrawRuler, public QGraphicsPolygonIt
bool mResizing2; bool mResizing2;
bool mRotating; bool mRotating;
QRect lastRect; QRect lastRect;
// Coordinates are transformed....
QPoint lastPos; QPoint lastPos;
QGraphicsSvgItem* mHFlipSvgItem; QGraphicsSvgItem* mHFlipSvgItem;

Loading…
Cancel
Save