Repository: godotengine/godot
File: editor/plugins/camera_2d_editor_plugin.cpp (C++)

Code before:
	if (Rect2(limit_rect.position - tolerance_vector, tolerance_vector * 2).has_point(p_mouse_pos)) {
		hover_type = Drag::TOP_LEFT;
	} else if (Rect2(Vector2(limit_rect.get_end().x, limit_rect.position.y) - tolerance_vector, tolerance_vector * 2).has_point(p_mouse_pos)) {
		hover_type = Drag::TOP_RIGHT;
	} else if (Rect2(Vector2(limit_rect.position.x, limit_rect.get_end().y) - tolerance_vector, tolerance_vector * 2).has_point(p_mouse_pos)) {
		hover_type = Drag::BOTTOM_LEFT;
	} else if (Rect2(limit_rect.get_end() - tolerance_vector, tolerance_vector * 2).has_point(p_mouse_pos)) {
		hover_type = Drag::BOTTOM_RIGHT;
	} else if (p_mouse_pos.y > limit_rect.position.y && p_mouse_pos.y < limit_rect.get_end().y) {
		if (Math::abs(p_mouse_pos.x - limit_rect.position.x) < drag_tolerance) {
			hover_type = Drag::LEFT;
		} else if (Math::abs(p_mouse_pos.x - limit_rect.get_end().x) < drag_tolerance) {
			hover_type = Drag::RIGHT;
		}
	} else if (p_mouse_pos.x > limit_rect.position.x && p_mouse_pos.x < limit_rect.get_end().x) {
		if (Math::abs(p_mouse_pos.y - limit_rect.position.y) < drag_tolerance) {
			hover_type = Drag::TOP;
		} else if (Math::abs(p_mouse_pos.y - limit_rect.get_end().y) < drag_tolerance) {
			hover_type = Drag::BOTTOM;
		}
	}

	if (hover_type == Drag::NONE && limit_rect.has_point(p_mouse_pos)) {
		const Rect2 editor_rect = Rect2(Vector2(), CanvasItemEditor::get_singleton()->get_viewport_control()->get_size());
		const Rect2 transformed_rect = selected_camera->get_viewport()->get_canvas_transform().xform_inv(limit_rect);
		// const Rect2 transformed_rect = selected_camera->get_limit_rect();

		// Only allow center drag if any limit edge is visible on screen.
		bool edge_visible = false;
		edge_visible = edge_visible || (transformed_rect.get_end().y > editor_rect.position.y && transformed_rect.position.y < editor_rect.get_end().y && transformed_rect.position.x > editor_rect.position.x && transformed_rect.position.x < editor_rect.get_end().x);
		edge_visible = edge_visible || (transformed_rect.get_end().y > editor_rect.position.y && transformed_rect.position.y < editor_rect.get_end().y && transformed_rect.get_end().x > editor_rect.position.x && transformed_rect.get_end().x < editor_rect.get_end().x);
		edge_visible = edge_visible || (transformed_rect.get_end().x > editor_rect.position.x && transformed_rect.position.x < editor_rect.get_end().x && transformed_rect.position.y > editor_rect.position.y && transformed_rect.position.y < editor_rect.get_end().y);
		edge_visible = edge_visible || (transformed_rect.get_end().x > editor_rect.position.x && transformed_rect.position.x < editor_rect.get_end().x && transformed_rect.get_end().y > editor_rect.position.y && transformed_rect.get_end().y < editor_rect.get_end().y);

		if (edge_visible) {
			hover_type = Drag::CENTER;
		}
	}

	switch (hover_type) {
		case Drag::NONE: {
			CanvasItemEditor::get_singleton()->set_cursor_shape_override();
		} break;
		case Drag::LEFT:
		case Drag::RIGHT: {
			CanvasItemEditor::get_singleton()->set_cursor_shape_override(CURSOR_HSIZE);
		} break;
		case Drag::TOP:
		case Drag::BOTTOM: {
			CanvasItemEditor::get_singleton()->set_cursor_shape_override(CURSOR_VSIZE);
		} break;

Review comment (suggestion):
```suggestion
		//const Rect2 transformed_rect = selected_camera->get_limit_rect();
```
Or remove 

Code after:
	if (Rect2(limit_rect.position - tolerance_vector, tolerance_vector * 2).has_point(p_mouse_pos)) {
		hover_type = Drag::TOP_LEFT;
	} else if (Rect2(Vector2(limit_rect.get_end().x, limit_rect.position.y) - tolerance_vector, tolerance_vector * 2).has_point(p_mouse_pos)) {
		hover_type = Drag::TOP_RIGHT;
	} else if (Rect2(Vector2(limit_rect.position.x, limit_rect.get_end().y) - tolerance_vector, tolerance_vector * 2).has_point(p_mouse_pos)) {
		hover_type = Drag::BOTTOM_LEFT;
	} else if (Rect2(limit_rect.get_end() - tolerance_vector, tolerance_vector * 2).has_point(p_mouse_pos)) {
		hover_type = Drag::BOTTOM_RIGHT;
	} else if (p_mouse_pos.y > limit_rect.position.y && p_mouse_pos.y < limit_rect.get_end().y) {
		if (Math::abs(p_mouse_pos.x - limit_rect.position.x) < drag_tolerance) {
			hover_type = Drag::LEFT;
		} else if (Math::abs(p_mouse_pos.x - limit_rect.get_end().x) < drag_tolerance) {
			hover_type = Drag::RIGHT;
		}
	} else if (p_mouse_pos.x > limit_rect.position.x && p_mouse_pos.x < limit_rect.get_end().x) {
		if (Math::abs(p_mouse_pos.y - limit_rect.position.y) < drag_tolerance) {
			hover_type = Drag::TOP;
		} else if (Math::abs(p_mouse_pos.y - limit_rect.get_end().y) < drag_tolerance) {
			hover_type = Drag::BOTTOM;
		}
	}

	if (hover_type == Drag::NONE && limit_rect.has_point(p_mouse_pos)) {
		const Rect2 editor_rect = Rect2(Vector2(), CanvasItemEditor::get_singleton()->get_viewport_control()->get_size());
		const Rect2 transformed_rect = selected_camera->get_viewport()->get_canvas_transform().xform_inv(limit_rect);

		// Only allow center drag if any limit edge is visible on screen.
		bool edge_visible = false;
		edge_visible = edge_visible || (transformed_rect.get_end().y > editor_rect.position.y && transformed_rect.position.y < editor_rect.get_end().y && transformed_rect.position.x > editor_rect.position.x && transformed_rect.position.x < editor_rect.get_end().x);
		edge_visible = edge_visible || (transformed_rect.get_end().y > editor_rect.position.y && transformed_rect.position.y < editor_rect.get_end().y && transformed_rect.get_end().x > editor_rect.position.x && transformed_rect.get_end().x < editor_rect.get_end().x);
		edge_visible = edge_visible || (transformed_rect.get_end().x > editor_rect.position.x && transformed_rect.position.x < editor_rect.get_end().x && transformed_rect.position.y > editor_rect.position.y && transformed_rect.position.y < editor_rect.get_end().y);
		edge_visible = edge_visible || (transformed_rect.get_end().x > editor_rect.position.x && transformed_rect.position.x < editor_rect.get_end().x && transformed_rect.get_end().y > editor_rect.position.y && transformed_rect.get_end().y < editor_rect.get_end().y);

		if (edge_visible) {
			hover_type = Drag::CENTER;
		}
	}

	switch (hover_type) {
		case Drag::NONE: {
			CanvasItemEditor::get_singleton()->set_cursor_shape_override();
		} break;
		case Drag::LEFT:
		case Drag::RIGHT: {
			CanvasItemEditor::get_singleton()->set_cursor_shape_override(CURSOR_HSIZE);
		} break;
		case Drag::TOP:
		case Drag::BOTTOM: {
			CanvasItemEditor::get_singleton()->set_cursor_shape_override(CURSOR_VSIZE);
		} break;
		case Drag::TOP_LEFT: