fixes to mouse warp
-can warp now from viewport and control, in their respective coordinate systems -warp is now local to the window on Windows and OSX. IF YOU RUN OSX, PLEASE TEST THIS! And make sure it works!, new code is in OS_OSX::warp_mouse_pos. I don't have OSX so i can't test!
This commit is contained in:
@@ -2688,6 +2688,12 @@ Control *Control::get_focus_owner() const {
|
||||
return data.window->window->key_focus;
|
||||
}
|
||||
|
||||
|
||||
void Control::warp_mouse(const Point2& p_to_pos) {
|
||||
ERR_FAIL_COND(!is_inside_tree());
|
||||
get_viewport()->warp_mouse(get_global_transform().xform(p_to_pos));
|
||||
}
|
||||
|
||||
void Control::_bind_methods() {
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("_window_input_event"),&Control::_window_input_event);
|
||||
@@ -2784,6 +2790,9 @@ void Control::_bind_methods() {
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("set_drag_preview","control:Control"),&Control::set_drag_preview);
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("warp_mouse","to_pos"),&Control::warp_mouse);
|
||||
|
||||
|
||||
BIND_VMETHOD(MethodInfo("_input_event",PropertyInfo(Variant::INPUT_EVENT,"event")));
|
||||
BIND_VMETHOD(MethodInfo(Variant::VECTOR2,"get_minimum_size"));
|
||||
BIND_VMETHOD(MethodInfo(Variant::OBJECT,"get_drag_data",PropertyInfo(Variant::VECTOR2,"pos")));
|
||||
|
||||
Reference in New Issue
Block a user