Improve control lines dragging behavior

Fix control line not updating when dragging and allow dragging when
starting with the mouse cursor outside the preview image area.
This commit is contained in:
Lawrence Lee
2021-05-23 21:45:23 -07:00
parent 051d69331f
commit 56e634da81
2 changed files with 8 additions and 5 deletions

View File

@@ -104,6 +104,9 @@ bool ControlLineManager::button1Pressed(int modifierKey)
action = Action::DRAGGING;
}
} else if (draw_mode && (modifierKey & GDK_CONTROL_MASK)) { // Add new line.
if (object < 0) {
return false;
}
addLine(dataProvider->posImage, dataProvider->posImage);
drawing_line = true;
selected_object = mouseOverGeometry.size() - 1; // Select endpoint.
@@ -125,7 +128,7 @@ bool ControlLineManager::button1Released(void)
callbacks->lineChanged();
drawing_line = false;
selected_object = -1;
return false;
return true;
}
bool ControlLineManager::button3Pressed(int modifierKey)
@@ -139,7 +142,7 @@ bool ControlLineManager::button3Pressed(int modifierKey)
}
action = Action::PICKING;
return false;
return true;
}
bool ControlLineManager::pick1(bool picked)
@@ -194,7 +197,7 @@ bool ControlLineManager::pick3(bool picked)
removeLine((provider->getObject() - 1) / ::ControlLine::OBJ_COUNT);
prev_obj = -1;
selected_object = -1;
return false;
return true;
}
bool ControlLineManager::drag1(int modifierKey)
@@ -264,7 +267,7 @@ bool ControlLineManager::drag1(int modifierKey)
autoSetLineType(selected_object);
}
return false;
return true;
}
void ControlLineManager::releaseEdit(void)

View File

@@ -540,7 +540,7 @@ void CropWindow::buttonPress (int button, int type, int bstate, int x, int y)
action_y = 0;
}
} else if (iarea->getToolMode () == TMHand) { // events outside of the image domain
} else if (iarea->getToolMode () == TMHand || iarea->getToolMode() == TMPerspective) { // events outside of the image domain
EditSubscriber *editSubscriber = iarea->getCurrSubscriber();
if (editSubscriber && editSubscriber->getEditingType() == ET_OBJECTS) {