diff options
Diffstat (limited to 'scene/main')
-rw-r--r-- | scene/main/viewport.cpp | 6 | ||||
-rw-r--r-- | scene/main/window.cpp | 20 | ||||
-rw-r--r-- | scene/main/window.h | 4 |
3 files changed, 17 insertions, 13 deletions
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 65a72267b1..1c259b7d32 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -2083,7 +2083,11 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) { Control *c = over; Vector2 cpos = pos; while (c) { - cursor_shape = c->get_cursor_shape(cpos); + if (gui.mouse_focus_mask != 0 || c->has_point(cpos)) { + cursor_shape = c->get_cursor_shape(cpos); + } else { + cursor_shape = Control::CURSOR_ARROW; + } cpos = c->get_transform().xform(cpos); if (cursor_shape != Control::CURSOR_ARROW) { break; diff --git a/scene/main/window.cpp b/scene/main/window.cpp index 0463615d4d..48540b7bc9 100644 --- a/scene/main/window.cpp +++ b/scene/main/window.cpp @@ -309,6 +309,7 @@ void Window::_event_callback(DisplayServer::WindowEvent p_event) { case DisplayServer::WINDOW_EVENT_MOUSE_ENTER: { _propagate_window_notification(this, NOTIFICATION_WM_MOUSE_ENTER); emit_signal("mouse_entered"); + DisplayServer::get_singleton()->cursor_set_shape(DisplayServer::CURSOR_ARROW); //restore cursor shape } break; case DisplayServer::WINDOW_EVENT_MOUSE_EXIT: { _propagate_window_notification(this, NOTIFICATION_WM_MOUSE_EXIT); @@ -624,26 +625,25 @@ void Window::_update_viewport_size() { // Already handled above //_update_font_oversampling(1.0); } break; - case CONTENT_SCALE_MODE_OBJECTS: { + case CONTENT_SCALE_MODE_CANVAS_ITEMS: { final_size = screen_size; final_size_override = viewport_size; attach_to_screen_rect = Rect2(margin, screen_size); font_oversampling = screen_size.x / viewport_size.x; + + Size2 scale = Vector2(screen_size) / Vector2(final_size_override); + stretch_transform.scale(scale); + } break; - case CONTENT_SCALE_MODE_PIXELS: { + case CONTENT_SCALE_MODE_VIEWPORT: { final_size = viewport_size; attach_to_screen_rect = Rect2(margin, screen_size); } break; } - - Size2 scale = size / (Vector2(final_size) + margin * 2); - stretch_transform.scale(scale); - stretch_transform.elements[2] = margin * scale; } bool allocate = is_inside_tree() && visible && (window_id != DisplayServer::INVALID_WINDOW_ID || embedder != nullptr); - _set_size(final_size, final_size_override, attach_to_screen_rect, stretch_transform, allocate); if (window_id != DisplayServer::INVALID_WINDOW_ID) { @@ -1372,7 +1372,7 @@ void Window::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::VECTOR2I, "max_size"), "set_max_size", "get_max_size"); ADD_GROUP("Content Scale", "content_scale_"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR2I, "content_scale_size"), "set_content_scale_size", "get_content_scale_size"); - ADD_PROPERTY(PropertyInfo(Variant::INT, "content_scale_mode", PROPERTY_HINT_ENUM, "Disabled,Object,Pixels"), "set_content_scale_mode", "get_content_scale_mode"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "content_scale_mode", PROPERTY_HINT_ENUM, "Disabled,CanvasItems,Viewport"), "set_content_scale_mode", "get_content_scale_mode"); ADD_PROPERTY(PropertyInfo(Variant::INT, "content_scale_aspect", PROPERTY_HINT_ENUM, "Ignore,Keep,KeepWidth,KeepHeight,Expand"), "set_content_scale_aspect", "get_content_scale_aspect"); ADD_GROUP("Theme", ""); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "theme", PROPERTY_HINT_RESOURCE_TYPE, "Theme"), "set_theme", "get_theme"); @@ -1403,8 +1403,8 @@ void Window::_bind_methods() { BIND_ENUM_CONSTANT(FLAG_MAX); BIND_ENUM_CONSTANT(CONTENT_SCALE_MODE_DISABLED); - BIND_ENUM_CONSTANT(CONTENT_SCALE_MODE_OBJECTS); - BIND_ENUM_CONSTANT(CONTENT_SCALE_MODE_PIXELS); + BIND_ENUM_CONSTANT(CONTENT_SCALE_MODE_CANVAS_ITEMS); + BIND_ENUM_CONSTANT(CONTENT_SCALE_MODE_VIEWPORT); BIND_ENUM_CONSTANT(CONTENT_SCALE_ASPECT_IGNORE); BIND_ENUM_CONSTANT(CONTENT_SCALE_ASPECT_KEEP); diff --git a/scene/main/window.h b/scene/main/window.h index 5fd59e06f5..c8c02b8984 100644 --- a/scene/main/window.h +++ b/scene/main/window.h @@ -57,8 +57,8 @@ public: enum ContentScaleMode { CONTENT_SCALE_MODE_DISABLED, - CONTENT_SCALE_MODE_OBJECTS, - CONTENT_SCALE_MODE_PIXELS, + CONTENT_SCALE_MODE_CANVAS_ITEMS, + CONTENT_SCALE_MODE_VIEWPORT, }; enum ContentScaleAspect { |