Add 45-multiple degree adjustment for line, arrow and marker tools (#439)
* Add 45-multiple degree adjustment for line, arrow and marker tools * Adjustment: Ctrl press is checked + widened functionality for two-point tools
This commit is contained in:
committed by
Dharkael
parent
bd83eea7af
commit
b42f1cf01d
@@ -20,18 +20,13 @@
|
||||
|
||||
namespace {
|
||||
|
||||
#define ADJ_VALUE 14
|
||||
#define PADDING_VALUE 14
|
||||
|
||||
// Have to force horizontal position
|
||||
bool needsAdjustment(const QPoint &p0, const QPoint &p1) {
|
||||
return (p1.y() >= p0.y() - ADJ_VALUE) && (p1.y() <= p0.y() + ADJ_VALUE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
MarkerTool::MarkerTool(QObject *parent) : AbstractTwoPointTool(parent) {
|
||||
|
||||
m_supportsOrthogonalAdj = true;
|
||||
m_supportsDiagonalAdj = true;
|
||||
}
|
||||
|
||||
QIcon MarkerTool::icon(const QColor &background, bool inEditor) const {
|
||||
@@ -71,13 +66,6 @@ void MarkerTool::paintMousePreview(QPainter &painter, const CaptureContext &cont
|
||||
painter.drawLine(context.mousePos, context.mousePos);
|
||||
}
|
||||
|
||||
void MarkerTool::drawMove(const QPoint &p) {
|
||||
m_points.second = p;
|
||||
if (needsAdjustment(m_points.first, m_points.second)) {
|
||||
m_points.second.setY(m_points.first.y());
|
||||
}
|
||||
}
|
||||
|
||||
void MarkerTool::drawStart(const CaptureContext &context) {
|
||||
m_color = context.color;
|
||||
m_thickness = context.thickness + PADDING_VALUE;
|
||||
|
||||
Reference in New Issue
Block a user