Fixed eraser behavior.

preferencesAboutTextFull
Aleksei Kanash 13 years ago
parent d517765e13
commit 93bb9244f9
  1. 18
      src/board/UBBoardView.cpp

@ -715,11 +715,6 @@ void UBBoardView::mousePressEvent (QMouseEvent *event)
mPreviousPoint = event->posF (); mPreviousPoint = event->posF ();
event->accept (); event->accept ();
} }
else if (currentTool == UBStylusTool::Eraser)
{
connect(&mLongPressTimer, SIGNAL(timeout()), this, SLOT(longPressEvent()));
mLongPressTimer.start();
}
else if (currentTool == UBStylusTool::Selector || currentTool == UBStylusTool::Play) else if (currentTool == UBStylusTool::Selector || currentTool == UBStylusTool::Play)
{ {
movingItem = scene()->itemAt(this->mapToScene(event->posF().toPoint())); movingItem = scene()->itemAt(this->mapToScene(event->posF().toPoint()));
@ -797,6 +792,11 @@ void UBBoardView::mousePressEvent (QMouseEvent *event)
if (scene () && !mTabletStylusIsPressed) if (scene () && !mTabletStylusIsPressed)
{ {
if (currentTool == UBStylusTool::Eraser)
{
connect(&mLongPressTimer, SIGNAL(timeout()), this, SLOT(longPressEvent()));
mLongPressTimer.start();
}
scene ()->inputDevicePress (mapToScene (UBGeometryUtils::pointConstrainedInRect (event->pos (), rect ()))); scene ()->inputDevicePress (mapToScene (UBGeometryUtils::pointConstrainedInRect (event->pos (), rect ())));
} }
event->accept (); event->accept ();
@ -815,6 +815,8 @@ UBBoardView::mouseMoveEvent (QMouseEvent *event)
mIsDragInProgress = true; mIsDragInProgress = true;
UBStylusTool::Enum currentTool = (UBStylusTool::Enum)UBDrawingController::drawingController ()->stylusTool (); UBStylusTool::Enum currentTool = (UBStylusTool::Enum)UBDrawingController::drawingController ()->stylusTool ();
mLongPressTimer.stop();
if (isAbsurdPoint (event->pos ())) if (isAbsurdPoint (event->pos ()))
{ {
event->accept (); event->accept ();
@ -830,18 +832,12 @@ UBBoardView::mouseMoveEvent (QMouseEvent *event)
mPreviousPoint = eventPosition; mPreviousPoint = eventPosition;
event->accept (); event->accept ();
} }
else if (currentTool == UBStylusTool::Eraser)
{
mLongPressTimer.stop();
}
else if (currentTool == UBStylusTool::Selector || currentTool == UBStylusTool::Play) else if (currentTool == UBStylusTool::Selector || currentTool == UBStylusTool::Play)
{ {
if((event->pos() - mLastPressedMousePos).manhattanLength() < QApplication::startDragDistance()) { if((event->pos() - mLastPressedMousePos).manhattanLength() < QApplication::startDragDistance()) {
return; return;
} }
mLongPressTimer.stop();
if (!movingItem && (mMouseButtonIsPressed || mTabletStylusIsPressed) && mUBRubberBand && mUBRubberBand->isVisible()) { if (!movingItem && (mMouseButtonIsPressed || mTabletStylusIsPressed) && mUBRubberBand && mUBRubberBand->isVisible()) {
QRect bandRect(mMouseDownPos, event->pos()); QRect bandRect(mMouseDownPos, event->pos());

Loading…
Cancel
Save