if (snapToGrid)
point = SnapPointToGrid(point);
+ if (snapPointIsValid)
+ point = snapPoint;
+
/*
State Management:
We want the arc to go into OSSelected mode if we click on it but don't drag.
}
-/*virtual*/ void Arc::PointerMoved(Vector point)
+/*virtual*/ bool Arc::PointerMoved(Vector point)
{
// one other thing to check here for is if a modifier key is being held as well,
// to allow for multi-selection
else
state = OSInactive;
- return;
+ return false;
}
// The TLC will send these messages if the object is selected but not clicked on.
// objectWasDragged = true;
// needUpdate = false;
SaveHitState();
- HitTest(point);
+ bool hovered = HitTest(point);
needUpdate = HitStateChanged();
+
+ if (snapToGrid)
+ point = SnapPointToGrid(point);
+
+ if (snapPointIsValid)
+ point = snapPoint;
+
objectWasDragged = (draggingCenter | draggingEdge | draggingRotate | draggingSpan);
if (objectWasDragged)
// Why save this? For rendering code?
oldPoint = point;
// needUpdate = true;
+ return hovered;
}
hitArc = true;
#else
if ((length * Painter::zoom) < 8.0)
+ {
hitCenter = true;
+ snapPoint = position;
+ snapPointIsValid = true;
+ }
else if (((fabs(length - radius) * Painter::zoom) < 2.0)
&& AngleInArcSpan(pointerAngle))
hitArc = true;
else if ((Vector::Magnitude(handle2, point) * Painter::zoom) < 8.0)
+ {
hitRotate = true;
+ snapPoint = handle2;
+ snapPointIsValid = true;
+ }
else if ((Vector::Magnitude(handle3, point) * Painter::zoom) < 8.0)
+ {
hitSpan = true;
+ snapPoint = handle3;
+ snapPointIsValid = true;
+ }
#endif
return (hitCenter || hitArc || hitRotate || hitSpan ? true : false);
QPointF p2(cos(end), sin(end));
QRectF bounds(p1, p2);
+#if 0
// Swap X/Y coordinates if they're backwards...
if (bounds.left() > bounds.right())
{
bounds.setBottom(bounds.top());
bounds.setTop(temp);
}
+#else
+ bounds = bounds.normalized();
+#endif
// If the end of the arc is before the beginning, add 360 degrees to it
if (end < start)
Point c2 = Geometry::RotatePointAroundPoint(angleStartPoint, point, angle);
position = c1;
- startAngle = Vector(c2, c1).Angle();
+ startAngle = Vector(c1, c2).Angle();
}