Enable finer grained control when creating polygon with UV Editor
Modifies polygon auto-completion based on UV editor scale, in order to enable finer grained control for the user. Enables selection of points closer than the current threshold of 8 pixels.
This commit is contained in:
parent
3f4e39e606
commit
69d0d89214
|
@ -485,7 +485,8 @@ void Polygon2DEditor::_uv_input(const Ref<InputEvent> &p_input) {
|
||||||
} else {
|
} else {
|
||||||
Vector2 tuv = mtx.affine_inverse().xform(snap_point(Vector2(mb->get_position().x, mb->get_position().y)));
|
Vector2 tuv = mtx.affine_inverse().xform(snap_point(Vector2(mb->get_position().x, mb->get_position().y)));
|
||||||
|
|
||||||
if (points_prev.size() > 2 && tuv.distance_to(points_prev[0]) < 8) {
|
// Close the polygon if selected point is near start. Threshold for closing scaled by zoom level
|
||||||
|
if (points_prev.size() > 2 && tuv.distance_to(points_prev[0]) < (8 / uv_draw_zoom)) {
|
||||||
undo_redo->create_action(TTR("Create Polygon & UV"));
|
undo_redo->create_action(TTR("Create Polygon & UV"));
|
||||||
undo_redo->add_do_method(node, "set_uv", node->get_uv());
|
undo_redo->add_do_method(node, "set_uv", node->get_uv());
|
||||||
undo_redo->add_undo_method(node, "set_uv", uv_create_uv_prev);
|
undo_redo->add_undo_method(node, "set_uv", uv_create_uv_prev);
|
||||||
|
|
Loading…
Reference in New Issue