|
@@ -272,16 +272,17 @@ Transform2D Camera2D::get_camera_transform() {
|
|
Rect2 screen_rect(-screen_offset + ret_camera_pos, screen_size * zoom_scale);
|
|
Rect2 screen_rect(-screen_offset + ret_camera_pos, screen_size * zoom_scale);
|
|
|
|
|
|
if (limit_enabled && (!position_smoothing_enabled || !limit_smoothing_enabled)) {
|
|
if (limit_enabled && (!position_smoothing_enabled || !limit_smoothing_enabled)) {
|
|
|
|
+ Point2 bottom_right_corner = Point2(screen_rect.position + 2.0 * (camera_pos - screen_rect.position));
|
|
if (screen_rect.position.x < limit[SIDE_LEFT]) {
|
|
if (screen_rect.position.x < limit[SIDE_LEFT]) {
|
|
screen_rect.position.x = limit[SIDE_LEFT];
|
|
screen_rect.position.x = limit[SIDE_LEFT];
|
|
}
|
|
}
|
|
|
|
|
|
- if (screen_rect.position.x + screen_rect.size.x > limit[SIDE_RIGHT]) {
|
|
|
|
- screen_rect.position.x = limit[SIDE_RIGHT] - screen_rect.size.x;
|
|
|
|
|
|
+ if (bottom_right_corner.x > limit[SIDE_RIGHT]) {
|
|
|
|
+ screen_rect.position.x = limit[SIDE_RIGHT] - (bottom_right_corner.x - screen_rect.position.x);
|
|
}
|
|
}
|
|
|
|
|
|
- if (screen_rect.position.y + screen_rect.size.y > limit[SIDE_BOTTOM]) {
|
|
|
|
- screen_rect.position.y = limit[SIDE_BOTTOM] - screen_rect.size.y;
|
|
|
|
|
|
+ if (bottom_right_corner.y > limit[SIDE_BOTTOM]) {
|
|
|
|
+ screen_rect.position.y = limit[SIDE_BOTTOM] - (bottom_right_corner.y - screen_rect.position.y);
|
|
}
|
|
}
|
|
|
|
|
|
if (screen_rect.position.y < limit[SIDE_TOP]) {
|
|
if (screen_rect.position.y < limit[SIDE_TOP]) {
|