Направление оси Y
Теперь ось Y направлена строго вверх
This commit is contained in:
@@ -533,6 +533,7 @@ void Canvas::paintEvent(QPaintEvent* event)
|
|||||||
QPainter p(this);
|
QPainter p(this);
|
||||||
p.setRenderHint(QPainter::Antialiasing, true);
|
p.setRenderHint(QPainter::Antialiasing, true);
|
||||||
p.translate(width() / 2.0, height() / 2.0);
|
p.translate(width() / 2.0, height() / 2.0);
|
||||||
|
p.scale(1.0, -1.0);
|
||||||
|
|
||||||
p.setPen(Qt::red);
|
p.setPen(Qt::red);
|
||||||
p.drawLine(-5, 0, 5, 0);
|
p.drawLine(-5, 0, 5, 0);
|
||||||
@@ -608,7 +609,7 @@ void Canvas::leaveEvent(QEvent* event)
|
|||||||
void Canvas::showObjectTag(QPointF pos)
|
void Canvas::showObjectTag(QPointF pos)
|
||||||
{
|
{
|
||||||
QPointF l = screenToLogical(pos);
|
QPointF l = screenToLogical(pos);
|
||||||
Line* lineUnderCursor = findAt(l, 2.0);
|
Line* lineUnderCursor = findAt(l, 1.0);
|
||||||
if (lineUnderCursor && lineUnderCursor != draggedLine) {
|
if (lineUnderCursor && lineUnderCursor != draggedLine) {
|
||||||
QPointF p1(*lineUnderCursor->p1.x, *lineUnderCursor->p1.y);
|
QPointF p1(*lineUnderCursor->p1.x, *lineUnderCursor->p1.y);
|
||||||
QPointF p2(*lineUnderCursor->p2.x, *lineUnderCursor->p2.y);
|
QPointF p2(*lineUnderCursor->p2.x, *lineUnderCursor->p2.y);
|
||||||
@@ -629,5 +630,7 @@ QPointF Canvas::screenToLogical(const QPointF& screenPos) const
|
|||||||
logical.rx() -= width() / 2.0;
|
logical.rx() -= width() / 2.0;
|
||||||
logical.ry() -= height() / 2.0;
|
logical.ry() -= height() / 2.0;
|
||||||
|
|
||||||
|
logical.ry() = -logical.ry();
|
||||||
|
|
||||||
return logical;
|
return logical;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user