Fixed eraser behavior.

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

@ -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 ();
@ -809,12 +809,14 @@ UBBoardView::mouseMoveEvent (QMouseEvent *event)
{
if(!mIsDragInProgress && ((mapToScene(event->pos()) - mLastPressedMousePos).manhattanLength() < QApplication::startDragDistance()))
{
return;
return;
}
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());
@ -899,7 +895,7 @@ UBBoardView::mouseMoveEvent (QMouseEvent *event)
else
{
if (!mTabletStylusIsPressed && scene ())
{
{
scene ()->inputDeviceMove (mapToScene (UBGeometryUtils::pointConstrainedInRect (event->pos (), rect ())), mMouseButtonIsPressed);
}
event->accept ();

Loading…
Cancel
Save