Fix logic introduced in 55ae10b
.
Before this commit, the effect of the AddPending() call was immediately reversed by ClearSuper.
This commit is contained in:
parent
3fc85b7934
commit
d4b052d34d
|
@ -336,10 +336,6 @@ GraphicsWindow::Selection GraphicsWindow::ChooseFromHoverToSelect() {
|
|||
for(const Hover &hov : hoverList) {
|
||||
hGroup hg = {};
|
||||
if(hov.selection.entity.v != 0) {
|
||||
hEntity he = hov.selection.entity;
|
||||
if(he.isFromRequest() && IsFromPending(he.request())) {
|
||||
continue;
|
||||
}
|
||||
hg = SK.GetEntity(hov.selection.entity)->group;
|
||||
} else if(hov.selection.constraint.v != 0) {
|
||||
hg = SK.GetConstraint(hov.selection.constraint)->group;
|
||||
|
@ -399,7 +395,7 @@ void GraphicsWindow::HitTestMakeSelection(Point2d mp) {
|
|||
if(!e.IsVisible()) continue;
|
||||
|
||||
// Don't hover whatever's being dragged.
|
||||
if(e.h.request().v == pending.point.request().v) {
|
||||
if(IsFromPending(e.h.request())) {
|
||||
// The one exception is when we're creating a new cubic; we
|
||||
// want to be able to hover the first point, because that's
|
||||
// how we turn it into a periodic spline.
|
||||
|
|
|
@ -485,6 +485,14 @@ void GraphicsWindow::AddToPending(hRequest r) {
|
|||
pending.requests.Add(&r);
|
||||
}
|
||||
|
||||
void GraphicsWindow::ReplacePending(hRequest before, hRequest after) {
|
||||
for(auto &req : pending.requests) {
|
||||
if(req.v == before.v) {
|
||||
req.v = after.v;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GraphicsWindow::MouseMiddleOrRightDown(double x, double y) {
|
||||
if(GraphicsEditControlIsVisible()) return;
|
||||
|
||||
|
@ -956,12 +964,12 @@ void GraphicsWindow::MouseLeftDown(double mx, double my) {
|
|||
case Command::LINE_SEGMENT:
|
||||
case Command::CONSTR_SEGMENT:
|
||||
hr = AddRequest(Request::Type::LINE_SEGMENT);
|
||||
AddToPending(hr);
|
||||
SK.GetRequest(hr)->construction = (pending.command == Command::CONSTR_SEGMENT);
|
||||
SK.GetEntity(hr.entity(1))->PointForceTo(v);
|
||||
ConstrainPointByHovered(hr.entity(1));
|
||||
|
||||
ClearSuper();
|
||||
AddToPending(hr);
|
||||
|
||||
pending.operation = Pending::DRAGGING_NEW_LINE_POINT;
|
||||
pending.request = hr;
|
||||
|
@ -1037,7 +1045,6 @@ void GraphicsWindow::MouseLeftDown(double mx, double my) {
|
|||
break;
|
||||
}
|
||||
hr = AddRequest(Request::Type::ARC_OF_CIRCLE);
|
||||
AddToPending(hr);
|
||||
// This fudge factor stops us from immediately failing to solve
|
||||
// because of the arc's implicit (equal radius) tangent.
|
||||
Vector adj = SS.GW.projRight.WithMagnitude(2/SS.GW.scale);
|
||||
|
@ -1047,6 +1054,7 @@ void GraphicsWindow::MouseLeftDown(double mx, double my) {
|
|||
ConstrainPointByHovered(hr.entity(2));
|
||||
|
||||
ClearSuper();
|
||||
AddToPending(hr);
|
||||
|
||||
pending.operation = Pending::DRAGGING_NEW_ARC_POINT;
|
||||
pending.point = hr.entity(3);
|
||||
|
@ -1055,7 +1063,6 @@ void GraphicsWindow::MouseLeftDown(double mx, double my) {
|
|||
}
|
||||
case Command::CUBIC:
|
||||
hr = AddRequest(Request::Type::CUBIC);
|
||||
AddToPending(hr);
|
||||
SK.GetEntity(hr.entity(1))->PointForceTo(v);
|
||||
SK.GetEntity(hr.entity(2))->PointForceTo(v);
|
||||
SK.GetEntity(hr.entity(3))->PointForceTo(v);
|
||||
|
@ -1063,6 +1070,7 @@ void GraphicsWindow::MouseLeftDown(double mx, double my) {
|
|||
ConstrainPointByHovered(hr.entity(1));
|
||||
|
||||
ClearSuper();
|
||||
AddToPending(hr);
|
||||
|
||||
pending.operation = Pending::DRAGGING_NEW_CUBIC_POINT;
|
||||
pending.point = hr.entity(4);
|
||||
|
@ -1093,6 +1101,7 @@ void GraphicsWindow::MouseLeftDown(double mx, double my) {
|
|||
break;
|
||||
}
|
||||
hr = AddRequest(Request::Type::TTF_TEXT);
|
||||
AddToPending(hr);
|
||||
Request *r = SK.GetRequest(hr);
|
||||
r->str = "Abc";
|
||||
r->font = "arial.ttf";
|
||||
|
@ -1211,6 +1220,7 @@ void GraphicsWindow::MouseLeftDown(double mx, double my) {
|
|||
|
||||
// Create a new line segment, so that we continue drawing.
|
||||
hRequest hr = AddRequest(Request::Type::LINE_SEGMENT);
|
||||
ReplacePending(pending.request, hr);
|
||||
SK.GetRequest(hr)->construction = SK.GetRequest(pending.request)->construction;
|
||||
SK.GetEntity(hr.entity(1))->PointForceTo(v);
|
||||
// Displace the second point of the new line segment slightly,
|
||||
|
|
Loading…
Reference in New Issue
Block a user