Select the appropriate entity when dragging a circle or a normal.

This commit adds logic that was missed in 25631d4.
pull/168/head
EvilSpirit 2017-01-20 09:56:35 +07:00 committed by whitequark
parent 119b17ac75
commit 669e6f0dcb
1 changed files with 5 additions and 4 deletions

View File

@ -178,17 +178,18 @@ void GraphicsWindow::MouseMoved(double x, double y, bool leftDown,
// start dragging something. // start dragging something.
if(leftDown && dm > 3) { if(leftDown && dm > 3) {
Entity *e = NULL; Entity *e = NULL;
if(hover.entity.v) e = SK.GetEntity(hover.entity); hEntity dragEntity = ChooseFromHoverToDrag().entity;
if(dragEntity.v) e = SK.GetEntity(dragEntity);
if(e && e->type != Entity::Type::WORKPLANE) { if(e && e->type != Entity::Type::WORKPLANE) {
Entity *e = SK.GetEntity(hover.entity); Entity *e = SK.GetEntity(dragEntity);
if(e->type == Entity::Type::CIRCLE && selection.n <= 1) { if(e->type == Entity::Type::CIRCLE && selection.n <= 1) {
// Drag the radius. // Drag the radius.
ClearSelection(); ClearSelection();
pending.circle = hover.entity; pending.circle = dragEntity;
pending.operation = Pending::DRAGGING_RADIUS; pending.operation = Pending::DRAGGING_RADIUS;
} else if(e->IsNormal()) { } else if(e->IsNormal()) {
ClearSelection(); ClearSelection();
pending.normal = hover.entity; pending.normal = dragEntity;
pending.operation = Pending::DRAGGING_NORMAL; pending.operation = Pending::DRAGGING_NORMAL;
} else { } else {
if(!hoverWasSelectedOnMousedown) { if(!hoverWasSelectedOnMousedown) {