summaryrefslogtreecommitdiff
path: root/scene/2d/camera_2d.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2022-02-15 18:06:48 +0100
committerRémi Verschelde <rverschelde@gmail.com>2022-02-15 18:44:55 +0100
commit0f5455230c8955be0c6533574bd3d5b6f50792b6 (patch)
tree2167f70782174feda2541c163d264c62402b50be /scene/2d/camera_2d.cpp
parent171021145d49ffdda9110869d35ee63a946af9f8 (diff)
Use `switch` consistently in `_notification` (`scene` folder)
Diffstat (limited to 'scene/2d/camera_2d.cpp')
-rw-r--r--scene/2d/camera_2d.cpp18
1 files changed, 5 insertions, 13 deletions
diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp
index 548cd5de9a..390e6685b1 100644
--- a/scene/2d/camera_2d.cpp
+++ b/scene/2d/camera_2d.cpp
@@ -206,15 +206,7 @@ Transform2D Camera2D::get_camera_transform() {
if (rotating) {
xform.set_rotation(angle);
}
- xform.set_origin(screen_rect.position /*.floor()*/);
-
- /*
- if (0) {
- xform = get_global_transform() * xform;
- } else {
- xform.elements[2]+=get_global_transform().get_origin();
- }
-*/
+ xform.set_origin(screen_rect.position);
return (xform).affine_inverse();
}
@@ -224,14 +216,14 @@ void Camera2D::_notification(int p_what) {
case NOTIFICATION_INTERNAL_PROCESS:
case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {
_update_scroll();
-
} break;
+
case NOTIFICATION_TRANSFORM_CHANGED: {
if (!is_processing_internal() && !is_physics_processing_internal()) {
_update_scroll();
}
-
} break;
+
case NOTIFICATION_ENTER_TREE: {
ERR_FAIL_COND(!is_inside_tree());
if (custom_viewport && ObjectDB::get_instance(custom_viewport_id)) {
@@ -256,8 +248,8 @@ void Camera2D::_notification(int p_what) {
_update_process_callback();
_update_scroll();
first = true;
-
} break;
+
case NOTIFICATION_EXIT_TREE: {
if (is_current()) {
if (viewport && !(custom_viewport && !ObjectDB::get_instance(custom_viewport_id))) {
@@ -269,8 +261,8 @@ void Camera2D::_notification(int p_what) {
remove_from_group(group_name);
remove_from_group(canvas_group_name);
viewport = nullptr;
-
} break;
+
#ifdef TOOLS_ENABLED
case NOTIFICATION_DRAW: {
if (!is_inside_tree() || !Engine::get_singleton()->is_editor_hint()) {