[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [symboleditor] src: Fix picking of existing nodes when snap enabled
From: Steve Allewell <steve.allewell () gmail ! com>
Date: 2014-05-31 21:26:43
Message-ID: E1Wqqnb-0006lX-6R () scm ! kde ! org
[Download RAW message or body]
Git commit d56f0037081871ccc8596819dd3302c101f04503 by Steve Allewell.
Committed on 31/05/2014 at 21:21.
Pushed by sallewell into branch 'master'.
Fix picking of existing nodes when snap enabled
When snap mode is enabled, existing nodes that were not close to a snap
point were not selectable for moving because the points being compared
were converted to a snap point before comparison.
M +12 -12 src/Editor.cpp
http://commits.kde.org/symboleditor/d56f0037081871ccc8596819dd3302c101f04503
diff --git a/src/Editor.cpp b/src/Editor.cpp
index c507e65..94aeb60 100644
--- a/src/Editor.cpp
+++ b/src/Editor.cpp
@@ -789,17 +789,17 @@ void Editor::readSettings()
*/
void Editor::mousePressEvent(QMouseEvent *event)
{
- QPointF p = snapPoint(event->pos());
+ QPoint p = event->pos();
if (event->buttons() & Qt::LeftButton) {
- m_start = m_tracking = p;
+ m_start = m_tracking = snapPoint(p);
m_rubberBand = QRectF();
- if (node(p)) {
+ if (node(toSymbol(p))) {
m_dragging = true;
- m_dragPointIndex = nodeUnderCursor(p);
+ m_dragPointIndex = nodeUnderCursor(toSymbol(p));
} else {
- addPoint(p);
+ addPoint(m_start);
}
}
@@ -830,18 +830,18 @@ void Editor::mouseMoveEvent(QMouseEvent *event)
update();
}
- QPointF p = snapPoint(event->pos());
+ QPoint p = event->pos();
if (event->buttons() & Qt::LeftButton) {
- if (m_tracking != p) {
- m_tracking = p;
+ if (m_tracking != snapPoint(p)) {
+ m_tracking = snapPoint(p);
if (m_dragging) {
if (m_dragPointIndex.first) {
- m_points[m_dragPointIndex.second] = p;
+ m_points[m_dragPointIndex.second] = m_tracking;
constructPainterPath();
} else {
- m_activePoints[m_dragPointIndex.second] = p;
+ m_activePoints[m_dragPointIndex.second] = m_tracking;
}
} else if (m_toolMode == Rectangle || m_toolMode == Ellipse) {
m_rubberBand = QRectF(m_start, m_tracking).normalized();
@@ -850,14 +850,14 @@ void Editor::mouseMoveEvent(QMouseEvent *event)
update();
}
} else {
- if (node(p)) {
+ if (node(toSymbol(p))) {
setCursor(Qt::SizeAllCursor);
} else {
setCursor(Qt::ArrowCursor);
}
}
- if (constructGuides(p)) {
+ if (constructGuides(toSymbol(p))) {
update();
}
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic