Skip to content

Commit

Permalink
Fix accidental duplication of Polygon2D start point
Browse files Browse the repository at this point in the history
Ensures that closure of Polygon2D in the editor takes into account
Grid Snap if enabled. Does this by comparing the polygon start with
grid snap applied to mouse click location. Note: transformation is
applied in order to deal with different editor zoom levels.

(cherry picked from commit b8d55b2)
  • Loading branch information
mrushyendra authored and akien-mga committed Jun 29, 2020
1 parent cd3a3eb commit 6bd7fd0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion editor/plugins/abstract_polygon_2d_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ bool AbstractPolygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event)

const real_t grab_threshold = EDITOR_GET("editors/poly_editor/point_grab_radius");

if (!_is_line() && wip.size() > 1 && xform.xform(wip[0]).distance_to(gpoint) < grab_threshold) {
if (!_is_line() && wip.size() > 1 && xform.xform(wip[0]).distance_to(xform.xform(cpoint)) < grab_threshold) {
//wip closed
_wip_close();

Expand Down

0 comments on commit 6bd7fd0

Please sign in to comment.