You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-07 12:30:27 +00:00
Construct values only when necessary.
This commit is contained in:
@@ -321,12 +321,12 @@ void TextureRegionEditor::_region_input(const Ref<InputEvent> &p_input) {
|
||||
prev_margin = margins[3];
|
||||
}
|
||||
if (edited_margin >= 0) {
|
||||
drag_from = Vector2(mb->get_position().x, mb->get_position().y);
|
||||
drag_from = mb->get_position();
|
||||
drag = true;
|
||||
}
|
||||
}
|
||||
if (edited_margin < 0 && snap_mode == SNAP_AUTOSLICE) {
|
||||
Vector2 point = mtx.affine_inverse().xform(Vector2(mb->get_position().x, mb->get_position().y));
|
||||
Vector2 point = mtx.affine_inverse().xform(mb->get_position());
|
||||
for (const Rect2 &E : autoslice_cache) {
|
||||
if (E.has_point(point)) {
|
||||
rect = E;
|
||||
@@ -372,7 +372,7 @@ void TextureRegionEditor::_region_input(const Ref<InputEvent> &p_input) {
|
||||
}
|
||||
}
|
||||
} else if (edited_margin < 0) {
|
||||
drag_from = mtx.affine_inverse().xform(Vector2(mb->get_position().x, mb->get_position().y));
|
||||
drag_from = mtx.affine_inverse().xform(mb->get_position());
|
||||
if (snap_mode == SNAP_PIXEL) {
|
||||
drag_from = drag_from.snapped(Vector2(1, 1));
|
||||
} else if (snap_mode == SNAP_GRID) {
|
||||
@@ -393,7 +393,7 @@ void TextureRegionEditor::_region_input(const Ref<InputEvent> &p_input) {
|
||||
|
||||
for (int i = 0; i < 8; i++) {
|
||||
Vector2 tuv = endpoints[i];
|
||||
if (tuv.distance_to(Vector2(mb->get_position().x, mb->get_position().y)) < handle_radius) {
|
||||
if (tuv.distance_to(mb->get_position()) < handle_radius) {
|
||||
drag_index = i;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user