Commit 93bb9244 authored by Aleksei Kanash's avatar Aleksei Kanash

Fixed eraser behavior.

parent d517765e
......@@ -715,11 +715,6 @@ void UBBoardView::mousePressEvent (QMouseEvent *event)
mPreviousPoint = event->posF ();
event->accept ();
}
else if (currentTool == UBStylusTool::Eraser)
{
connect(&mLongPressTimer, SIGNAL(timeout()), this, SLOT(longPressEvent()));
mLongPressTimer.start();
}
else if (currentTool == UBStylusTool::Selector || currentTool == UBStylusTool::Play)
{
movingItem = scene()->itemAt(this->mapToScene(event->posF().toPoint()));
......@@ -797,6 +792,11 @@ void UBBoardView::mousePressEvent (QMouseEvent *event)
if (scene () && !mTabletStylusIsPressed)
{
if (currentTool == UBStylusTool::Eraser)
{
connect(&mLongPressTimer, SIGNAL(timeout()), this, SLOT(longPressEvent()));
mLongPressTimer.start();
}
scene ()->inputDevicePress (mapToScene (UBGeometryUtils::pointConstrainedInRect (event->pos (), rect ())));
}
event->accept ();
......@@ -815,6 +815,8 @@ UBBoardView::mouseMoveEvent (QMouseEvent *event)
mIsDragInProgress = true;
UBStylusTool::Enum currentTool = (UBStylusTool::Enum)UBDrawingController::drawingController ()->stylusTool ();
mLongPressTimer.stop();
if (isAbsurdPoint (event->pos ()))
{
event->accept ();
......@@ -830,18 +832,12 @@ UBBoardView::mouseMoveEvent (QMouseEvent *event)
mPreviousPoint = eventPosition;
event->accept ();
}
else if (currentTool == UBStylusTool::Eraser)
{
mLongPressTimer.stop();
}
else if (currentTool == UBStylusTool::Selector || currentTool == UBStylusTool::Play)
{
if((event->pos() - mLastPressedMousePos).manhattanLength() < QApplication::startDragDistance()) {
return;
}
mLongPressTimer.stop();
if (!movingItem && (mMouseButtonIsPressed || mTabletStylusIsPressed) && mUBRubberBand && mUBRubberBand->isVisible()) {
QRect bandRect(mMouseDownPos, event->pos());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment