Skip to content

Commit 55ae10b

Browse files
Evil-Spiritwhitequark
authored andcommitted
Do not hover or select entities from any pending request.
1 parent 96476ca commit 55ae10b

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

src/draw.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,10 @@ GraphicsWindow::Selection GraphicsWindow::ChooseFromHoverToSelect() {
336336
for(const Hover &hov : hoverList) {
337337
hGroup hg = {};
338338
if(hov.selection.entity.v != 0) {
339+
hEntity he = hov.selection.entity;
340+
if(he.isFromRequest() && IsFromPending(he.request())) {
341+
continue;
342+
}
339343
hg = SK.GetEntity(hov.selection.entity)->group;
340344
} else if(hov.selection.constraint.v != 0) {
341345
hg = SK.GetConstraint(hov.selection.constraint)->group;

src/mouse.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,10 +463,22 @@ void GraphicsWindow::MouseMoved(double x, double y, bool leftDown,
463463

464464
void GraphicsWindow::ClearPending() {
465465
pending.points.Clear();
466+
pending.requests.Clear();
466467
pending = {};
467468
SS.ScheduleShowTW();
468469
}
469470

471+
bool GraphicsWindow::IsFromPending(hRequest r) {
472+
for(auto &req : pending.requests) {
473+
if(req.v == r.v) return true;
474+
}
475+
return false;
476+
}
477+
478+
void GraphicsWindow::AddToPending(hRequest r) {
479+
pending.requests.Add(&r);
480+
}
481+
470482
void GraphicsWindow::MouseMiddleOrRightDown(double x, double y) {
471483
if(GraphicsEditControlIsVisible()) return;
472484

@@ -936,6 +948,7 @@ void GraphicsWindow::MouseLeftDown(double mx, double my) {
936948
case Command::LINE_SEGMENT:
937949
case Command::CONSTR_SEGMENT:
938950
hr = AddRequest(Request::Type::LINE_SEGMENT);
951+
AddToPending(hr);
939952
SK.GetRequest(hr)->construction = (pending.command == Command::CONSTR_SEGMENT);
940953
SK.GetEntity(hr.entity(1))->PointForceTo(v);
941954
ConstrainPointByHovered(hr.entity(1));
@@ -961,6 +974,7 @@ void GraphicsWindow::MouseLeftDown(double mx, double my) {
961974
SS.UndoRemember();
962975
for(i = 0; i < 4; i++) {
963976
lns[i] = AddRequest(Request::Type::LINE_SEGMENT, /*rememberForUndo=*/false);
977+
AddToPending(lns[i]);
964978
}
965979
for(i = 0; i < 4; i++) {
966980
Constraint::ConstrainCoincident(
@@ -1009,6 +1023,7 @@ void GraphicsWindow::MouseLeftDown(double mx, double my) {
10091023
break;
10101024
}
10111025
hr = AddRequest(Request::Type::ARC_OF_CIRCLE);
1026+
AddToPending(hr);
10121027
// This fudge factor stops us from immediately failing to solve
10131028
// because of the arc's implicit (equal radius) tangent.
10141029
Vector adj = SS.GW.projRight.WithMagnitude(2/SS.GW.scale);
@@ -1026,6 +1041,7 @@ void GraphicsWindow::MouseLeftDown(double mx, double my) {
10261041
}
10271042
case Command::CUBIC:
10281043
hr = AddRequest(Request::Type::CUBIC);
1044+
AddToPending(hr);
10291045
SK.GetEntity(hr.entity(1))->PointForceTo(v);
10301046
SK.GetEntity(hr.entity(2))->PointForceTo(v);
10311047
SK.GetEntity(hr.entity(3))->PointForceTo(v);

src/ui.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -706,6 +706,7 @@ class GraphicsWindow {
706706
hRequest request;
707707
hEntity point;
708708
List<hEntity> points;
709+
List<hRequest> requests;
709710
hEntity circle;
710711
hEntity normal;
711712
hConstraint constraint;
@@ -716,6 +717,9 @@ class GraphicsWindow {
716717
Constraint::Type suggestion;
717718
} pending;
718719
void ClearPending();
720+
bool IsFromPending(hRequest r);
721+
void AddToPending(hRequest r);
722+
719723
// The constraint that is being edited with the on-screen textbox.
720724
hConstraint constraintBeingEdited;
721725

0 commit comments

Comments
 (0)