|
|
|
|
@ -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))); |
|
|
|
|
|