-
-
-#if 0
- // This returns true if we've moved over an object...
- if (document.PointerMoved(point)) // <-- This
- // This is where the object would do automagic dragging & shit. Since we don't
- // do that anymore, we need a strategy to handle it.
- {
-
-/*
-Now objects handle mouse move snapping as well. The code below mainly works only
-for tools; we need to fix it so that objects work as well...
-
-There's a problem with the object point snapping in that it's dependent on the
-order of the objects in the document. Most likely this is because it counts the
-selected object last and thus fucks up the algorithm. Need to fix this...
-
-
-*/
- // Do object snapping here. Grid snapping on mouse down is done in the
- // objects themselves, only because we have to hit test the raw point,
- // not the snapped point. There has to be a better way...!
- if (document.penultimateObjectHovered)
- {
- // Two objects are hovered, see if we have an intersection point
- if ((document.lastObjectHovered->type == OTLine) && (document.penultimateObjectHovered->type == OTLine))
- {
- double t;
- int n = Geometry::Intersects((Line *)document.lastObjectHovered, (Line *)document.penultimateObjectHovered, &t);
-
- if (n == 1)
- {
- Global::snapPoint = document.lastObjectHovered->GetPointAtParameter(t);
- Global::snapPointIsValid = true;
- }
- }
- else if ((document.lastObjectHovered->type == OTCircle) && (document.penultimateObjectHovered->type == OTCircle))
- {
- Point p1, p2;
- int n = Geometry::Intersects((Circle *)document.lastObjectHovered, (Circle *)document.penultimateObjectHovered, 0, 0, 0, 0, &p1, &p2);
-
- if (n == 1)
- {
- Global::snapPoint = p1;
- Global::snapPointIsValid = true;
- }
- else if (n == 2)
- {
- double d1 = Vector(point, p1).Magnitude();
- double d2 = Vector(point, p2).Magnitude();
-
- if (d1 < d2)
- Global::snapPoint = p1;
- else
- Global::snapPoint = p2;
-
- Global::snapPointIsValid = true;
- }
- }
- }
-// else
-// {
- // Otherwise, it was a single object hovered...
-// }
- }
-
- if (toolAction)
- {
- if (Global::snapToGrid)
- point = Global::SnapPointToGrid(point);
-
- // We always snap to object points, and they take precendence over
- // grid points...
- if (Global::snapPointIsValid)
- point = Global::snapPoint;
-
- toolAction->MouseMoved(point);
- }
-#else
-#endif
-