File tree Expand file tree Collapse file tree 5 files changed +18
-3
lines changed Expand file tree Collapse file tree 5 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -109,8 +109,9 @@ void SpinBox::_range_click_timeout() {
109
109
void SpinBox::_release_mouse () {
110
110
if (drag.enabled ) {
111
111
drag.enabled = false ;
112
- Input::get_singleton ()->set_mouse_mode (Input::MOUSE_MODE_VISIBLE );
112
+ Input::get_singleton ()->set_mouse_mode (Input::MOUSE_MODE_HIDDEN );
113
113
warp_mouse (drag.capture_pos );
114
+ Input::get_singleton ()->set_mouse_mode (Input::MOUSE_MODE_VISIBLE);
114
115
}
115
116
}
116
117
Original file line number Diff line number Diff line change @@ -1104,7 +1104,7 @@ Vector2 Viewport::get_mouse_position() const {
1104
1104
1105
1105
void Viewport::warp_mouse (const Vector2 &p_position) {
1106
1106
Transform2D xform = get_screen_transform ();
1107
- Vector2 gpos = xform.xform (p_position). round () ;
1107
+ Vector2 gpos = xform.xform (p_position);
1108
1108
Input::get_singleton ()->warp_mouse (gpos);
1109
1109
}
1110
1110
Original file line number Diff line number Diff line change @@ -563,7 +563,7 @@ class Viewport : public Node {
563
563
bool is_input_disabled () const ;
564
564
565
565
Vector2 get_mouse_position () const ;
566
- void warp_mouse (const Vector2 &p_position);
566
+ virtual void warp_mouse (const Vector2 &p_position);
567
567
568
568
void set_physics_object_picking (bool p_enable);
569
569
bool get_physics_object_picking ();
Original file line number Diff line number Diff line change @@ -966,6 +966,18 @@ DisplayServer::WindowID Window::get_window_id() const {
966
966
return window_id;
967
967
}
968
968
969
+ void Window::warp_mouse (const Vector2 &p_position) {
970
+ Transform2D xform = get_screen_transform ();
971
+ Vector2 gpos = xform.xform (p_position);
972
+
973
+ if (transient_parent && !transient_parent->is_embedding_subwindows ()) {
974
+ Transform2D window_trans = Transform2D ().translated (get_position () + (transient_parent->get_visible_rect ().size - transient_parent->get_real_size ()));
975
+ gpos = window_trans.xform (gpos);
976
+ }
977
+
978
+ Input::get_singleton ()->warp_mouse (gpos);
979
+ }
980
+
969
981
void Window::set_wrap_controls (bool p_enable) {
970
982
wrap_controls = p_enable;
971
983
if (wrap_controls) {
Original file line number Diff line number Diff line change @@ -239,6 +239,8 @@ class Window : public Viewport {
239
239
void set_use_font_oversampling (bool p_oversampling);
240
240
bool is_using_font_oversampling () const ;
241
241
242
+ void warp_mouse (const Vector2 &p_position) override ;
243
+
242
244
void set_wrap_controls (bool p_enable);
243
245
bool is_wrapping_controls () const ;
244
246
void child_controls_changed ();
You can’t perform that action at this time.
0 commit comments