Skip to content

Commit

Permalink
Don't move existent points when ConstrainPointByHovered
Browse files Browse the repository at this point in the history
  • Loading branch information
Evil-Spirit committed Jan 9, 2017
1 parent 87e535a commit 3129633
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/mouse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -884,6 +884,8 @@ bool GraphicsWindow::ConstrainPointByHovered(hEntity pt) {

Entity *e = SK.GetEntity(hover.entity);
if(e->IsPoint()) {
Entity *point = SK.GetEntity(pt);
point->PointForceTo(e->PointGetNum());
Constraint::ConstrainCoincident(e->h, pt);
return true;
}
Expand Down Expand Up @@ -987,7 +989,13 @@ void GraphicsWindow::MouseLeftDown(double mx, double my) {
Entity::NO_ENTITY, Entity::NO_ENTITY,
lns[i].entity(0));
}
ConstrainPointByHovered(lns[2].entity(1));
if(ConstrainPointByHovered(lns[2].entity(1))) {
Vector pos = SK.GetEntity(lns[2].entity(1))->PointGetNum();
for(i = 0; i < 4; i++) {
SK.GetEntity(lns[i].entity(1))->PointForceTo(pos);
SK.GetEntity(lns[i].entity(2))->PointForceTo(pos);
}
}

pending.operation = Pending::DRAGGING_NEW_POINT;
pending.point = lns[1].entity(2);
Expand Down

1 comment on commit 3129633

@Evil-Spirit
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@whitequark,
Just try to extrude rect and draw diagonal line between top and bottom faces.
Do it with and without this commit and you will figure out what was wrong without this.

Please sign in to comment.