summaryrefslogtreecommitdiffstats
path: root/editor/plugins/canvas_item_editor_plugin.cpp
diff options
context:
space:
mode:
authorA Thousand Ships <96648715+AThousandShips@users.noreply.github.com>2024-03-03 14:37:52 +0100
committerA Thousand Ships <96648715+AThousandShips@users.noreply.github.com>2024-05-02 10:31:13 +0200
commit308dbb8c6359589ce7411027cecd777938e40bd7 (patch)
tree80a8cf2eff0d0c1ef1e7e0913b8616e0ee4e376a /editor/plugins/canvas_item_editor_plugin.cpp
parentf91db3dc58f1d6a0cb63d591515183b5a45cd3ba (diff)
downloadredot-engine-308dbb8c6359589ce7411027cecd777938e40bd7.tar.gz
[Core] Add scalar versions of `Vector*` `min/max/clamp/snap(ped)`
Convenience for a number of cases operating on single values
Diffstat (limited to 'editor/plugins/canvas_item_editor_plugin.cpp')
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index 5ac5dd6ee6..79a4269f01 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -467,7 +467,7 @@ Point2 CanvasItemEditor::snap_point(Point2 p_target, unsigned int p_modes, unsig
if (((snap_pixel && (p_modes & SNAP_PIXEL)) || (p_forced_modes & SNAP_PIXEL)) && rotation == 0.0) {
// Pixel
- output = output.snapped(Size2(1, 1));
+ output = output.snappedf(1);
}
snap_transform = Transform2D(rotation, output);
@@ -1625,7 +1625,7 @@ bool CanvasItemEditor::_gui_input_anchors(const Ref<InputEvent> &p_event) {
previous_anchor = xform.affine_inverse().xform(_anchor_to_position(control, previous_anchor));
Vector2 new_anchor = xform.xform(snap_point(previous_anchor + (drag_to - drag_from), SNAP_GRID | SNAP_OTHER_NODES, SNAP_NODE_PARENT | SNAP_NODE_SIDES | SNAP_NODE_CENTER, control));
- new_anchor = _position_to_anchor(control, new_anchor).snapped(Vector2(0.001, 0.001));
+ new_anchor = _position_to_anchor(control, new_anchor).snappedf(0.001);
bool use_single_axis = m->is_shift_pressed();
Vector2 drag_vector = xform.xform(drag_to) - xform.xform(drag_from);