Merge pull request #16018 from volzhs/rotate-line

Rotate Control node with respecting pivot offset
This commit is contained in:
Rémi Verschelde 2018-01-24 08:32:32 +01:00 committed by GitHub
commit 0ecf2fdd51
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1953,9 +1953,9 @@ void CanvasItemEditor::_gui_input_viewport(const Ref<InputEvent> &p_event) {
if (node) {
real_t angle = node->get_rotation();
node->set_rotation(snap_angle(angle + (dfrom - center).angle_to(dto - center), angle));
display_rotate_to = dto;
display_rotate_from = center;
display_rotate_from = center + node->get_pivot_offset().rotated(angle);
node->set_rotation(snap_angle(angle + (dfrom - display_rotate_from).angle_to(display_rotate_to - display_rotate_from), angle));
viewport->update();
}
}