Fix moving path controls in edit mode.

The previous code would never trigger the subsequent conditionals (for
moving the control points) when in EDIT_MODE because the point
conditionals were nested instead of being a conjunction.
This commit is contained in:
Zaven Muradyan 2017-05-27 17:56:20 -07:00
parent 1525071c28
commit f460f82ec1
1 changed files with 7 additions and 9 deletions

View File

@ -94,16 +94,14 @@ bool Path2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
// Check for point movement start (for point + in/out controls). // Check for point movement start (for point + in/out controls).
if (mb->get_button_index() == BUTTON_LEFT) { if (mb->get_button_index() == BUTTON_LEFT) {
if (!mb->get_shift() && mode == MODE_EDIT) { if (mode == MODE_EDIT && !mb->get_shift() && dist_to_p < grab_threshold) {
// Point can only be moved in edit mode. // Points can only be moved in edit mode.
if (dist_to_p < grab_threshold) {
action = ACTION_MOVING_POINT; action = ACTION_MOVING_POINT;
action_point = i; action_point = i;
moving_from = curve->get_point_pos(i); moving_from = curve->get_point_pos(i);
moving_screen_from = gpoint; moving_screen_from = gpoint;
return true; return true;
}
} else if (mode == MODE_EDIT || mode == MODE_EDIT_CURVE) { } else if (mode == MODE_EDIT || mode == MODE_EDIT_CURVE) {
// In/out controls can be moved in multiple modes. // In/out controls can be moved in multiple modes.
if (dist_to_p_out < grab_threshold && i < (curve->get_point_count() - 1)) { if (dist_to_p_out < grab_threshold && i < (curve->get_point_count() - 1)) {