arrow and line update base class currPoint for upcoming change

presentation
JJones780 7 years ago
parent 4a66dd1f8a
commit 72d496ca33
  1. 10
      src/control/tools/ArrowHandler.cpp
  2. 9
      src/control/tools/RulerHandler.cpp

@ -25,13 +25,15 @@ void ArrowHandler::drawShape(Point& c, const PositionInputData& pos)
/**
* Snap first point to grid (if enabled)
*/
bool shiftDown = pos.isShiftDown();
if (!shiftDown && xournal->getControl()->getSettings()->isSnapGrid())
bool altDown = pos.isAltDown();
if (!altDown && xournal->getControl()->getSettings()->isSnapGrid())
{
Point firstPoint = stroke->getPoint(0);
snapToGrid(firstPoint.x,firstPoint.y);
stroke->setFirstPoint(firstPoint.x,firstPoint.y);
}
this->currPoint = c; // in case redrawn by keypress event in base class.
int count = stroke->getPointCount();
if (count < 1)
@ -52,7 +54,7 @@ void ArrowHandler::drawShape(Point& c, const PositionInputData& pos)
stroke->deletePoint(1);
}
if (!shiftDown && xournal->getControl()->getSettings()->isSnapGrid())
if (!altDown && xournal->getControl()->getSettings()->isSnapGrid())
{
snapToGrid(c.x,c.y);
}
@ -68,7 +70,7 @@ void ArrowHandler::drawShape(Point& c, const PositionInputData& pos)
// an appropriate delta is Pi/3 radians for an arrow shape
double delta = M_PI / 6.0;
if (shiftDown || !xournal->getControl()->getSettings()->isSnapRotation())
if (altDown || !xournal->getControl()->getSettings()->isSnapRotation())
{
stroke->addPoint(c);
stroke->addPoint(Point(c.x - arrowDist * cos(angle + delta), c.y - arrowDist * sin(angle + delta)));

@ -86,19 +86,22 @@ void RulerHandler::drawShape(Point& currentPoint, const PositionInputData& pos)
/**
* Snap first point to grid (if enabled)
*/
bool shiftDown = pos.isShiftDown();
if (!shiftDown && xournal->getControl()->getSettings()->isSnapGrid())
bool altDown = pos.isAltDown();
if (!altDown && xournal->getControl()->getSettings()->isSnapGrid())
{
Point firstPoint = stroke->getPoint(0);
snapToGrid(firstPoint.x,firstPoint.y);
stroke->setFirstPoint(firstPoint.x,firstPoint.y);
}
this->currPoint = currentPoint; // in case redrawn by keypress event in base class.
if (stroke->getPointCount() < 2)
{
stroke->addPoint(currentPoint);
}
else if (shiftDown)
else if (altDown)
{
x = currentPoint.x;
y = currentPoint.y;

Loading…
Cancel
Save