InputEvent: Renamed "pos" property to "position"

Make the naming consistent with other classes.
This commit is contained in:
Andreas Haas 2017-06-03 10:54:24 +02:00
parent 5a6d4971e1
commit 9bc5348961
No known key found for this signature in database
GPG key ID: B5FFAE1B65FBD2E1
51 changed files with 282 additions and 282 deletions

View file

@ -324,20 +324,20 @@ int InputEventMouse::get_button_mask() const {
return button_mask;
}
void InputEventMouse::set_pos(const Vector2 &p_pos) {
void InputEventMouse::set_position(const Vector2 &p_pos) {
pos = p_pos;
}
Vector2 InputEventMouse::get_pos() const {
Vector2 InputEventMouse::get_position() const {
return pos;
}
void InputEventMouse::set_global_pos(const Vector2 &p_global_pos) {
void InputEventMouse::set_global_position(const Vector2 &p_global_pos) {
global_pos = p_global_pos;
}
Vector2 InputEventMouse::get_global_pos() const {
Vector2 InputEventMouse::get_global_position() const {
return global_pos;
}
@ -347,15 +347,15 @@ void InputEventMouse::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_button_mask", "button_mask"), &InputEventMouse::set_button_mask);
ClassDB::bind_method(D_METHOD("get_button_mask"), &InputEventMouse::get_button_mask);
ClassDB::bind_method(D_METHOD("set_pos", "pos"), &InputEventMouse::set_pos);
ClassDB::bind_method(D_METHOD("get_pos"), &InputEventMouse::get_pos);
ClassDB::bind_method(D_METHOD("set_position", "position"), &InputEventMouse::set_position);
ClassDB::bind_method(D_METHOD("get_position"), &InputEventMouse::get_position);
ClassDB::bind_method(D_METHOD("set_global_pos", "global_pos"), &InputEventMouse::set_global_pos);
ClassDB::bind_method(D_METHOD("get_global_pos"), &InputEventMouse::get_global_pos);
ClassDB::bind_method(D_METHOD("set_global_position", "global_position"), &InputEventMouse::set_global_position);
ClassDB::bind_method(D_METHOD("get_global_position"), &InputEventMouse::get_global_position);
ADD_PROPERTY(PropertyInfo(Variant::INT, "button_mask"), "set_button_mask", "get_button_mask");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "pos"), "set_pos", "get_pos");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "global_pos"), "set_global_pos", "get_global_pos");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "position"), "set_position", "get_position");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "global_position"), "set_global_position", "get_global_position");
}
InputEventMouse::InputEventMouse() {
@ -404,8 +404,8 @@ bool InputEventMouseButton::is_doubleclick() const {
Ref<InputEvent> InputEventMouseButton::xformed_by(const Transform2D &p_xform, const Vector2 &p_local_ofs) const {
Vector2 g = p_xform.xform(get_global_pos());
Vector2 l = p_xform.xform(get_pos() + p_local_ofs);
Vector2 g = p_xform.xform(get_global_position());
Vector2 l = p_xform.xform(get_position() + p_local_ofs);
Ref<InputEventMouseButton> mb;
mb.instance();
@ -418,8 +418,8 @@ Ref<InputEvent> InputEventMouseButton::xformed_by(const Transform2D &p_xform, co
mb->set_control(get_control());
mb->set_metakey(get_metakey());
mb->set_pos(l);
mb->set_global_pos(g);
mb->set_position(l);
mb->set_global_position(g);
mb->set_button_mask(get_button_mask());
mb->set_pressed(pressed);
@ -489,8 +489,8 @@ Vector2 InputEventMouseMotion::get_speed() const {
Ref<InputEvent> InputEventMouseMotion::xformed_by(const Transform2D &p_xform, const Vector2 &p_local_ofs) const {
Vector2 g = p_xform.xform(get_global_pos());
Vector2 l = p_xform.xform(get_pos() + p_local_ofs);
Vector2 g = p_xform.xform(get_global_position());
Vector2 l = p_xform.xform(get_position() + p_local_ofs);
Vector2 r = p_xform.basis_xform(get_relative());
Vector2 s = p_xform.basis_xform(get_speed());
@ -505,8 +505,8 @@ Ref<InputEvent> InputEventMouseMotion::xformed_by(const Transform2D &p_xform, co
mm->set_control(get_control());
mm->set_metakey(get_metakey());
mm->set_pos(l);
mm->set_global_pos(g);
mm->set_position(l);
mm->set_global_position(g);
mm->set_button_mask(get_button_mask());
mm->set_relative(r);
@ -650,11 +650,11 @@ int InputEventScreenTouch::get_index() const {
return index;
}
void InputEventScreenTouch::set_pos(const Vector2 &p_pos) {
void InputEventScreenTouch::set_position(const Vector2 &p_pos) {
pos = p_pos;
}
Vector2 InputEventScreenTouch::get_pos() const {
Vector2 InputEventScreenTouch::get_position() const {
return pos;
}
@ -675,7 +675,7 @@ Ref<InputEvent> InputEventScreenTouch::xformed_by(const Transform2D &p_xform, co
st->set_id(get_id());
st->set_device(get_device());
st->set_index(index);
st->set_pos(p_xform.xform(pos + p_local_ofs));
st->set_position(p_xform.xform(pos + p_local_ofs));
st->set_pressed(pressed);
return st;
@ -686,14 +686,14 @@ void InputEventScreenTouch::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_index", "index"), &InputEventScreenTouch::set_index);
ClassDB::bind_method(D_METHOD("get_index"), &InputEventScreenTouch::get_index);
ClassDB::bind_method(D_METHOD("set_pos", "pos"), &InputEventScreenTouch::set_pos);
ClassDB::bind_method(D_METHOD("get_pos"), &InputEventScreenTouch::get_pos);
ClassDB::bind_method(D_METHOD("set_position", "pos"), &InputEventScreenTouch::set_position);
ClassDB::bind_method(D_METHOD("get_position"), &InputEventScreenTouch::get_position);
ClassDB::bind_method(D_METHOD("set_pressed", "pressed"), &InputEventScreenTouch::set_pressed);
//ClassDB::bind_method(D_METHOD("is_pressed"),&InputEventScreenTouch::is_pressed);
ADD_PROPERTY(PropertyInfo(Variant::INT, "index"), "set_index", "get_index");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "pos"), "set_pos", "get_pos");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "position"), "set_position", "get_position");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "pressed"), "set_pressed", "is_pressed");
}
@ -715,11 +715,11 @@ int InputEventScreenDrag::get_index() const {
return index;
}
void InputEventScreenDrag::set_pos(const Vector2 &p_pos) {
void InputEventScreenDrag::set_position(const Vector2 &p_pos) {
pos = p_pos;
}
Vector2 InputEventScreenDrag::get_pos() const {
Vector2 InputEventScreenDrag::get_position() const {
return pos;
}
@ -752,7 +752,7 @@ Ref<InputEvent> InputEventScreenDrag::xformed_by(const Transform2D &p_xform, con
sd->set_device(get_device());
sd->set_index(index);
sd->set_pos(p_xform.xform(pos + p_local_ofs));
sd->set_position(p_xform.xform(pos + p_local_ofs));
sd->set_relative(p_xform.basis_xform(relative));
sd->set_speed(p_xform.basis_xform(speed));
@ -764,8 +764,8 @@ void InputEventScreenDrag::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_index", "index"), &InputEventScreenDrag::set_index);
ClassDB::bind_method(D_METHOD("get_index"), &InputEventScreenDrag::get_index);
ClassDB::bind_method(D_METHOD("set_pos", "pos"), &InputEventScreenDrag::set_pos);
ClassDB::bind_method(D_METHOD("get_pos"), &InputEventScreenDrag::get_pos);
ClassDB::bind_method(D_METHOD("set_position", "position"), &InputEventScreenDrag::set_position);
ClassDB::bind_method(D_METHOD("get_position"), &InputEventScreenDrag::get_position);
ClassDB::bind_method(D_METHOD("set_relative", "relative"), &InputEventScreenDrag::set_relative);
ClassDB::bind_method(D_METHOD("get_relative"), &InputEventScreenDrag::get_relative);
@ -774,7 +774,7 @@ void InputEventScreenDrag::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_speed"), &InputEventScreenDrag::get_speed);
ADD_PROPERTY(PropertyInfo(Variant::INT, "index"), "set_index", "get_index");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "pos"), "set_pos", "get_pos");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "position"), "set_position", "get_position");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "relative"), "set_relative", "get_relative");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "speed"), "set_speed", "get_speed");
}

View file

@ -265,11 +265,11 @@ public:
void set_button_mask(int p_mask);
int get_button_mask() const;
void set_pos(const Vector2 &p_pos);
Vector2 get_pos() const;
void set_position(const Vector2 &p_pos);
Vector2 get_position() const;
void set_global_pos(const Vector2 &p_global_pos);
Vector2 get_global_pos() const;
void set_global_position(const Vector2 &p_global_pos);
Vector2 get_global_position() const;
InputEventMouse();
};
@ -390,8 +390,8 @@ public:
void set_index(int p_index);
int get_index() const;
void set_pos(const Vector2 &p_pos);
Vector2 get_pos() const;
void set_position(const Vector2 &p_pos);
Vector2 get_position() const;
void set_pressed(bool p_pressed);
virtual bool is_pressed() const;
@ -416,8 +416,8 @@ public:
void set_index(int p_index);
int get_index() const;
void set_pos(const Vector2 &p_pos);
Vector2 get_pos() const;
void set_position(const Vector2 &p_pos);
Vector2 get_position() const;
void set_relative(const Vector2 &p_relative);
Vector2 get_relative() const;

View file

@ -1900,13 +1900,13 @@ void AnimationKeyEditor::_track_editor_gui_input(const Ref<InputEvent> &p_input)
if (mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed()) {
Point2 mpos = mb->get_pos() - ofs;
Point2 mpos = mb->get_position() - ofs;
if (selection.size() == 0) {
// Auto-select on right-click if nothing is selected
// Note: This code is pretty much duplicated from the left click code,
// both codes could be moved into a function to avoid the duplicated code.
Point2 mpos = mb->get_pos() - ofs;
Point2 mpos = mb->get_position() - ofs;
if (mpos.y < h) {
return;
@ -1951,7 +1951,7 @@ void AnimationKeyEditor::_track_editor_gui_input(const Ref<InputEvent> &p_input)
if (key == -1) {
click.click = ClickOver::CLICK_SELECT_KEYS;
click.at = mb->get_pos();
click.at = mb->get_position();
click.to = click.at;
click.shift = mb->get_shift();
selected_track = idx;
@ -1974,7 +1974,7 @@ void AnimationKeyEditor::_track_editor_gui_input(const Ref<InputEvent> &p_input)
selection.insert(sk, ki);
click.click = ClickOver::CLICK_MOVE_KEYS;
click.at = mb->get_pos();
click.at = mb->get_position();
click.to = click.at;
update();
selected_track = idx;
@ -2009,14 +2009,14 @@ void AnimationKeyEditor::_track_editor_gui_input(const Ref<InputEvent> &p_input)
if (mb->is_pressed()) {
Point2 mpos = mb->get_pos() - ofs;
Point2 mpos = mb->get_position() - ofs;
if (mpos.y < h) {
if (mpos.x < name_limit && mpos.x > (name_limit - hsep - hsize_icon->get_width())) {
click.click = ClickOver::CLICK_RESIZE_NAMES;
click.at = mb->get_pos();
click.at = mb->get_position();
click.to = click.at;
click.at.y = name_limit;
}
@ -2035,7 +2035,7 @@ void AnimationKeyEditor::_track_editor_gui_input(const Ref<InputEvent> &p_input)
pos = animation->get_length();
timeline_pos = pos;
click.click = ClickOver::CLICK_DRAG_TIMELINE;
click.at = mb->get_pos();
click.at = mb->get_position();
click.to = click.at;
emit_signal("timeline_changed", pos, false);
}
@ -2055,7 +2055,7 @@ void AnimationKeyEditor::_track_editor_gui_input(const Ref<InputEvent> &p_input)
if (mpos.x >= name_limit && mpos.x < settings_limit) {
click.click = ClickOver::CLICK_SELECT_KEYS;
click.at = mb->get_pos();
click.at = mb->get_position();
click.to = click.at;
//drag select region
}
@ -2115,7 +2115,7 @@ void AnimationKeyEditor::_track_editor_gui_input(const Ref<InputEvent> &p_input)
if (key == -1) {
click.click = ClickOver::CLICK_SELECT_KEYS;
click.at = mb->get_pos();
click.at = mb->get_position();
click.to = click.at;
click.shift = mb->get_shift();
selected_track = idx;
@ -2138,7 +2138,7 @@ void AnimationKeyEditor::_track_editor_gui_input(const Ref<InputEvent> &p_input)
selection.insert(sk, ki);
click.click = ClickOver::CLICK_MOVE_KEYS;
click.at = mb->get_pos();
click.at = mb->get_position();
click.to = click.at;
update();
selected_track = idx;
@ -2601,7 +2601,7 @@ void AnimationKeyEditor::_track_editor_gui_input(const Ref<InputEvent> &p_input)
float clickp = click.at.x - ofs.x;
float dif = base - clickp;
float target = mm->get_pos().x + dif - ofs.x;
float target = mm->get_position().x + dif - ofs.x;
float ratio = target / settings_limit;
@ -2615,7 +2615,7 @@ void AnimationKeyEditor::_track_editor_gui_input(const Ref<InputEvent> &p_input)
} break;
case ClickOver::CLICK_DRAG_TIMELINE: {
Point2 mpos = mm->get_pos() - ofs;
Point2 mpos = mm->get_position() - ofs;
/*
if (mpos.x<name_limit)
mpos.x=name_limit;
@ -2646,7 +2646,7 @@ void AnimationKeyEditor::_track_editor_gui_input(const Ref<InputEvent> &p_input)
} break;
case ClickOver::CLICK_SELECT_KEYS: {
click.to = mm->get_pos();
click.to = mm->get_position();
if (click.to.y < h && click.at.y > h && mm->get_relative().y < 0) {
float prev = v_scroll->get_value();
@ -2665,7 +2665,7 @@ void AnimationKeyEditor::_track_editor_gui_input(const Ref<InputEvent> &p_input)
} break;
case ClickOver::CLICK_MOVE_KEYS: {
click.to = mm->get_pos();
click.to = mm->get_position();
} break;
default: {}
}
@ -2680,7 +2680,7 @@ void AnimationKeyEditor::_track_editor_gui_input(const Ref<InputEvent> &p_input)
if (mm->get_button_mask() == 0) {
Point2 mpos = mm->get_pos() - ofs;
Point2 mpos = mm->get_position() - ofs;
if (mpos.y < h) {
#if 0

View file

@ -396,7 +396,7 @@ void EditorAudioBus::_gui_input(const Ref<InputEvent> &p_event) {
Ref<InputEventMouseButton> mb = p_event;
if (mb.is_valid() && mb->get_button_index() == 2 && mb->is_pressed()) {
Vector2 pos = Vector2(mb->get_pos().x, mb->get_pos().y);
Vector2 pos = Vector2(mb->get_position().x, mb->get_position().y);
delete_popup->set_position(get_global_position() + pos);
delete_popup->popup();
}

View file

@ -3736,7 +3736,7 @@ void EditorNode::_dock_select_input(const Ref<InputEvent> &p_input) {
if (me.is_valid()) {
Vector2 point = me->get_pos();
Vector2 point = me->get_position();
int nrect = -1;
for (int i = 0; i < DOCK_SLOT_MAX; i++) {

View file

@ -496,7 +496,7 @@ void EditorProfiler::_graph_tex_input(const Ref<InputEvent> &p_ev) {
(mb.is_valid() && mb->get_button_index() == BUTTON_LEFT && mb->is_pressed()) ||
(mm.is_valid())) {
int x = me->get_pos().x;
int x = me->get_position().x;
x = x * frame_metrics.size() / graph->get_size().width;
bool show_hover = x >= 0 && x < frame_metrics.size();

View file

@ -744,7 +744,7 @@ void AnimationTreeEditor::_gui_input(Ref<InputEvent> p_event) {
if (mb->is_pressed()) {
if (mb->get_button_index() == 1) {
click_pos = Point2(mb->get_pos().x, mb->get_pos().y);
click_pos = Point2(mb->get_position().x, mb->get_position().y);
click_motion = click_pos;
click_type = _locate_click(click_pos, &click_node, &click_slot);
if (click_type != CLICK_NONE) {
@ -780,7 +780,7 @@ void AnimationTreeEditor::_gui_input(Ref<InputEvent> p_event) {
} else {
// try to disconnect/remove
Point2 rclick_pos = Point2(mb->get_pos().x, mb->get_pos().y);
Point2 rclick_pos = Point2(mb->get_position().x, mb->get_position().y);
rclick_type = _locate_click(rclick_pos, &rclick_node, &rclick_slot);
if (rclick_type == CLICK_INPUT_SLOT || rclick_type == CLICK_OUTPUT_SLOT) {
@ -820,7 +820,7 @@ void AnimationTreeEditor::_gui_input(Ref<InputEvent> p_event) {
case CLICK_INPUT_SLOT:
case CLICK_OUTPUT_SLOT: {
Point2 dst_click_pos = Point2(mb->get_pos().x, mb->get_pos().y);
Point2 dst_click_pos = Point2(mb->get_position().x, mb->get_position().y);
StringName id;
int slot;
ClickType dst_click_type = _locate_click(dst_click_pos, &id, &slot);
@ -859,7 +859,7 @@ void AnimationTreeEditor::_gui_input(Ref<InputEvent> p_event) {
if (mm->get_button_mask() & 1 && click_type != CLICK_NONE) {
click_motion = Point2(mm->get_pos().x, mm->get_pos().y);
click_motion = Point2(mm->get_position().x, mm->get_position().y);
update();
}
if ((mm->get_button_mask() & 4 || Input::get_singleton()->is_key_pressed(KEY_SPACE))) {

View file

@ -962,7 +962,7 @@ bool CanvasItemEditor::get_remove_list(List<Node *> *p_list) {
void CanvasItemEditor::_list_select(const Ref<InputEventMouseButton> &b) {
Point2 click = b->get_pos();
Point2 click = b->get_position();
Node *scene = editor->get_edited_scene();
if (!scene)
@ -1016,7 +1016,7 @@ void CanvasItemEditor::_list_select(const Ref<InputEventMouseButton> &b) {
additive_selection = b->get_shift();
selection_menu->set_global_position(b->get_global_pos());
selection_menu->set_global_position(b->get_global_position());
selection_menu->popup();
selection_menu->call_deferred("grab_click_focus");
selection_menu->set_invalidate_click_until_motion();
@ -1053,7 +1053,7 @@ void CanvasItemEditor::_viewport_gui_input(const Ref<InputEvent> &p_event) {
float prev_zoom = zoom;
zoom = zoom * (1 - (0.05 * b->get_factor()));
{
Point2 ofs = b->get_pos();
Point2 ofs = b->get_position();
ofs = ofs / prev_zoom - ofs / zoom;
h_scroll->set_value(h_scroll->get_value() + ofs.x);
v_scroll->set_value(v_scroll->get_value() + ofs.y);
@ -1071,7 +1071,7 @@ void CanvasItemEditor::_viewport_gui_input(const Ref<InputEvent> &p_event) {
float prev_zoom = zoom;
zoom = zoom * ((0.95 + (0.05 * b->get_factor())) / 0.95);
{
Point2 ofs = b->get_pos();
Point2 ofs = b->get_position();
ofs = ofs / prev_zoom - ofs / zoom;
h_scroll->set_value(h_scroll->get_value() + ofs.x);
v_scroll->set_value(v_scroll->get_value() + ofs.y);
@ -1156,7 +1156,7 @@ void CanvasItemEditor::_viewport_gui_input(const Ref<InputEvent> &p_event) {
if (b->get_button_index() == BUTTON_LEFT && tool == TOOL_EDIT_PIVOT) {
if (b->is_pressed()) {
Point2 mouse_pos = b->get_pos();
Point2 mouse_pos = b->get_position();
mouse_pos = transform.affine_inverse().xform(mouse_pos);
mouse_pos = snap_point(mouse_pos);
_edit_set_pivot(mouse_pos);
@ -1274,8 +1274,8 @@ void CanvasItemEditor::_viewport_gui_input(const Ref<InputEvent> &p_event) {
E->get().to
};
Vector2 p = Geometry::get_closest_point_to_segment_2d(b->get_pos(), s);
float d = p.distance_to(b->get_pos());
Vector2 p = Geometry::get_closest_point_to_segment_2d(b->get_position(), s);
float d = p.distance_to(b->get_position());
if (d < bone_width && d < closest_dist) {
Cbone = E;
closest_dist = d;
@ -1342,7 +1342,7 @@ void CanvasItemEditor::_viewport_gui_input(const Ref<InputEvent> &p_event) {
CanvasItemEditorSelectedItem *se = editor_selection->get_node_editor_data<CanvasItemEditorSelectedItem>(canvas_item);
ERR_FAIL_COND(!se);
Point2 click = b->get_pos();
Point2 click = b->get_position();
if ((b->get_control() && tool == TOOL_SELECT) || tool == TOOL_ROTATE) {
@ -1388,7 +1388,7 @@ void CanvasItemEditor::_viewport_gui_input(const Ref<InputEvent> &p_event) {
//multi canvas_item edit
Point2 click = b->get_pos();
Point2 click = b->get_position();
if ((b->get_alt() || tool == TOOL_MOVE) && get_item_count()) {
_prepare_drag(click);
@ -1451,7 +1451,7 @@ void CanvasItemEditor::_viewport_gui_input(const Ref<InputEvent> &p_event) {
if (box_selecting) {
box_selecting_to = transform.affine_inverse().xform(m->get_pos());
box_selecting_to = transform.affine_inverse().xform(m->get_position());
viewport->update();
return;
}
@ -1497,7 +1497,7 @@ void CanvasItemEditor::_viewport_gui_input(const Ref<InputEvent> &p_event) {
}
Vector2 dfrom = drag_from;
Vector2 dto = transform.affine_inverse().xform(m->get_pos());
Vector2 dto = transform.affine_inverse().xform(m->get_position());
if (canvas_item->has_meta("_edit_lock_"))
continue;

View file

@ -104,7 +104,7 @@ bool CollisionPolygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event)
if (mb.is_valid()) {
Transform2D xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform();
Vector2 gpoint = mb->get_pos();
Vector2 gpoint = mb->get_position();
Vector2 cpoint = canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint);
cpoint = canvas_item_editor->snap_point(cpoint);
cpoint = node->get_global_transform().affine_inverse().xform(cpoint);
@ -289,7 +289,7 @@ bool CollisionPolygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event)
if (edited_point != -1 && (wip_active || mm->get_button_mask() & BUTTON_MASK_LEFT)) {
Vector2 gpoint = mm->get_pos();
Vector2 gpoint = mm->get_position();
Vector2 cpoint = canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint);
cpoint = canvas_item_editor->snap_point(cpoint);
edited_point_pos = node->get_global_transform().affine_inverse().xform(cpoint);

View file

@ -322,7 +322,7 @@ bool CollisionShape2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
Transform2D gt = canvas_item_editor->get_canvas_transform() * node->get_global_transform();
Point2 gpoint(mb->get_pos().x, mb->get_pos().y);
Point2 gpoint(mb->get_position().x, mb->get_position().y);
if (mb->get_button_index() == BUTTON_LEFT) {
if (mb->is_pressed()) {
@ -368,7 +368,7 @@ bool CollisionShape2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
return false;
}
Point2 gpoint = mm->get_pos();
Point2 gpoint = mm->get_position();
Point2 cpoint = canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint);
cpoint = canvas_item_editor->snap_point(cpoint);
cpoint = node->get_global_transform().affine_inverse().xform(cpoint);

View file

@ -57,7 +57,7 @@ void CurveTextureEdit::_gui_input(const Ref<InputEvent> &p_event) {
Vector2 size = get_size();
size.y -= font_h;
Point2 p = Vector2(mb->get_pos().x, mb->get_pos().y) / size;
Point2 p = Vector2(mb->get_position().x, mb->get_position().y) / size;
p.y = CLAMP(1.0 - p.y, 0, 1) * (max - min) + min;
grabbed = -1;
grabbing = true;
@ -111,7 +111,7 @@ void CurveTextureEdit::_gui_input(const Ref<InputEvent> &p_event) {
Vector2 size = get_size();
size.y -= font_h;
Point2 p = mm->get_pos() / size;
Point2 p = mm->get_position() / size;
p.y = CLAMP(1.0 - p.y, 0, 1) * (max - min) + min;
p.x = CLAMP(p.x, 0.0, 1.0);

View file

@ -94,14 +94,14 @@ void GradientTextureEdit::_gui_input(const Ref<InputEvent> &p_event) {
Ref<InputEventMouseButton> mb = p_event;
//Show color picker on double click.
if (mb.is_valid() && mb->get_button_index() == 1 && mb->is_doubleclick() && mb->is_pressed()) {
grabbed = _get_point_from_pos(mb->get_pos().x);
grabbed = _get_point_from_pos(mb->get_position().x);
_show_color_picker();
accept_event();
}
//Delete point on right click
if (mb.is_valid() && mb->get_button_index() == 2 && mb->is_pressed()) {
grabbed = _get_point_from_pos(mb->get_pos().x);
grabbed = _get_point_from_pos(mb->get_position().x);
if (grabbed != -1) {
points.remove(grabbed);
grabbed = -1;
@ -115,7 +115,7 @@ void GradientTextureEdit::_gui_input(const Ref<InputEvent> &p_event) {
//Hold alt key to duplicate selected color
if (mb.is_valid() && mb->get_button_index() == 1 && mb->is_pressed() && mb->get_alt()) {
int x = mb->get_pos().x;
int x = mb->get_position().x;
grabbed = _get_point_from_pos(x);
if (grabbed != -1) {
@ -140,7 +140,7 @@ void GradientTextureEdit::_gui_input(const Ref<InputEvent> &p_event) {
if (mb.is_valid() && mb->get_button_index() == 1 && mb->is_pressed()) {
update();
int x = mb->get_pos().x;
int x = mb->get_position().x;
int total_w = get_size().width - get_size().height - 3;
//Check if color selector was clicked.
@ -220,7 +220,7 @@ void GradientTextureEdit::_gui_input(const Ref<InputEvent> &p_event) {
int total_w = get_size().width - get_size().height - 3;
int x = mm->get_pos().x;
int x = mm->get_position().x;
float newofs = CLAMP(x / float(total_w), 0, 1);
//Snap to nearest point if holding shift

View file

@ -118,7 +118,7 @@ bool LightOccluder2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
Transform2D xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform();
Vector2 gpoint = mb->get_pos();
Vector2 gpoint = mb->get_position();
Vector2 cpoint = canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint);
cpoint = canvas_item_editor->snap_point(cpoint);
cpoint = node->get_global_transform().affine_inverse().xform(cpoint);
@ -308,7 +308,7 @@ bool LightOccluder2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
if (edited_point != -1 && (wip_active || mm->get_button_mask() & BUTTON_MASK_LEFT)) {
Vector2 gpoint = mm->get_pos();
Vector2 gpoint = mm->get_position();
Vector2 cpoint = canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint);
cpoint = canvas_item_editor->snap_point(cpoint);
edited_point_pos = node->get_global_transform().affine_inverse().xform(cpoint);

View file

@ -87,7 +87,7 @@ bool Line2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
if (mb.is_valid()) {
Vector2 gpoint = mb->get_pos();
Vector2 gpoint = mb->get_position();
Vector2 cpoint = mouse_to_local_pos(gpoint, mb->get_alt());
if (mb->is_pressed() && _dragging == false) {
@ -146,7 +146,7 @@ bool Line2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
if (mm.is_valid()) {
if (_dragging) {
Vector2 cpoint = mouse_to_local_pos(mm->get_pos(), mm->get_alt());
Vector2 cpoint = mouse_to_local_pos(mm->get_position(), mm->get_alt());
node->set_point_pos(action_point, cpoint);
canvas_item_editor->get_viewport_control()->update();
return true;

View file

@ -134,7 +134,7 @@ bool NavigationPolygonEditor::forward_gui_input(const Ref<InputEvent> &p_event)
Transform2D xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform();
Vector2 gpoint = mb->get_pos();
Vector2 gpoint = mb->get_position();
Vector2 cpoint = canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint);
cpoint = canvas_item_editor->snap_point(cpoint);
cpoint = node->get_global_transform().affine_inverse().xform(cpoint);
@ -361,7 +361,7 @@ bool NavigationPolygonEditor::forward_gui_input(const Ref<InputEvent> &p_event)
if (edited_point != -1 && (wip_active || mm->get_button_mask() & BUTTON_MASK_LEFT)) {
Vector2 gpoint = mm->get_pos();
Vector2 gpoint = mm->get_position();
Vector2 cpoint = canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint);
cpoint = canvas_item_editor->snap_point(cpoint);
edited_point_pos = node->get_global_transform().affine_inverse().xform(cpoint);

View file

@ -74,7 +74,7 @@ bool Path2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
Transform2D xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform();
Vector2 gpoint = mb->get_pos();
Vector2 gpoint = mb->get_position();
Vector2 cpoint =
!mb->get_alt() ?
canvas_item_editor->snap_point(xform.affine_inverse().xform(gpoint)) :
@ -431,7 +431,7 @@ bool Path2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
if (action != ACTION_NONE) {
// Handle point/control movement.
Transform2D xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform();
Vector2 gpoint = mm->get_pos();
Vector2 gpoint = mm->get_position();
Vector2 cpoint =
!mm->get_alt() ?
canvas_item_editor->snap_point(xform.affine_inverse().xform(gpoint)) :

View file

@ -285,7 +285,7 @@ bool PathEditorPlugin::forward_spatial_gui_input(Camera *p_camera, const Ref<Inp
if (mb.is_valid()) {
Point2 mbpos(mb->get_pos().x, mb->get_pos().y);
Point2 mbpos(mb->get_position().x, mb->get_position().y);
if (mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT && (curve_create->is_pressed() || (curve_edit->is_pressed() && mb->get_control()))) {
//click into curve, break it down

View file

@ -212,7 +212,7 @@ bool Polygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
Transform2D xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform();
Vector2 gpoint = mb->get_pos();
Vector2 gpoint = mb->get_position();
Vector2 cpoint = canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint);
cpoint = canvas_item_editor->snap_point(cpoint);
cpoint = node->get_global_transform().affine_inverse().xform(cpoint);
@ -397,7 +397,7 @@ bool Polygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
if (edited_point != -1 && (wip_active || mm->get_button_mask() & BUTTON_MASK_LEFT)) {
Vector2 gpoint = mm->get_pos();
Vector2 gpoint = mm->get_position();
Vector2 cpoint = canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint);
cpoint = canvas_item_editor->snap_point(cpoint);
edited_point_pos = node->get_global_transform().affine_inverse().xform(cpoint);
@ -465,7 +465,7 @@ void Polygon2DEditor::_uv_input(const Ref<InputEvent> &p_input) {
if (mb->is_pressed()) {
uv_drag_from = Vector2(mb->get_pos().x, mb->get_pos().y);
uv_drag_from = Vector2(mb->get_position().x, mb->get_position().y);
uv_drag = true;
uv_prev = node->get_uv();
uv_move_current = uv_mode;
@ -485,7 +485,7 @@ void Polygon2DEditor::_uv_input(const Ref<InputEvent> &p_input) {
for (int i = 0; i < uv_prev.size(); i++) {
Vector2 tuv = mtx.xform(uv_prev[i]);
if (tuv.distance_to(Vector2(mb->get_pos().x, mb->get_pos().y)) < 8) {
if (tuv.distance_to(Vector2(mb->get_position().x, mb->get_position().y)) < 8) {
uv_drag_from = tuv;
uv_drag_index = i;
}
@ -537,7 +537,7 @@ void Polygon2DEditor::_uv_input(const Ref<InputEvent> &p_input) {
} else if (uv_drag) {
Vector2 uv_drag_to = mm->get_pos();
Vector2 uv_drag_to = mm->get_position();
Vector2 drag = mtx.affine_inverse().xform(uv_drag_to) - mtx.affine_inverse().xform(uv_drag_from);
switch (uv_move_current) {

View file

@ -1236,8 +1236,8 @@ void ScriptTextEditor::_text_edit_gui_input(const Ref<InputEvent> &ev) {
int col, row;
TextEdit *tx = code_editor->get_text_edit();
tx->_get_mouse_pos(mb->get_global_pos() - tx->get_global_position(), row, col);
Vector2 mpos = mb->get_global_pos() - tx->get_global_position();
tx->_get_mouse_pos(mb->get_global_position() - tx->get_global_position(), row, col);
Vector2 mpos = mb->get_global_position() - tx->get_global_position();
bool have_selection = (tx->get_selection_text().length() > 0);
bool have_color = (tx->get_word_at_pos(mpos) == "Color");
if (have_color) {

View file

@ -636,7 +636,7 @@ void SpatialEditorViewport::_smouseenter() {
void SpatialEditorViewport::_list_select(Ref<InputEventMouseButton> b) {
_find_items_at_pos(b->get_pos(), clicked_includes_current, selection_results, b->get_shift());
_find_items_at_pos(b->get_position(), clicked_includes_current, selection_results, b->get_shift());
Node *scene = editor->get_edited_scene();
@ -684,7 +684,7 @@ void SpatialEditorViewport::_list_select(Ref<InputEventMouseButton> b) {
selection_menu->set_item_tooltip(i, String(spat->get_name()) + "\nType: " + spat->get_class() + "\nPath: " + node_path);
}
selection_menu->set_global_position(b->get_global_pos());
selection_menu->set_global_position(b->get_global_position());
selection_menu->popup();
selection_menu->call_deferred("grab_click_focus");
selection_menu->set_invalidate_click_until_motion();
@ -818,7 +818,7 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
break;
}
_edit.mouse_pos = b->get_pos();
_edit.mouse_pos = b->get_position();
_edit.snap = false;
_edit.mode = TRANSFORM_NONE;
@ -863,7 +863,7 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
break; //bye
//handle rotate
_edit.mode = TRANSFORM_ROTATE;
_compute_edit(b->get_pos());
_compute_edit(b->get_position());
break;
}
@ -873,7 +873,7 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
break; //bye
//handle rotate
_edit.mode = TRANSFORM_TRANSLATE;
_compute_edit(b->get_pos());
_compute_edit(b->get_position());
break;
}
@ -883,7 +883,7 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
break; //bye
//handle rotate
_edit.mode = TRANSFORM_SCALE;
_compute_edit(b->get_pos());
_compute_edit(b->get_position());
break;
}
@ -891,7 +891,7 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
int gizmo_handle = -1;
clicked = _select_ray(b->get_pos(), b->get_shift(), clicked_includes_current, &gizmo_handle, b->get_shift());
clicked = _select_ray(b->get_position(), b->get_shift(), clicked_includes_current, &gizmo_handle, b->get_shift());
//clicking is always deferred to either move or release
@ -904,8 +904,8 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
//default to regionselect
cursor.region_select = true;
cursor.region_begin = b->get_pos();
cursor.region_end = b->get_pos();
cursor.region_begin = b->get_position();
cursor.region_end = b->get_position();
}
if (clicked && gizmo_handle >= 0) {
@ -989,7 +989,7 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
if (m.is_valid()) {
_edit.mouse_pos = m->get_pos();
_edit.mouse_pos = m->get_position();
if (spatial_editor->get_selected()) {
@ -1026,7 +1026,7 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
if (_edit.gizmo.is_valid()) {
_edit.gizmo->set_handle(_edit.gizmo_handle, camera, m->get_pos());
_edit.gizmo->set_handle(_edit.gizmo_handle, camera, m->get_position());
Variant v = _edit.gizmo->get_handle_value(_edit.gizmo_handle);
String n = _edit.gizmo->get_handle_name(_edit.gizmo_handle);
set_message(n + ": " + String(v));
@ -1058,7 +1058,7 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
if (cursor.region_select && nav_mode == NAVIGATION_NONE) {
cursor.region_end = m->get_pos();
cursor.region_end = m->get_position();
surface->update();
return;
}
@ -1066,8 +1066,8 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
if (_edit.mode == TRANSFORM_NONE && nav_mode == NAVIGATION_NONE)
return;
Vector3 ray_pos = _get_ray_pos(m->get_pos());
Vector3 ray = _get_ray(m->get_pos());
Vector3 ray_pos = _get_ray_pos(m->get_position());
Vector3 ray = _get_ray(m->get_position());
switch (_edit.mode) {

View file

@ -244,26 +244,26 @@ void TextureRegionEditor::_region_input(const Ref<InputEvent> &p_input) {
mtx.basis_xform(rect.pos + Vector2(margins[2], 0)) - draw_ofs,
mtx.basis_xform(rect.pos + rect.size - Vector2(margins[3], 0)) - draw_ofs
};
if (Math::abs(mb->get_pos().y - pos[0].y) < 8) {
if (Math::abs(mb->get_position().y - pos[0].y) < 8) {
edited_margin = 0;
prev_margin = margins[0];
} else if (Math::abs(mb->get_pos().y - pos[1].y) < 8) {
} else if (Math::abs(mb->get_position().y - pos[1].y) < 8) {
edited_margin = 1;
prev_margin = margins[1];
} else if (Math::abs(mb->get_pos().x - pos[2].x) < 8) {
} else if (Math::abs(mb->get_position().x - pos[2].x) < 8) {
edited_margin = 2;
prev_margin = margins[2];
} else if (Math::abs(mb->get_pos().x - pos[3].x) < 8) {
} else if (Math::abs(mb->get_position().x - pos[3].x) < 8) {
edited_margin = 3;
prev_margin = margins[3];
}
if (edited_margin >= 0) {
drag_from = Vector2(mb->get_pos().x, mb->get_pos().y);
drag_from = Vector2(mb->get_position().x, mb->get_position().y);
drag = true;
}
}
if (edited_margin < 0 && snap_mode == SNAP_AUTOSLICE) {
Vector2 point = mtx.affine_inverse().xform(Vector2(mb->get_pos().x, mb->get_pos().y));
Vector2 point = mtx.affine_inverse().xform(Vector2(mb->get_position().x, mb->get_position().y));
for (List<Rect2>::Element *E = autoslice_cache.front(); E; E = E->next()) {
if (E->get().has_point(point)) {
rect = E->get();
@ -301,7 +301,7 @@ void TextureRegionEditor::_region_input(const Ref<InputEvent> &p_input) {
}
}
} else if (edited_margin < 0) {
drag_from = mtx.affine_inverse().xform(Vector2(mb->get_pos().x, mb->get_pos().y));
drag_from = mtx.affine_inverse().xform(Vector2(mb->get_position().x, mb->get_position().y));
if (snap_mode == SNAP_PIXEL)
drag_from = drag_from.snapped(Vector2(1, 1));
else if (snap_mode == SNAP_GRID)
@ -318,7 +318,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_pos().x, mb->get_pos().y)) < 8) {
if (tuv.distance_to(Vector2(mb->get_position().x, mb->get_position().y)) < 8) {
drag_index = i;
}
}
@ -408,13 +408,13 @@ void TextureRegionEditor::_region_input(const Ref<InputEvent> &p_input) {
if (edited_margin >= 0) {
float new_margin;
if (edited_margin == 0)
new_margin = prev_margin + (mm->get_pos().y - drag_from.y) / draw_zoom;
new_margin = prev_margin + (mm->get_position().y - drag_from.y) / draw_zoom;
else if (edited_margin == 1)
new_margin = prev_margin - (mm->get_pos().y - drag_from.y) / draw_zoom;
new_margin = prev_margin - (mm->get_position().y - drag_from.y) / draw_zoom;
else if (edited_margin == 2)
new_margin = prev_margin + (mm->get_pos().x - drag_from.x) / draw_zoom;
new_margin = prev_margin + (mm->get_position().x - drag_from.x) / draw_zoom;
else if (edited_margin == 3)
new_margin = prev_margin - (mm->get_pos().x - drag_from.x) / draw_zoom;
new_margin = prev_margin - (mm->get_position().x - drag_from.x) / draw_zoom;
if (new_margin < 0)
new_margin = 0;
static Margin m[4] = { MARGIN_TOP, MARGIN_BOTTOM, MARGIN_LEFT, MARGIN_RIGHT };
@ -423,7 +423,7 @@ void TextureRegionEditor::_region_input(const Ref<InputEvent> &p_input) {
if (obj_styleBox.is_valid())
obj_styleBox->set_margin_size(m[edited_margin], new_margin);
} else {
Vector2 new_pos = mtx.affine_inverse().xform(mm->get_pos());
Vector2 new_pos = mtx.affine_inverse().xform(mm->get_position());
if (snap_mode == SNAP_PIXEL)
new_pos = new_pos.snapped(Vector2(1, 1));
else if (snap_mode == SNAP_GRID)

View file

@ -826,7 +826,7 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
paint_undo.clear();
Point2 local = node->world_to_map(xform_inv.xform(mb->get_pos()));
Point2 local = node->world_to_map(xform_inv.xform(mb->get_position()));
if (mb->get_shift()) {
@ -900,7 +900,7 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
if (mm.is_valid()) {
Point2i new_over_tile = node->world_to_map(xform_inv.xform(mm->get_pos()));
Point2i new_over_tile = node->world_to_map(xform_inv.xform(mm->get_position()));
if (new_over_tile != over_tile) {

View file

@ -325,11 +325,11 @@ void InputDefault::parse_input_event(const Ref<InputEvent> &p_event) {
Ref<InputEventScreenTouch> touch_event;
touch_event.instance();
touch_event->set_pressed(mb->is_pressed());
touch_event->set_pos(mb->get_pos());
touch_event->set_position(mb->get_position());
main_loop->input_event(touch_event);
}
Point2 pos = mb->get_global_pos();
Point2 pos = mb->get_global_position();
if (mouse_pos != pos) {
set_mouse_position(pos);
}
@ -343,7 +343,7 @@ void InputDefault::parse_input_event(const Ref<InputEvent> &p_event) {
Ref<InputEventScreenDrag> drag_event;
drag_event.instance();
drag_event->set_pos(mm->get_pos());
drag_event->set_position(mm->get_position());
drag_event->set_relative(mm->get_relative());
drag_event->set_speed(mm->get_speed());
@ -493,7 +493,7 @@ Point2i InputDefault::warp_mouse_motion(const Ref<InputEventMouseMotion> &p_moti
Math::fmod(p_motion->get_relative().x + rel_sgn.x * warp_margin.x, p_rect.size.x) - rel_sgn.x * warp_margin.x,
Math::fmod(p_motion->get_relative().y + rel_sgn.y * warp_margin.y, p_rect.size.y) - rel_sgn.y * warp_margin.y);
const Point2i pos_local = p_motion->get_global_pos() - p_rect.pos;
const Point2i pos_local = p_motion->get_global_position() - p_rect.pos;
const Point2i pos_warped(Math::fposmod(pos_local.x, p_rect.size.x), Math::fposmod(pos_local.y, p_rect.size.y));
if (pos_warped != pos_local) {
OS::get_singleton()->warp_mouse_pos(pos_warped + p_rect.pos);

View file

@ -216,7 +216,7 @@ protected:
if (mb->is_pressed()) {
Point2 p(mb->get_pos().x, mb->get_pos().y);
Point2 p(mb->get_position().x, mb->get_position().y);
if (mb->get_button_index() == 1) {
ray_to = p;
@ -232,7 +232,7 @@ protected:
if (mm.is_valid()) {
Point2 p = mm->get_pos();
Point2 p = mm->get_position();
if (mm->get_button_mask() & BUTTON_MASK_LEFT) {
ray_to = p;

View file

@ -560,7 +560,7 @@ bool GridMapEditor::forward_spatial_input_event(Camera *p_camera, const Ref<Inpu
else
return false;
return do_input_action(p_camera, Point2(mb->get_pos().x, mb->get_pos().y), true);
return do_input_action(p_camera, Point2(mb->get_position().x, mb->get_position().y), true);
} else {
if (
@ -604,7 +604,7 @@ bool GridMapEditor::forward_spatial_input_event(Camera *p_camera, const Ref<Inpu
if (mm.is_valid()) {
return do_input_action(p_camera, mm->get_pos(), false);
return do_input_action(p_camera, mm->get_position(), false);
}
} else if (edit_mode->get_selected() == 1) {
@ -616,7 +616,7 @@ bool GridMapEditor::forward_spatial_input_event(Camera *p_camera, const Ref<Inpu
if (mb->get_button_index() == BUTTON_LEFT && mb->is_pressed()) {
Point2 point = mb->get_pos();
Point2 point = mb->get_position();
Camera *camera = p_camera;
Vector3 from = camera->project_ray_origin(point);

View file

@ -380,8 +380,8 @@ void OS_Android::process_touch(int p_what, int p_pointer, const Vector<TouchPos>
ev->set_button_index(BUTTON_LEFT);
ev->set_button_mask(BUTTON_MASK_LEFT);
ev->set_pressed(false);
ev->set_pos(touch[0].pos);
ev->set_global_pos(touch[0].pos);
ev->set_position(touch[0].pos);
ev->set_global_position(touch[0].pos);
input->parse_input_event(ev);
}
@ -391,7 +391,7 @@ void OS_Android::process_touch(int p_what, int p_pointer, const Vector<TouchPos>
ev.instance();
ev->set_index(touch[i].id);
ev->set_pressed(false);
ev->set_pos(touch[i].pos);
ev->set_position(touch[i].pos);
input->parse_input_event(ev);
}
}
@ -410,8 +410,8 @@ void OS_Android::process_touch(int p_what, int p_pointer, const Vector<TouchPos>
ev->set_button_index(BUTTON_LEFT);
ev->set_button_mask(BUTTON_MASK_LEFT);
ev->set_pressed(true);
ev->set_pos(touch[0].pos);
ev->set_global_pos(touch[0].pos);
ev->set_position(touch[0].pos);
ev->set_global_position(touch[0].pos);
input->set_mouse_position(Point2(touch[0].pos.x, touch[0].pos.y));
last_mouse = touch[0].pos;
input->parse_input_event(ev);
@ -424,7 +424,7 @@ void OS_Android::process_touch(int p_what, int p_pointer, const Vector<TouchPos>
ev.instance();
ev->set_index(touch[i].id);
ev->set_pressed(true);
ev->set_pos(touch[i].pos.x);
ev->set_position(touch[i].pos.x);
input->parse_input_event(ev);
}
@ -436,7 +436,7 @@ void OS_Android::process_touch(int p_what, int p_pointer, const Vector<TouchPos>
Ref<InputEventMouseMotion> ev;
ev.instance();
ev->set_button_mask(BUTTON_MASK_LEFT);
ev->set_pos(p_points[0].pos.x);
ev->set_position(p_points[0].pos.x);
input->set_mouse_position(Point2(ev.mouse_motion.x, ev.mouse_motion.y));
ev->set_speed(input->get_last_mouse_speed());
ev->set_relative(p_points[0].pos - last_mouse);
@ -465,7 +465,7 @@ void OS_Android::process_touch(int p_what, int p_pointer, const Vector<TouchPos>
Ref<InputEventScreenDrag> ev;
ev.instance();
ev->set_index(touch[i].id);
ev->set_pos(p_points[idx].pos.x);
ev->set_position(p_points[idx].pos.x);
ev->set_relative(p_points[idx].pos - touch[i].pos);
input->parse_input_event(ev);
touch[i].pos = p_points[idx].pos;
@ -481,8 +481,8 @@ void OS_Android::process_touch(int p_what, int p_pointer, const Vector<TouchPos>
ev->set_button_index(BUTTON_LEFT);
ev->set_button_mask(BUTTON_MASK_LEFT);
ev->set_pressed(false);
ev->set_pos(touch[0].pos.x);
ev->set_global_pos(touch[0].pos.x);
ev->set_position(touch[0].pos.x);
ev->set_global_position(touch[0].pos.x);
input->set_mouse_position(Point2(touch[0].pos.x, touch[0].pos.y));
input->parse_input_event(ev);
@ -492,7 +492,7 @@ void OS_Android::process_touch(int p_what, int p_pointer, const Vector<TouchPos>
ev.instance();
ev->set_index(touch[i].id);
ev->set_pressed(false);
ev->set_pos(touch[i].pos);
ev->set_position(touch[i].pos);
input->parse_input_event(ev);
}
touch.clear();
@ -511,7 +511,7 @@ void OS_Android::process_touch(int p_what, int p_pointer, const Vector<TouchPos>
ev->set_index(tp.id);
ev->set_pressed(true);
ev->set_pos(tp.pos);
ev->set_position(tp.pos);
input->parse_input_event(ev);
} break;
@ -524,7 +524,7 @@ void OS_Android::process_touch(int p_what, int p_pointer, const Vector<TouchPos>
ev.instance();
ev->set_index(touch[i].id);
ev->set_pressed(false);
ev->set_pos(touch[i].pos);
ev->set_position(touch[i].pos);
input->parse_input_event(ev);
touch.remove(i);
i--;

View file

@ -212,7 +212,7 @@ void OSIPhone::mouse_button(int p_idx, int p_x, int p_y, bool p_pressed, bool p_
ev->set_index(p_idx);
ev->set_pressed(p_pressed);
ev->set_pos(Vector2(p_x, p_y));
ev->set_position(Vector2(p_x, p_y));
queue_event(ev);
};
@ -225,12 +225,12 @@ void OSIPhone::mouse_button(int p_idx, int p_x, int p_y, bool p_pressed, bool p_
// swaped it for tilted screen
//ev->get_pos().x = ev.mouse_button.global_x = video_mode.height - p_y;
//ev->get_pos().y = ev.mouse_button.global_y = p_x;
ev->set_pos(Vector2(video_mode.height - p_y, p_x));
ev->set_global_pos(Vector2(video_mode.height - p_y, p_x));
ev->set_position(Vector2(video_mode.height - p_y, p_x));
ev->set_global_position(Vector2(video_mode.height - p_y, p_x));
//mouse_list.pressed[p_idx] = p_pressed;
input->set_mouse_position(ev->get_pos());
input->set_mouse_position(ev->get_position());
ev->set_button_index(BUTTON_LEFT);
ev->set_doubleclick(p_doubleclick);
ev->set_pressed(p_pressed);
@ -246,7 +246,7 @@ void OSIPhone::mouse_move(int p_idx, int p_prev_x, int p_prev_y, int p_x, int p_
Ref<InputEventScreenDrag> ev;
ev.instance();
ev->set_index(p_idx);
ev->set_pos(Vector2(p_x, p_y));
ev->set_position(Vector2(p_x, p_y));
ev->set_relative(Vector2(p_x - p_prev_x, p_y - p_prev_y));
queue_event(ev);
};
@ -255,11 +255,11 @@ void OSIPhone::mouse_move(int p_idx, int p_prev_x, int p_prev_y, int p_x, int p_
Ref<InputEventMouseMotion> ev;
ev.instance();
ev->set_pos(Vector2(p_x, p_y));
ev->set_global_pos(Vector2(p_x, p_y));
ev->set_position(Vector2(p_x, p_y));
ev->set_global_position(Vector2(p_x, p_y));
ev->set_relative(Vector2(p_x - p_prev_x, p_y - p_prev_y));
input->set_mouse_position(ev->get_pos());
input->set_mouse_position(ev->get_position());
ev->set_speed(input->get_last_mouse_speed());
ev->set_button_mask(BUTTON_LEFT); // pressed

View file

@ -291,8 +291,8 @@ static int button_mask = 0;
get_key_modifier_state([event modifierFlags], mb);
mb->set_button_index(BUTTON_LEFT);
mb->set_pressed(true);
mb->set_pos(Vector2(mouse_x, mouse_y));
mb->set_global_pos(Vector2(mouse_x, mouse_y));
mb->set_position(Vector2(mouse_x, mouse_y));
mb->set_global_position(Vector2(mouse_x, mouse_y));
mb->set_button_mask(button_mask);
mb->set_doubleclick([event clickCount] == 2);
OS_OSX::singleton->push_input(mb);
@ -311,8 +311,8 @@ static int button_mask = 0;
get_key_modifier_state([event modifierFlags], mb);
mb->set_button_index(BUTTON_LEFT);
mb->set_pressed(false);
mb->set_pos(Vector2(mouse_x, mouse_y));
mb->set_global_pos(Vector2(mouse_x, mouse_y));
mb->set_position(Vector2(mouse_x, mouse_y));
mb->set_global_position(Vector2(mouse_x, mouse_y));
mb->set_button_mask(button_mask);
mb->set_doubleclick([event clickCount] == 2);
OS_OSX::singleton->push_input(mb);
@ -330,8 +330,8 @@ static int button_mask = 0;
const NSPoint p = [event locationInWindow];
mouse_x = p.x * OS_OSX::singleton->_mouse_scale([[event window] backingScaleFactor]);
mouse_y = (contentRect.size.height - p.y) * OS_OSX::singleton->_mouse_scale([[event window] backingScaleFactor]);
mm->set_pos(Vector2(mouse_x, mouse_y));
mm->set_global_pos(Vector2(mouse_x, mouse_y));
mm->set_position(Vector2(mouse_x, mouse_y));
mm->set_global_position(Vector2(mouse_x, mouse_y));
Vector2 relativeMotion = Vector2();
relativeMotion.x = [event deltaX] * OS_OSX::singleton->_mouse_scale([[event window] backingScaleFactor]);
relativeMotion.y = [event deltaY] * OS_OSX::singleton->_mouse_scale([[event window] backingScaleFactor]);
@ -352,8 +352,8 @@ static int button_mask = 0;
get_key_modifier_state([event modifierFlags], mb);
mb->set_button_index(BUTTON_RIGHT);
mb->set_pressed(true);
mb->set_pos(Vector2(mouse_x, mouse_y));
mb->set_global_pos(Vector2(mouse_x, mouse_y));
mb->set_position(Vector2(mouse_x, mouse_y));
mb->set_global_position(Vector2(mouse_x, mouse_y));
mb->set_button_mask(button_mask);
mb->set_doubleclick([event clickCount] == 2);
OS_OSX::singleton->push_input(mb);
@ -373,8 +373,8 @@ static int button_mask = 0;
get_key_modifier_state([event modifierFlags], mb);
mb->set_button_index(BUTTON_RIGHT);
mb->set_pressed(false);
mb->set_pos(Vector2(mouse_x, mouse_y));
mb->set_global_pos(Vector2(mouse_x, mouse_y));
mb->set_position(Vector2(mouse_x, mouse_y));
mb->set_global_position(Vector2(mouse_x, mouse_y));
mb->set_button_mask(button_mask);
mb->set_doubleclick([event clickCount] == 2);
OS_OSX::singleton->push_input(mb);
@ -393,8 +393,8 @@ static int button_mask = 0;
get_key_modifier_state([event modifierFlags], mb);
mb->set_button_index(BUTTON_MIDDLE);
mb->set_pressed(true);
mb->set_pos(Vector2(mouse_x, mouse_y));
mb->set_global_pos(Vector2(mouse_x, mouse_y));
mb->set_position(Vector2(mouse_x, mouse_y));
mb->set_global_position(Vector2(mouse_x, mouse_y));
mb->set_button_mask(button_mask);
mb->set_doubleclick([event clickCount] == 2);
OS_OSX::singleton->push_input(mb);
@ -417,8 +417,8 @@ static int button_mask = 0;
get_key_modifier_state([event modifierFlags], mb);
mb->set_button_index(BUTTON_MIDDLE);
mb->set_pressed(true);
mb->set_pos(Vector2(mouse_x, mouse_y));
mb->set_global_pos(Vector2(mouse_x, mouse_y));
mb->set_position(Vector2(mouse_x, mouse_y));
mb->set_global_position(Vector2(mouse_x, mouse_y));
mb->set_button_mask(button_mask);
mb->set_doubleclick([event clickCount] == 2);
OS_OSX::singleton->push_input(mb);
@ -701,8 +701,8 @@ inline void sendScrollEvent(int button, double factor, int modifierFlags) {
sc->set_factor(factor);
sc->set_pressed(true);
Vector2 mouse_pos = Vector2(mouse_x, mouse_y);
sc->set_pos(mouse_pos);
sc->set_global_pos(mouse_pos);
sc->set_position(mouse_pos);
sc->set_global_position(mouse_pos);
sc->set_button_mask(button_mask);
OS_OSX::singleton->push_input(sc);
sc->set_pressed(false);

View file

@ -219,7 +219,7 @@ void OS_Windows::_touch_event(bool p_pressed, int p_x, int p_y, int idx) {
event.instance();
event->set_index(idx);
event->set_pressed(p_pressed);
event->set_pos(Vector2(p_x, p_y));
event->set_position(Vector2(p_x, p_y));
if (main_loop) {
input->parse_input_event(event);
@ -231,7 +231,7 @@ void OS_Windows::_drag_event(int p_x, int p_y, int idx) {
Ref<InputEventScreenDrag> event;
event.instance();
event->set_index(idx);
event->set_pos(Vector2(p_x, p_y));
event->set_position(Vector2(p_x, p_y));
if (main_loop)
input->parse_input_event(event);
@ -378,7 +378,7 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
last_button_state = mm->get_button_mask();
/*mm->get_button_mask()|=(wParam&MK_XBUTTON1)?(1<<5):0;
mm->get_button_mask()|=(wParam&MK_XBUTTON2)?(1<<6):0;*/
mm->set_pos(Vector2(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)));
mm->set_position(Vector2(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)));
if (mouse_mode == MOUSE_MODE_CAPTURED) {
@ -386,31 +386,31 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
old_x = c.x;
old_y = c.y;
if (mm->get_pos() == c) {
if (mm->get_position() == c) {
center = c;
return 0;
}
Point2i ncenter = mm->get_pos();
Point2i ncenter = mm->get_position();
center = ncenter;
POINT pos = { (int)c.x, (int)c.y };
ClientToScreen(hWnd, &pos);
SetCursorPos(pos.x, pos.y);
}
input->set_mouse_position(mm->get_pos());
input->set_mouse_position(mm->get_position());
mm->set_speed(input->get_last_mouse_speed());
if (old_invalid) {
old_x = mm->get_pos().x;
old_y = mm->get_pos().y;
old_x = mm->get_position().x;
old_y = mm->get_position().y;
old_invalid = false;
}
mm->set_relative(Vector2(mm->get_pos() - Vector2(old_x, old_y)));
old_x = mm->get_pos().x;
old_y = mm->get_pos().y;
mm->set_relative(Vector2(mm->get_position() - Vector2(old_x, old_y)));
old_x = mm->get_position().x;
old_y = mm->get_position().y;
if (window_has_focus && main_loop)
input->parse_input_event(mm);
@ -536,14 +536,14 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
/*
mb->get_button_mask()|=(wParam&MK_XBUTTON1)?(1<<5):0;
mb->get_button_mask()|=(wParam&MK_XBUTTON2)?(1<<6):0;*/
mb->set_pos(Vector2(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)));
mb->set_position(Vector2(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)));
if (mouse_mode == MOUSE_MODE_CAPTURED) {
mb->set_pos(Vector2(old_x, old_y));
mb->set_position(Vector2(old_x, old_y));
}
mb->set_global_pos(mb->get_pos());
mb->set_global_position(mb->get_position());
if (uMsg != WM_MOUSEWHEEL) {
if (mb->is_pressed()) {
@ -560,12 +560,12 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
} else if (mouse_mode != MOUSE_MODE_CAPTURED) {
// for reasons unknown to mankind, wheel comes in screen cordinates
POINT coords;
coords.x = mb->get_pos().x;
coords.y = mb->get_pos().y;
coords.x = mb->get_position().x;
coords.y = mb->get_position().y;
ScreenToClient(hWnd, &coords);
mb->set_pos(Vector2(coords.x, coords.y));
mb->set_position(Vector2(coords.x, coords.y));
}
if (main_loop) {

View file

@ -1334,8 +1334,8 @@ void OS_X11::process_xevents() {
get_key_modifier_state(event.xbutton.state, mb);
mb->set_button_mask(get_mouse_button_state(event.xbutton.state));
mb->set_pos(Vector2(event.xbutton.x, event.xbutton.y));
mb->set_global_pos(mb->get_pos());
mb->set_position(Vector2(event.xbutton.x, event.xbutton.y));
mb->set_global_position(mb->get_position());
mb->set_button_index(event.xbutton.button);
if (mb->get_button_index() == 2)
mb->set_button_index(3);
@ -1443,8 +1443,8 @@ void OS_X11::process_xevents() {
get_key_modifier_state(event.xmotion.state, mm);
mm->set_button_mask(get_mouse_button_state(event.xmotion.state));
mm->set_pos(pos);
mm->set_global_pos(pos);
mm->set_position(pos);
mm->set_global_position(pos);
input->set_mouse_position(pos);
mm->set_speed(input->get_last_mouse_speed());
mm->set_relative(rel);

View file

@ -207,7 +207,7 @@ void TouchScreenButton::_input(const Ref<InputEvent> &p_event) {
if ((st.is_valid() && st->is_pressed()) || sd.is_valid()) {
int index = st.is_valid() ? st->get_index() : sd->get_index();
Vector2 coord = st.is_valid() ? st->get_pos() : sd->get_pos();
Vector2 coord = st.is_valid() ? st->get_position() : sd->get_position();
if (finger_pressed == -1 || index == finger_pressed) {
@ -254,7 +254,7 @@ void TouchScreenButton::_input(const Ref<InputEvent> &p_event) {
if (!can_press)
return; //already fingering
Point2 coord = (get_global_transform_with_canvas()).affine_inverse().xform(st->get_pos());
Point2 coord = (get_global_transform_with_canvas()).affine_inverse().xform(st->get_position());
Rect2 item_rect = get_item_rect();
bool touched = false;

View file

@ -162,7 +162,7 @@ void BaseButton::_gui_input(Ref<InputEvent> p_event) {
if (mm.is_valid()) {
if (status.press_attempt && status.pressing_button == 0) {
bool last_press_inside = status.pressing_inside;
status.pressing_inside = has_point(mm->get_pos());
status.pressing_inside = has_point(mm->get_position());
if (last_press_inside != status.pressing_inside)
update();
}

View file

@ -313,7 +313,7 @@ void ButtonArray::_gui_input(const Ref<InputEvent> &p_event) {
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
int ofs = orientation == HORIZONTAL ? mb->get_pos().x : mb->get_pos().y;
int ofs = orientation == HORIZONTAL ? mb->get_position().x : mb->get_position().y;
for (int i = 0; i < buttons.size(); i++) {
@ -330,7 +330,7 @@ void ButtonArray::_gui_input(const Ref<InputEvent> &p_event) {
if (mm.is_valid()) {
int ofs = orientation == HORIZONTAL ? mm->get_pos().x : mm->get_pos().y;
int ofs = orientation == HORIZONTAL ? mm->get_position().x : mm->get_position().y;
int new_hover = -1;
for (int i = 0; i < buttons.size(); i++) {

View file

@ -304,8 +304,8 @@ void ColorPicker::_uv_input(const Ref<InputEvent> &ev) {
if (bev.is_valid()) {
if (bev->is_pressed() && bev->get_button_index() == BUTTON_LEFT) {
changing_color = true;
float x = CLAMP((float)bev->get_pos().x, 0, 256);
float y = CLAMP((float)bev->get_pos().y, 0, 256);
float x = CLAMP((float)bev->get_position().x, 0, 256);
float y = CLAMP((float)bev->get_position().y, 0, 256);
s = x / 256;
v = 1.0 - y / 256.0;
color.set_hsv(h, s, v, color.a);
@ -323,8 +323,8 @@ void ColorPicker::_uv_input(const Ref<InputEvent> &ev) {
if (mev.is_valid()) {
if (!changing_color)
return;
float x = CLAMP((float)mev->get_pos().x, 0, 256);
float y = CLAMP((float)mev->get_pos().y, 0, 256);
float x = CLAMP((float)mev->get_position().x, 0, 256);
float y = CLAMP((float)mev->get_position().y, 0, 256);
s = x / 256;
v = 1.0 - y / 256.0;
color.set_hsv(h, s, v, color.a);
@ -343,7 +343,7 @@ void ColorPicker::_w_input(const Ref<InputEvent> &ev) {
if (bev->is_pressed() && bev->get_button_index() == BUTTON_LEFT) {
changing_color = true;
h = 1 - ((float)bev->get_pos().y) / 256.0;
h = 1 - ((float)bev->get_position().y) / 256.0;
} else {
changing_color = false;
@ -361,7 +361,7 @@ void ColorPicker::_w_input(const Ref<InputEvent> &ev) {
if (!changing_color)
return;
float y = CLAMP((float)mev->get_pos().y, 0, 256);
float y = CLAMP((float)mev->get_position().y, 0, 256);
h = 1.0 - y / 256.0;
color.set_hsv(h, s, v, color.a);
last_hsv = color;
@ -378,10 +378,10 @@ void ColorPicker::_preset_input(const Ref<InputEvent> &ev) {
if (bev.is_valid()) {
if (bev->is_pressed() && bev->get_button_index() == BUTTON_LEFT) {
int index = bev->get_pos().x / (preset->get_size().x / presets.size());
int index = bev->get_position().x / (preset->get_size().x / presets.size());
set_pick_color(presets[index]);
} else if (bev->is_pressed() && bev->get_button_index() == BUTTON_RIGHT) {
int index = bev->get_pos().x / (preset->get_size().x / presets.size());
int index = bev->get_position().x / (preset->get_size().x / presets.size());
presets.erase(presets[index]);
_update_presets();
bt_add_preset->show();
@ -394,7 +394,7 @@ void ColorPicker::_preset_input(const Ref<InputEvent> &ev) {
if (mev.is_valid()) {
int index = mev->get_pos().x * presets.size();
int index = mev->get_position().x * presets.size();
if (preset->get_size().x != 0) {
index /= preset->get_size().x;
}
@ -422,7 +422,7 @@ void ColorPicker::_screen_input(const Ref<InputEvent> &ev) {
if (mev.is_valid()) {
Viewport *r = get_tree()->get_root();
if (!r->get_visible_rect().has_point(Point2(mev->get_global_pos().x, mev->get_global_pos().y)))
if (!r->get_visible_rect().has_point(Point2(mev->get_global_position().x, mev->get_global_position().y)))
return;
Ref<Image> img = r->get_screen_capture();
if (!img.is_null()) {
@ -431,7 +431,7 @@ void ColorPicker::_screen_input(const Ref<InputEvent> &ev) {
}
if (last_capture.is_valid() && !last_capture->empty()) {
int pw = last_capture->get_format() == Image::FORMAT_RGBA8 ? 4 : 3;
int ofs = (mev->get_global_pos().y * last_capture->get_width() + mev->get_global_pos().x) * pw;
int ofs = (mev->get_global_position().y * last_capture->get_width() + mev->get_global_position().x) * pw;
PoolVector<uint8_t>::Read r = last_capture->get_data().read();

View file

@ -88,14 +88,14 @@ void ColorRampEdit::_gui_input(const Ref<InputEvent> &p_event) {
Ref<InputEventMouseButton> mb = p_event;
//Show color picker on double click.
if (mb.is_valid() && mb->get_button_index() == 1 && mb->is_doubleclick() && mb->is_pressed()) {
grabbed = _get_point_from_pos(mb->get_pos().x);
grabbed = _get_point_from_pos(mb->get_position().x);
_show_color_picker();
accept_event();
}
//Delete point on right click
if (mb.is_valid() && mb->get_button_index() == 2 && mb->is_pressed()) {
grabbed = _get_point_from_pos(mb->get_pos().x);
grabbed = _get_point_from_pos(mb->get_position().x);
if (grabbed != -1) {
points.remove(grabbed);
grabbed = -1;
@ -109,7 +109,7 @@ void ColorRampEdit::_gui_input(const Ref<InputEvent> &p_event) {
//Hold alt key to duplicate selected color
if (mb.is_valid() && mb->get_button_index() == 1 && mb->is_pressed() && mb->get_alt()) {
int x = mb->get_pos().x;
int x = mb->get_position().x;
grabbed = _get_point_from_pos(x);
if (grabbed != -1) {
@ -134,7 +134,7 @@ void ColorRampEdit::_gui_input(const Ref<InputEvent> &p_event) {
if (mb.is_valid() && mb->get_button_index() == 1 && mb->is_pressed()) {
update();
int x = mb->get_pos().x;
int x = mb->get_position().x;
int total_w = get_size().width - get_size().height - 3;
//Check if color selector was clicked.
@ -214,7 +214,7 @@ void ColorRampEdit::_gui_input(const Ref<InputEvent> &p_event) {
int total_w = get_size().width - get_size().height - 3;
int x = mm->get_pos().x;
int x = mm->get_position().x;
float newofs = CLAMP(x / float(total_w), 0, 1);

View file

@ -113,7 +113,7 @@ void WindowDialog::_gui_input(const Ref<InputEvent> &p_event) {
if (mb->is_pressed()) {
// Begin a possible dragging operation.
drag_type = _drag_hit_test(Point2(mb->get_pos().x, mb->get_pos().y));
drag_type = _drag_hit_test(Point2(mb->get_position().x, mb->get_position().y));
if (drag_type != DRAG_NONE)
drag_offset = get_global_mouse_position() - get_position();
drag_offset_far = get_position() + get_size() - get_global_mouse_position();
@ -131,7 +131,7 @@ void WindowDialog::_gui_input(const Ref<InputEvent> &p_event) {
// Update the cursor while moving along the borders.
CursorShape cursor = CURSOR_ARROW;
if (resizable) {
int preview_drag_type = _drag_hit_test(Point2(mm->get_pos().x, mm->get_pos().y));
int preview_drag_type = _drag_hit_test(Point2(mm->get_position().x, mm->get_position().y));
switch (preview_drag_type) {
case DRAG_RESIZE_TOP:
case DRAG_RESIZE_BOTTOM:

View file

@ -374,7 +374,7 @@ void GraphEdit::_top_layer_input(const Ref<InputEvent> &p_ev) {
if (mb.is_valid() && mb->get_button_index() == BUTTON_LEFT && mb->is_pressed()) {
Ref<Texture> port = get_icon("port", "GraphNode");
Vector2 mpos(mb->get_pos().x, mb->get_pos().y);
Vector2 mpos(mb->get_position().x, mb->get_position().y);
float grab_r = port->get_width() * 0.5 * grab_r_extend;
for (int i = get_child_count() - 1; i >= 0; i--) {
@ -483,12 +483,12 @@ void GraphEdit::_top_layer_input(const Ref<InputEvent> &p_ev) {
Ref<InputEventMouseMotion> mm = p_ev;
if (mm.is_valid() && connecting) {
connecting_to = mm->get_pos();
connecting_to = mm->get_position();
connecting_target = false;
top_layer->update();
Ref<Texture> port = get_icon("port", "GraphNode");
Vector2 mpos = mm->get_pos();
Vector2 mpos = mm->get_position();
float grab_r = port->get_width() * 0.5 * grab_r_extend;
for (int i = get_child_count() - 1; i >= 0; i--) {
@ -546,7 +546,7 @@ void GraphEdit::_top_layer_input(const Ref<InputEvent> &p_ev) {
} else if (!just_disconected) {
String from = connecting_from;
int from_slot = connecting_index;
Vector2 ofs = Vector2(mb->get_pos().x, mb->get_pos().y);
Vector2 ofs = Vector2(mb->get_position().x, mb->get_position().y);
emit_signal("connection_to_empty", from, from_slot, ofs);
}
connecting = false;
@ -817,7 +817,7 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {
connecting = false;
top_layer->update();
} else {
emit_signal("popup_request", b->get_global_pos());
emit_signal("popup_request", b->get_global_position());
}
}
}
@ -880,7 +880,7 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {
if (gn) {
if (_filter_input(b->get_pos()))
if (_filter_input(b->get_position()))
return;
dragging = true;
@ -905,7 +905,7 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {
}
} else {
if (_filter_input(b->get_pos()))
if (_filter_input(b->get_position()))
return;
if (Input::get_singleton()->is_key_pressed(KEY_SPACE))
return;

View file

@ -586,7 +586,7 @@ void GraphNode::_gui_input(const Ref<InputEvent> &p_ev) {
if (mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
Vector2 mpos = Vector2(mb->get_pos().x, mb->get_pos().y);
Vector2 mpos = Vector2(mb->get_position().x, mb->get_position().y);
if (close_rect.size != Size2() && close_rect.has_point(mpos)) {
emit_signal("close_request");
accept_event();
@ -616,7 +616,7 @@ void GraphNode::_gui_input(const Ref<InputEvent> &p_ev) {
Ref<InputEventMouseMotion> mm = p_ev;
if (resizing && mm.is_valid()) {
Vector2 mpos = mm->get_pos();
Vector2 mpos = mm->get_position();
Vector2 diff = mpos - resizing_from;

View file

@ -431,7 +431,7 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
if (mb.is_valid() && (mb->get_button_index() == BUTTON_LEFT || (allow_rmb_select && mb->get_button_index() == BUTTON_RIGHT)) && mb->is_pressed()) {
search_string = ""; //any mousepress cancels
Vector2 pos(mb->get_pos().x, mb->get_pos().y);
Vector2 pos(mb->get_position().x, mb->get_position().y);
Ref<StyleBox> bg = get_stylebox("bg");
pos -= bg->get_offset();
pos.y += scroll_bar->get_value();
@ -475,7 +475,7 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
if (mb->get_button_index() == BUTTON_RIGHT) {
emit_signal("item_rmb_selected", i, Vector2(mb->get_pos().x, mb->get_pos().y));
emit_signal("item_rmb_selected", i, Vector2(mb->get_position().x, mb->get_position().y));
}
} else {
@ -486,7 +486,7 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
if (items[i].selected && mb->get_button_index() == BUTTON_RIGHT) {
emit_signal("item_rmb_selected", i, Vector2(mb->get_pos().x, mb->get_pos().y));
emit_signal("item_rmb_selected", i, Vector2(mb->get_position().x, mb->get_position().y));
} else {
bool selected = !items[i].selected;
@ -501,7 +501,7 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
if (mb->get_button_index() == BUTTON_RIGHT) {
emit_signal("item_rmb_selected", i, Vector2(mb->get_pos().x, mb->get_pos().y));
emit_signal("item_rmb_selected", i, Vector2(mb->get_position().x, mb->get_position().y));
} else if (/*select_mode==SELECT_SINGLE &&*/ mb->is_doubleclick()) {
emit_signal("item_activated", i);

View file

@ -64,7 +64,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
shift_selection_check_pre(b->get_shift());
set_cursor_at_pixel_pos(b->get_pos().x);
set_cursor_at_pixel_pos(b->get_position().x);
if (b->get_shift()) {
@ -118,7 +118,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
if (m->get_button_mask() & BUTTON_LEFT) {
if (selection.creating) {
set_cursor_at_pixel_pos(m->get_pos().x);
set_cursor_at_pixel_pos(m->get_position().x);
selection_fill_at_cursor();
}
}

View file

@ -284,7 +284,7 @@ void PopupMenu::_gui_input(const Ref<InputEvent> &p_event) {
//update hover
Ref<InputEventMouseMotion> ie;
ie.instance();
ie->set_pos(b->get_pos() + Vector2(0, s));
ie->set_position(b->get_position() + Vector2(0, s));
_gui_input(ie);
}
} break;
@ -303,13 +303,13 @@ void PopupMenu::_gui_input(const Ref<InputEvent> &p_event) {
//update hover
Ref<InputEventMouseMotion> ie;
ie.instance();
ie->set_pos(b->get_pos() - Vector2(0, s));
ie->set_position(b->get_position() - Vector2(0, s));
_gui_input(ie);
}
} break;
case BUTTON_LEFT: {
int over = _get_mouse_over(b->get_pos());
int over = _get_mouse_over(b->get_position());
if (invalidated_click) {
invalidated_click = false;
@ -348,13 +348,13 @@ void PopupMenu::_gui_input(const Ref<InputEvent> &p_event) {
for (List<Rect2>::Element *E = autohide_areas.front(); E; E = E->next()) {
if (!Rect2(Point2(), get_size()).has_point(m->get_pos()) && E->get().has_point(m->get_pos())) {
if (!Rect2(Point2(), get_size()).has_point(m->get_position()) && E->get().has_point(m->get_position())) {
call_deferred("hide");
return;
}
}
int over = _get_mouse_over(m->get_pos());
int over = _get_mouse_over(m->get_position());
int id = (over < 0 || items[over].separator || items[over].disabled) ? -1 : (items[over].ID >= 0 ? items[over].ID : over);
if (id < 0) {

View file

@ -751,7 +751,7 @@ void RichTextLabel::_gui_input(Ref<InputEvent> p_event) {
Item *item = NULL;
bool outside;
_find_click(main, b->get_pos(), &item, &line, &outside);
_find_click(main, b->get_position(), &item, &line, &outside);
if (item) {
@ -852,7 +852,7 @@ void RichTextLabel::_gui_input(Ref<InputEvent> p_event) {
int line = 0;
Item *item = NULL;
_find_click(main, m->get_pos(), &item, &line);
_find_click(main, m->get_position(), &item, &line);
if (!item)
return; // do not update

View file

@ -72,7 +72,7 @@ void ScrollBar::_gui_input(Ref<InputEvent> p_event) {
if (b->is_pressed()) {
double ofs = orientation == VERTICAL ? b->get_pos().y : b->get_pos().x;
double ofs = orientation == VERTICAL ? b->get_position().y : b->get_position().x;
Ref<Texture> decr = get_icon("decrement");
Ref<Texture> incr = get_icon("increment");
@ -130,7 +130,7 @@ void ScrollBar::_gui_input(Ref<InputEvent> p_event) {
if (drag.active) {
double ofs = orientation == VERTICAL ? m->get_pos().y : m->get_pos().x;
double ofs = orientation == VERTICAL ? m->get_position().y : m->get_position().x;
Ref<Texture> decr = get_icon("decrement");
double decr_size = orientation == VERTICAL ? decr->get_height() : decr->get_width();
@ -141,7 +141,7 @@ void ScrollBar::_gui_input(Ref<InputEvent> p_event) {
set_as_ratio(drag.value_at_click + diff);
} else {
double ofs = orientation == VERTICAL ? m->get_pos().y : m->get_pos().x;
double ofs = orientation == VERTICAL ? m->get_position().y : m->get_position().x;
Ref<Texture> decr = get_icon("decrement");
Ref<Texture> incr = get_icon("increment");

View file

@ -46,7 +46,7 @@ void Slider::_gui_input(Ref<InputEvent> p_event) {
if (mb->is_pressed()) {
Ref<Texture> grabber = get_icon(mouse_inside || has_focus() ? "grabber_highlight" : "grabber");
grab.pos = orientation == VERTICAL ? mb->get_pos().y : mb->get_pos().x;
grab.pos = orientation == VERTICAL ? mb->get_position().y : mb->get_position().x;
double grab_width = (double)grabber->get_size().width;
double grab_height = (double)grabber->get_size().height;
@ -75,7 +75,7 @@ void Slider::_gui_input(Ref<InputEvent> p_event) {
Size2i size = get_size();
Ref<Texture> grabber = get_icon("grabber");
float motion = (orientation == VERTICAL ? mm->get_pos().y : mm->get_pos().x) - grab.pos;
float motion = (orientation == VERTICAL ? mm->get_position().y : mm->get_position().x) - grab.pos;
if (orientation == VERTICAL)
motion = -motion;
float areasize = orientation == VERTICAL ? size.height - grabber->get_size().height : size.width - grabber->get_size().width;

View file

@ -96,7 +96,7 @@ void SpinBox::_gui_input(const Ref<InputEvent> &p_event) {
if (mb.is_valid() && mb->is_pressed()) {
bool up = mb->get_pos().y < (get_size().height / 2);
bool up = mb->get_position().y < (get_size().height / 2);
switch (mb->get_button_index()) {
@ -135,7 +135,7 @@ void SpinBox::_gui_input(const Ref<InputEvent> &p_event) {
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == 1) {
//set_default_cursor_shape(CURSOR_VSIZE);
Vector2 cpos = Vector2(mb->get_pos().x, mb->get_pos().y);
Vector2 cpos = Vector2(mb->get_position().x, mb->get_position().y);
drag.mouse_pos = cpos;
}
@ -155,7 +155,7 @@ void SpinBox::_gui_input(const Ref<InputEvent> &p_event) {
if (mm.is_valid() && mm->get_button_mask() & 1) {
Vector2 cpos = mm->get_pos();
Vector2 cpos = mm->get_position();
if (drag.enabled) {

View file

@ -286,16 +286,16 @@ void SplitContainer::_gui_input(const Ref<InputEvent> &p_event) {
if (vertical) {
if (mb->get_pos().y > middle_sep && mb->get_pos().y < middle_sep + sep) {
if (mb->get_position().y > middle_sep && mb->get_position().y < middle_sep + sep) {
dragging = true;
drag_from = mb->get_pos().y;
drag_from = mb->get_position().y;
drag_ofs = expand_ofs;
}
} else {
if (mb->get_pos().x > middle_sep && mb->get_pos().x < middle_sep + sep) {
if (mb->get_position().x > middle_sep && mb->get_position().x < middle_sep + sep) {
dragging = true;
drag_from = mb->get_pos().x;
drag_from = mb->get_position().x;
drag_ofs = expand_ofs;
}
}
@ -312,7 +312,7 @@ void SplitContainer::_gui_input(const Ref<InputEvent> &p_event) {
if (dragging) {
expand_ofs = drag_ofs + ((vertical ? mm->get_pos().y : mm->get_pos().x) - drag_from);
expand_ofs = drag_ofs + ((vertical ? mm->get_position().y : mm->get_position().x) - drag_from);
queue_sort();
emit_signal("dragged", get_split_offset());
}

View file

@ -69,7 +69,7 @@ void TabContainer::_gui_input(const Ref<InputEvent> &p_event) {
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
Point2 pos(mb->get_pos().x, mb->get_pos().y);
Point2 pos(mb->get_position().x, mb->get_position().y);
Size2 size = get_size();
// Click must be on tabs in the tab header area.

View file

@ -85,7 +85,7 @@ void Tabs::_gui_input(const Ref<InputEvent> &p_event) {
if (mm.is_valid()) {
Point2 pos = mm->get_pos();
Point2 pos = mm->get_position();
highlight_arrow = -1;
if (buttons_visible) {
@ -165,7 +165,7 @@ void Tabs::_gui_input(const Ref<InputEvent> &p_event) {
mb->get_button_index() == BUTTON_LEFT) {
// clicks
Point2 pos(mb->get_pos().x, mb->get_pos().y);
Point2 pos(mb->get_position().x, mb->get_position().y);
if (buttons_visible) {

View file

@ -1445,7 +1445,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
Ref<InputEventMouseButton> mb = p_gui_input;
if (mb.is_valid()) {
if (completion_active && completion_rect.has_point(mb->get_pos())) {
if (completion_active && completion_rect.has_point(mb->get_position())) {
if (!mb->is_pressed())
return;
@ -1468,7 +1468,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
if (mb->get_button_index() == BUTTON_LEFT) {
completion_index = CLAMP(completion_line_ofs + (mb->get_pos().y - completion_rect.pos.y) / get_row_height(), 0, completion_options.size() - 1);
completion_index = CLAMP(completion_line_ofs + (mb->get_position().y - completion_rect.pos.y) / get_row_height(), 0, completion_options.size() - 1);
completion_current = completion_options[completion_index];
update();
@ -1500,7 +1500,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
_reset_caret_blink_timer();
int row, col;
_get_mouse_pos(Point2i(mb->get_pos().x, mb->get_pos().y), row, col);
_get_mouse_pos(Point2i(mb->get_position().x, mb->get_position().y), row, col);
if (mb->get_command() && highlighted_word != String()) {
@ -1511,7 +1511,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
// toggle breakpoint on gutter click
if (draw_breakpoint_gutter) {
int gutter = cache.style_normal->get_margin(MARGIN_LEFT);
if (mb->get_pos().x > gutter && mb->get_pos().x <= gutter + cache.breakpoint_gutter_width + 3) {
if (mb->get_position().x > gutter && mb->get_position().x <= gutter + cache.breakpoint_gutter_width + 3) {
set_line_as_breakpoint(row, !is_line_set_as_breakpoint(row));
emit_signal("breakpoint_toggled", row);
return;
@ -1646,7 +1646,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
if (select_identifiers_enabled) {
if (mm->get_command() && mm->get_button_mask() == 0) {
String new_word = get_word_at_pos(mm->get_pos());
String new_word = get_word_at_pos(mm->get_position());
if (new_word != highlighted_word) {
highlighted_word = new_word;
update();
@ -1666,7 +1666,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
_reset_caret_blink_timer();
int row, col;
_get_mouse_pos(mm->get_pos(), row, col);
_get_mouse_pos(mm->get_position(), row, col);
select(selection.selecting_line, selection.selecting_column, row, col);

View file

@ -2122,7 +2122,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
Ref<StyleBox> bg = cache.bg;
Point2 pos = mm->get_pos() - bg->get_offset();
Point2 pos = mm->get_position() - bg->get_offset();
Cache::ClickType old_hover = cache.hover_type;
int old_index = cache.hover_index;
@ -2150,7 +2150,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
if (drop_mode_flags && root) {
Point2 mpos = mm->get_pos();
Point2 mpos = mm->get_position();
mpos -= cache.bg->get_offset();
mpos.y -= _get_title_button_height();
if (mpos.y >= 0) {
@ -2180,7 +2180,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
if (!range_drag_enabled) {
Vector2 cpos = mm->get_pos();
Vector2 cpos = mm->get_position();
if (cpos.distance_to(pressing_pos) > 2) {
range_drag_enabled = true;
range_drag_capture_pos = cpos;
@ -2217,7 +2217,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
if (b->get_button_index() == BUTTON_LEFT) {
Point2 pos = b->get_pos() - cache.bg->get_offset();
Point2 pos = b->get_position() - cache.bg->get_offset();
if (show_column_titles) {
pos.y -= _get_title_button_height();
@ -2251,7 +2251,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
warp_mouse(range_drag_capture_pos);
} else {
Rect2 rect = get_selected()->get_meta("__focus_rect");
if (rect.has_point(Point2(b->get_pos().x, b->get_pos().y))) {
if (rect.has_point(Point2(b->get_position().x, b->get_position().y))) {
edit_selected();
} else {
emit_signal("item_double_clicked");
@ -2295,7 +2295,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
case BUTTON_LEFT: {
Ref<StyleBox> bg = cache.bg;
Point2 pos = b->get_pos() - bg->get_offset();
Point2 pos = b->get_position() - bg->get_offset();
cache.click_type = Cache::CLICK_NONE;
if (show_column_titles && b->get_button_index() == BUTTON_LEFT) {
pos.y -= _get_title_button_height();
@ -2333,7 +2333,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
blocked--;
if (pressing_for_editor) {
pressing_pos = b->get_pos();
pressing_pos = b->get_position();
}
if (b->get_button_index() == BUTTON_RIGHT)

View file

@ -512,7 +512,7 @@ void Viewport::_notification(int p_what) {
if (mm.is_valid()) {
pos = mm->get_pos();
pos = mm->get_position();
motion_tested = true;
physics_last_mousepos = pos;
}
@ -520,19 +520,19 @@ void Viewport::_notification(int p_what) {
Ref<InputEventMouseButton> mb = ev;
if (mb.is_valid()) {
pos = mb->get_pos();
pos = mb->get_position();
}
Ref<InputEventScreenDrag> sd = ev;
if (sd.is_valid()) {
pos = sd->get_pos();
pos = sd->get_position();
}
Ref<InputEventScreenTouch> st = ev;
if (st.is_valid()) {
pos = st->get_pos();
pos = st->get_position();
}
if (ss2d) {
@ -1685,7 +1685,7 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
gui.key_event_accepted = false;
Point2 mpos = mb->get_pos();
Point2 mpos = mb->get_position();
if (mb->is_pressed()) {
Size2 pos = mpos;
@ -1740,11 +1740,11 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
mb = mb->xformed_by(Transform2D()); // make a copy of the event
mb->set_global_pos(pos);
mb->set_global_position(pos);
pos = gui.focus_inv_xform.xform(pos);
mb->set_pos(pos);
mb->set_position(pos);
#ifdef DEBUG_ENABLED
if (ScriptDebugger::get_singleton()) {
@ -1841,9 +1841,9 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
Size2 pos = mpos;
mb = mb->xformed_by(Transform2D()); //make a copy
mb->set_global_pos(pos);
mb->set_global_position(pos);
pos = gui.focus_inv_xform.xform(pos);
mb->set_pos(pos);
mb->set_position(pos);
if (gui.mouse_focus->can_process()) {
_gui_call_input(gui.mouse_focus, mb);
@ -1869,7 +1869,7 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
if (mm.is_valid()) {
gui.key_event_accepted = false;
Point2 mpos = mm->get_pos();
Point2 mpos = mm->get_position();
gui.last_mouse_pos = mpos;
@ -1961,7 +1961,7 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
mm = mm->xformed_by(Transform2D()); //make a copy
mm->set_global_pos(mpos);
mm->set_global_position(mpos);
mm->set_speed(speed);
mm->set_relative(rel);
@ -1999,7 +1999,7 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
//pos = gui.focus_inv_xform.xform(pos);
mm->set_pos(pos);
mm->set_position(pos);
Control::CursorShape cursor_shape = over->get_cursor_shape(pos);
OS::get_singleton()->set_cursor_shape((OS::CursorShape)cursor_shape);
@ -2318,7 +2318,7 @@ void Viewport::_gui_grab_click_focus(Control *p_control) {
//send unclic
Point2 click = gui.mouse_focus->get_global_transform_with_canvas().affine_inverse().xform(gui.last_mouse_pos);
mb->set_pos(click);
mb->set_position(click);
mb->set_button_index(gui.mouse_focus_button);
mb->set_pressed(false);
gui.mouse_focus->call_deferred(SceneStringNames::get_singleton()->_gui_input, mb);
@ -2326,7 +2326,7 @@ void Viewport::_gui_grab_click_focus(Control *p_control) {
gui.mouse_focus = p_control;
gui.focus_inv_xform = gui.mouse_focus->get_global_transform_with_canvas().affine_inverse();
click = gui.mouse_focus->get_global_transform_with_canvas().affine_inverse().xform(gui.last_mouse_pos);
mb->set_pos(click);
mb->set_position(click);
mb->set_button_index(gui.mouse_focus_button);
mb->set_pressed(true);
gui.mouse_focus->call_deferred(SceneStringNames::get_singleton()->_gui_input, mb);