mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 16:03:29 +00:00
[Core] Add scalar versions of Vector*
min/max/clamp/snap(ped)
Convenience for a number of cases operating on single values
This commit is contained in:
parent
f91db3dc58
commit
308dbb8c63
73 changed files with 588 additions and 105 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue