painter->SetPen(obj->color, Global::zoom * scaledThickness, obj->style);
painter->SetBrush(obj->color);
- if (obj->selected || obj->hovered)
+ if (obj->selected || obj->hitObject)
painter->SetPen(0xFF0000, Global::zoom * scaledThickness, LSDash);
switch (obj->type)
{
Line * l = (Line *)obj;
painter->DrawLine(l->p1, l->p2);
+
+ if (l->hitPoint[0])
+ painter->DrawHandle(l->p1);
+
+ if (l->hitPoint[1])
+ painter->DrawHandle(l->p2);
+
break;
}
case OTCircle:
void DrawingView::GetSelection(std::vector<void *> & v)
{
- v.empty();
+ v.clear();
std::vector<void *>::iterator i;
- for(i=v.begin(); i!=v.end(); i++)
+ for(i=document.objects.begin(); i!=document.objects.end(); i++)
{
if (((Object *)(*i))->selected)
v.push_back(*i);
void DrawingView::GetHovered(std::vector<void *> & v)
{
- v.empty();
+ v.clear();
std::vector<void *>::iterator i;
- for(i=v.begin(); i!=v.end(); i++)
+ for(i=document.objects.begin(); i!=document.objects.end(); i++)
{
if (((Object *)(*i))->hovered)
+// {
+//printf("GetHovered: adding object (%X) to hover... hp1=%s, hp2=%s, hl=%s\n", (*i), (((Line *)(*i))->hitPoint[0] ? "true" : "false"), (((Line *)(*i))->hitPoint[1] ? "true" : "false"), (((Line *)(*i))->hitObject ? "true" : "false"));
v.push_back(*i);
+// }
}
}
{
painter->DrawLine(toolPoint[0], toolPoint[1]);
painter->DrawHandle(toolPoint[1]);
+
+ Vector v(toolPoint[0], toolPoint[1]);
+ double absAngle = v.Angle() * RADIANS_TO_DEGREES;
+ double absLength = v.Magnitude();
+ QString text = tr("Length: %1 in.\n") + QChar(0x2221) + tr(": %2");
+ text = text.arg(absLength).arg(absAngle);
+ painter->DrawInformativeText(text);
}
}
}
}
else if ((Global::toolState == TSPoint2) && shiftDown)
{
+ // Key override is telling us to make a new line, not continue the
+ // previous one.
toolPoint[0] = toolPoint[1];
}
else
if (event->button() == Qt::LeftButton)
{
Vector point = Painter::QtToCartesianCoords(Vector(event->x(), event->y()));
-// collided = document.Collided(point);
- collided = false;
-
- // Do an update if collided with at least *one* object in the document
-// if (collided)
-// update();
- // Actually, we already know what we're going to click on as all the collision
- // detection already happened in the mouse move function...!
-//printf("MouseDown: ctrl=%s, numHovered=%i\n", (ctrlDown ? "DOWN" : "up"), numHovered);
-#if 0
- 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->MouseDown(point);
- }
-#else
+ // Handle tool processing, if any
if (Global::tool)
{
if (Global::snapToGrid)
point = SnapPointToGrid(point);
+ //Also, may want to figure out if hovering over a snap point on an object,
+ //snap to grid if not.
// Snap to object point if valid...
+// if (Global::snapPointIsValid)
+// point = Global::snapPoint;
-
-// ToolMouseDown(point);
ToolMouse(ToolMouseDown, point);
- //Also, may want to figure out if hovering over a snap point on an object,
- //snap to grid if not.
return;
}
-#endif
+ // Clear the selection only if CTRL isn't being held on click
if (!ctrlDown)
ClearSelection();
+ // If any objects are being hovered on click, add them to the selection
+ // & return
if (numHovered > 0)
+ {
AddHoveredToSelection();
+ update(); // needed??
+ GetHovered(hover); // prolly needed
-#if 1
- // Didn't hit any object and not using a tool, so do a selection rectangle
- if (!(numHovered || Global::tool))
- {
- Global::selectionInProgress = true;
- Global::selection.setTopLeft(QPointF(point.x, point.y));
- Global::selection.setBottomRight(QPointF(point.x, point.y));
+ // Needed for grab & moving objects
+ if (Global::snapToGrid)
+ oldPoint = SnapPointToGrid(point);
+
+ return;
}
-#endif
+
+ // Didn't hit any object and not using a tool, so do a selection rectangle
+ Global::selectionInProgress = true;
+ Global::selection.setTopLeft(QPointF(point.x, point.y));
+ Global::selection.setBottomRight(QPointF(point.x, point.y));
}
else if (event->button() == Qt::MiddleButton)
{
return;
}
-#if 1
- // Grid processing... (only snap here is left button is down)
- // Umm, WHY??
- // well, it causes problems with selecting lines that aren't close to a grid line!
- // THAT'S WHY!
- // But even still, this is a bad approach, we need to not just do this for every
- // case because it's WRONG to do it that way! !!! FIX !!!
- if (/*(event->buttons() & Qt::LeftButton) &&*/ Global::snapToGrid)
- {
- point = SnapPointToGrid(point);
- }
-
- // Snap points on objects always take precedence over the grid, whether
- // dragging an object or not...
-//thisnowok
- if (Global::snapPointIsValid)
- {
-// Uncommenting this causes the cursor to become unresponsive after the first
-// object is added.
-// point = Global::snapPoint;
- }
-#endif
-
- // Do checking here to see if object can be selected or not
+ // If we're doing a selection rect, see if any objects are engulfed by it
+ // (implies left mouse button held down)
if (Global::selectionInProgress)
{
- std::vector<void *>::iterator i;
-// QRectF bounds;
- numSelected = 0;
-
- for(i=document.objects.begin(); i!=document.objects.end(); i++)
- {
- Object * obj = (Object *)(*i);
- obj->selected = false;
-// QRectF extents;
-
- switch (obj->type)
- {
- case OTLine:
- {
- Line * l = (Line *)obj;
-
- if (Global::selection.contains(l->p1.x, l->p1.y) && Global::selection.contains(l->p2.x, l->p2.y))
- l->selected = true;
-
- break;
- }
- case OTCircle:
- {
- Circle * c = (Circle *)obj;
-
- if (Global::selection.contains(c->p1.x - c->radius, c->p1.y - c->radius) && Global::selection.contains(c->p1.x + c->radius, c->p1.y + c->radius))
- c->selected = true;
-
- break;
- }
- case OTArc:
- {
- Arc * a = (Arc *)obj;
-
- double start = a->angle1;
- double end = start + a->angle2;
- QPointF p1(cos(start), sin(start));
- QPointF p2(cos(end), sin(end));
- QRectF bounds(p1, p2);
-
-#if 1
- // Swap X/Y coordinates if they're backwards...
- if (bounds.left() > bounds.right())
- {
- double temp = bounds.left();
- bounds.setLeft(bounds.right());
- bounds.setRight(temp);
- }
-
- if (bounds.bottom() > bounds.top())
- {
- double temp = bounds.bottom();
- bounds.setBottom(bounds.top());
- bounds.setTop(temp);
- }
-#else
- // Doesn't work as advertised! For shame!
- bounds = bounds.normalized();
-#endif
-
- // If the end of the arc is before the beginning, add 360 degrees to it
- if (end < start)
- end += 2.0 * PI;
-
- // Adjust the bounds depending on which axes are crossed
- if ((start < PI_OVER_2) && (end > PI_OVER_2))
- bounds.setTop(1.0);
-
- if ((start < PI) && (end > PI))
- bounds.setLeft(-1.0);
-
- if ((start < (PI + PI_OVER_2)) && (end > (PI + PI_OVER_2)))
- bounds.setBottom(-1.0);
-
- if ((start < (2.0 * PI)) && (end > (2.0 * PI)))
- bounds.setRight(1.0);
-
- if ((start < ((2.0 * PI) + PI_OVER_2)) && (end > ((2.0 * PI) + PI_OVER_2)))
- bounds.setTop(1.0);
-
- if ((start < (3.0 * PI)) && (end > (3.0 * PI)))
- bounds.setLeft(-1.0);
-
- if ((start < ((3.0 * PI) + PI_OVER_2)) && (end > ((3.0 * PI) + PI_OVER_2)))
- bounds.setBottom(-1.0);
-
- bounds.setTopLeft(QPointF(bounds.left() * a->radius, bounds.top() * a->radius));
- bounds.setBottomRight(QPointF(bounds.right() * a->radius, bounds.bottom() * a->radius));
- bounds.translate(a->p1.x, a->p1.y);
-
- if (Global::selection.contains(bounds))
- a->selected = true;
-
- break;
- }
- default:
- break;
- }
-
- if (obj->selected)
- numSelected++;
- }
- }
-
-// oldPoint = point;
-//we should keep track of the last point here and only pass this down *if* the point
-//changed...
-
-#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...
-// }
+ CheckObjectBounds();
+ update();
+ return;
}
- if (toolAction)
+ // Handle object movement (left button down & over an object)
+ if ((event->buttons() & Qt::LeftButton) && numHovered)
{
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
+ point = SnapPointToGrid(point);
- bool needUpdate = false;
-
- // Don't do this kind of checking unless we're not doing a selection rectangle!
- // Hmm, lines don't stay selected if globally selected... !!! FIX !!! [DONE]
- // it's because there were extra state variables, the hit* vars...
- if (!Global::selectionInProgress)
- {
- std::vector<void *>::iterator i;
- numHovered = 0;
-
- for(i=document.objects.begin(); i!=document.objects.end(); i++)
- {
- Object * obj = (Object *)(*i);
-// obj->selected = false;
+ Point delta = point - oldPoint;
+ Object * obj = (Object *)hover[0];
+//printf("Object type = %i (size=%i), ", obj->type, hover.size());
+//printf("Object (%X) move: hp1=%s, hp2=%s, hl=%s\n", obj, (obj->hitPoint[0] ? "true" : "false"), (obj->hitPoint[1] ? "true" : "false"), (obj->hitObject ? "true" : "false"));
switch (obj->type)
{
{
Line * l = (Line *)obj;
-// bool hitPoint1, hitPoint2, hitLine;
- l->hitPoint[0] = l->hitPoint[1] = l->hitObject = false;
- Vector lineSegment = l->p2 - l->p1;
- Vector v1 = point - l->p1;
- Vector v2 = point - l->p2;
- double t = Geometry::ParameterOfLineAndPoint(l->p1, l->p2, point);
- double distance;
-
- if (t < 0.0)
- distance = v1.Magnitude();
- else if (t > 1.0)
- distance = v2.Magnitude();
- else
- // distance = ?Det?(ls, v1) / |ls|
- distance = fabs((lineSegment.x * v1.y - v1.x * lineSegment.y)
- / lineSegment.Magnitude());
-
- if ((v1.Magnitude() * Global::zoom) < 8.0)
- {
- l->hitPoint[0] = true;
-// snapPoint = l->p1;
-// snapPointIsValid = true;
- }
- else if ((v2.Magnitude() * Global::zoom) < 8.0)
- {
- l->hitPoint[1] = true;
-// snapPoint = l->p2;
-// snapPointIsValid = true;
- }
- else if ((distance * Global::zoom) < 5.0)
- l->hitObject = true;
-
- bool oldHovered = l->hovered;
- l->hovered = (l->hitPoint[0] || l->hitPoint[1] || l->hitObject ? true : false);
-
- if (oldHovered != l->hovered)
- needUpdate = true;
-
- break;
- }
- case OTCircle:
- {
- Circle * c = (Circle *)obj;
-
+ if (l->hitPoint[0])
+ l->p1 = point;
+ else if (l->hitPoint[1])
+ l->p2 = point;
+ else if (l->hitObject)
+ {
+ l->p1 += delta;
+ l->p2 += delta;
+ }
break;
}
break;
}
- if (obj->hovered)
- {
- numHovered++;
-//printf("MouseMove: OBJECT HOVERED (numHovered = %i)\n", numHovered);
- }
- }
+ update();
+ oldPoint = point;
+ return;
}
-//printf("MouseMove: numHovered = %i\n", numHovered);
- // Tool handling...
+ // Do object hit testing...
+ bool needUpdate = HitTestObjects(point);
+
+ // Do tool handling, if any are active...
if (Global::tool)
{
- // Need to do snapping, etc. as well
-// ToolMouseMove(point);
+ if (Global::snapToGrid)
+ point = SnapPointToGrid(point);
+
ToolMouse(ToolMouseMove, point);
}
// This is used to draw the tool crosshair...
oldPoint = point;
-// if (/*document.NeedsUpdate() ||*/ Global::selectionInProgress /*|| toolAction*/)
- if (needUpdate || Global::selectionInProgress || Global::tool)
+ if (needUpdate || Global::tool)
update();
}
Global::selectionInProgress = false;
// Clear our vectors
- select.empty();
- hover.empty();
+ select.clear();
+ hover.clear();
// Scoop 'em up
std::vector<void *>::iterator i;
return point;
}
+
+void DrawingView::CheckObjectBounds(void)
+{
+ std::vector<void *>::iterator i;
+ numSelected = 0;
+
+ for(i=document.objects.begin(); i!=document.objects.end(); i++)
+ {
+ Object * obj = (Object *)(*i);
+ obj->selected = false;
+
+ switch (obj->type)
+ {
+ case OTLine:
+ {
+ Line * l = (Line *)obj;
+
+ if (Global::selection.contains(l->p1.x, l->p1.y) && Global::selection.contains(l->p2.x, l->p2.y))
+ l->selected = true;
+
+ break;
+ }
+ case OTCircle:
+ {
+ Circle * c = (Circle *)obj;
+
+ if (Global::selection.contains(c->p1.x - c->radius, c->p1.y - c->radius) && Global::selection.contains(c->p1.x + c->radius, c->p1.y + c->radius))
+ c->selected = true;
+
+ break;
+ }
+ case OTArc:
+ {
+ Arc * a = (Arc *)obj;
+
+ double start = a->angle1;
+ double end = start + a->angle2;
+ QPointF p1(cos(start), sin(start));
+ QPointF p2(cos(end), sin(end));
+ QRectF bounds(p1, p2);
+
+#if 1
+ // Swap X/Y coordinates if they're backwards...
+ if (bounds.left() > bounds.right())
+ {
+ double temp = bounds.left();
+ bounds.setLeft(bounds.right());
+ bounds.setRight(temp);
+ }
+
+ if (bounds.bottom() > bounds.top())
+ {
+ double temp = bounds.bottom();
+ bounds.setBottom(bounds.top());
+ bounds.setTop(temp);
+ }
+#else
+ // Doesn't work as advertised! For shame!
+ bounds = bounds.normalized();
+#endif
+
+ // If the end of the arc is before the beginning, add 360 degrees to it
+ if (end < start)
+ end += 2.0 * PI;
+
+ // Adjust the bounds depending on which axes are crossed
+ if ((start < PI_OVER_2) && (end > PI_OVER_2))
+ bounds.setTop(1.0);
+
+ if ((start < PI) && (end > PI))
+ bounds.setLeft(-1.0);
+
+ if ((start < (PI + PI_OVER_2)) && (end > (PI + PI_OVER_2)))
+ bounds.setBottom(-1.0);
+
+ if ((start < (2.0 * PI)) && (end > (2.0 * PI)))
+ bounds.setRight(1.0);
+
+ if ((start < ((2.0 * PI) + PI_OVER_2)) && (end > ((2.0 * PI) + PI_OVER_2)))
+ bounds.setTop(1.0);
+
+ if ((start < (3.0 * PI)) && (end > (3.0 * PI)))
+ bounds.setLeft(-1.0);
+
+ if ((start < ((3.0 * PI) + PI_OVER_2)) && (end > ((3.0 * PI) + PI_OVER_2)))
+ bounds.setBottom(-1.0);
+
+ bounds.setTopLeft(QPointF(bounds.left() * a->radius, bounds.top() * a->radius));
+ bounds.setBottomRight(QPointF(bounds.right() * a->radius, bounds.bottom() * a->radius));
+ bounds.translate(a->p1.x, a->p1.y);
+
+ if (Global::selection.contains(bounds))
+ a->selected = true;
+
+ break;
+ }
+ default:
+ break;
+ }
+
+ if (obj->selected)
+ numSelected++;
+ }
+}
+
+
+bool DrawingView::HitTestObjects(Point point)
+{
+ std::vector<void *>::iterator i;
+ numHovered = 0;
+ bool needUpdate = false;
+
+ for(i=document.objects.begin(); i!=document.objects.end(); i++)
+ {
+ Object * obj = (Object *)(*i);
+
+ switch (obj->type)
+ {
+ case OTLine:
+ {
+ Line * l = (Line *)obj;
+ bool oldHP0 = l->hitPoint[0], oldHP1 = l->hitPoint[1], oldHO = l->hitObject;
+ l->hitPoint[0] = l->hitPoint[1] = l->hitObject = false;
+ Vector lineSegment = l->p2 - l->p1;
+ Vector v1 = point - l->p1;
+ Vector v2 = point - l->p2;
+ double t = Geometry::ParameterOfLineAndPoint(l->p1, l->p2, point);
+ double distance;
+
+ if (t < 0.0)
+ distance = v1.Magnitude();
+ else if (t > 1.0)
+ distance = v2.Magnitude();
+ else
+ // distance = ?Det?(ls, v1) / |ls|
+ distance = fabs((lineSegment.x * v1.y - v1.x * lineSegment.y)
+ / lineSegment.Magnitude());
+
+ if ((v1.Magnitude() * Global::zoom) < 8.0)
+ {
+ l->hitPoint[0] = true;
+// snapPoint = l->p1;
+// snapPointIsValid = true;
+ }
+ else if ((v2.Magnitude() * Global::zoom) < 8.0)
+ {
+ l->hitPoint[1] = true;
+// snapPoint = l->p2;
+// snapPointIsValid = true;
+ }
+ else if ((distance * Global::zoom) < 5.0)
+ l->hitObject = true;
+
+// bool oldHovered = l->hovered;
+ l->hovered = (l->hitPoint[0] || l->hitPoint[1] || l->hitObject ? true : false);
+// l->hovered = l->hitObject;
+
+// if (oldHovered != l->hovered)
+ if ((oldHP0 != l->hitPoint[0]) || (oldHP1 != l->hitPoint[1]) || (oldHO != l->hitObject))
+ needUpdate = true;
+
+ break;
+ }
+ case OTCircle:
+ {
+ Circle * c = (Circle *)obj;
+
+
+ break;
+ }
+ default:
+ break;
+ }
+
+ if (obj->hovered)
+// {
+ numHovered++;
+//printf("MouseMove: OBJECT HOVERED (numHovered = %i)\n", numHovered);
+// }
+ }
+
+ return needUpdate;
+}
+
+
+#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
+
Line(): type(OTLine), id(Global::objectID++) {}
Line(Vector pt1, Vector pt2, float th = 1.0, uint32_t c = 0, int l = LSSolid):
type(OTLine), id(Global::objectID++), layer(0), color(c), thickness(th),
- style(l), selected(false), hovered(false), p1(pt1), p2(pt2) {}
+ style(l), selected(false), hovered(false), hitObject(false), p1(pt1), p2(pt2) {}
};
struct Circle {
Circle(Vector pt1, double r, float th = 1.0, uint32_t c = 0, int l = LSSolid):
type(OTCircle), id(Global::objectID++), layer(0), color(c), thickness(th),
- style(l), selected(false), hovered(false), p1(pt1), radius(r) {}
+ style(l), selected(false), hovered(false), hitObject(false), p1(pt1), radius(r) {}
};
struct Ellipse {
Ellipse(Vector pt1, Vector pt2, double r1, double r2, float th = 1.0, uint32_t c = 0, int l = LSSolid):
type(OTEllipse), id(Global::objectID++), layer(0), color(c), thickness(th),
- style(l), selected(false), hovered(false), p1(pt1), p2(pt2), radius1(r1), radius2(r2) {}
+ style(l), selected(false), hovered(false), hitObject(false), p1(pt1), p2(pt2), radius1(r1), radius2(r2) {}
};
struct Arc {
Arc(Vector pt1, double r, double a1, double a2, float th = 1.0, uint32_t c = 0, int l = LSSolid):
type(OTArc), id(Global::objectID++), layer(0), color(c), thickness(th),
- style(l), selected(false), hovered(false), p1(pt1), radius(r), angle1(a1), angle2(a2) {}
+ style(l), selected(false), hovered(false), hitObject(false), p1(pt1), radius(r), angle1(a1), angle2(a2) {}
};
struct Dimension {
Dimension(Vector pt1, Vector pt2, DimensionType dt = DTLinear, float th = 1.0, uint32_t c = 0x0000FF, int l = LSSolid):
type(OTDimension), id(Global::objectID++), layer(0), color(c), thickness(th),
- style(l), selected(false), hovered(false), subtype(dt), p1(pt1), p2(pt2) {}
+ style(l), selected(false), hovered(false), hitObject(false), subtype(dt), p1(pt1), p2(pt2) {}
};
struct Text {
Text(Vector pt, char * str, float th = 10.0, uint32_t c = 0):
type(OTText), id(Global::objectID++), layer(0), color(c), thickness(th),
- style(LSSolid), selected(false), hovered(false), p1(pt), s(str) {}
+ style(LSSolid), selected(false), hovered(false), hitObject(false), p1(pt), s(str) {}
};
struct Container {
double angle;
double scale;
- Container(): type(OTContainer), id(Global::objectID++), selected(false), hovered(false) {}
+ Container(): type(OTContainer), id(Global::objectID++), selected(false), hovered(false), hitObject(false) {}
};
struct Object {