@@ -164,7 +164,7 @@ Transform2D Camera2D::get_camera_transform() {
164164
165165 if (limit_enabled && limit_smoothing_enabled) {
166166 // Apply horizontal limiting.
167- if (screen_rect. size . x > limit[SIDE_RIGHT] - limit[SIDE_LEFT] ) {
167+ if (limit[SIDE_LEFT] > limit[SIDE_RIGHT] - screen_rect. size . x ) {
168168 // Split the limit difference horizontally.
169169 camera_pos.x -= screen_rect.position .x + (screen_rect.size .x - limit[SIDE_RIGHT] - limit[SIDE_LEFT]) / 2 ;
170170 } else if (screen_rect.position .x < limit[SIDE_LEFT]) {
@@ -176,7 +176,7 @@ Transform2D Camera2D::get_camera_transform() {
176176 }
177177
178178 // Apply vertical limiting.
179- if (screen_rect. size . y > limit[SIDE_BOTTOM] - limit[SIDE_TOP] ) {
179+ if (limit[SIDE_TOP] > limit[SIDE_BOTTOM] - screen_rect. size . y ) {
180180 // Split the limit difference vertically.
181181 camera_pos.y -= screen_rect.position .y + (screen_rect.size .y - limit[SIDE_BOTTOM] - limit[SIDE_TOP]) / 2 ;
182182 } else if (screen_rect.position .y < limit[SIDE_TOP]) {
@@ -226,7 +226,7 @@ Transform2D Camera2D::get_camera_transform() {
226226 if (limit_enabled && (!position_smoothing_enabled || !limit_smoothing_enabled)) {
227227 Point2 bottom_right_corner = Point2 (screen_rect.position + 2.0 * (ret_camera_pos - screen_rect.position ));
228228 // Apply horizontal limiting.
229- if (bottom_right_corner.x - screen_rect.position .x > limit[SIDE_RIGHT] - limit[SIDE_LEFT] ) {
229+ if (limit[SIDE_LEFT] > limit[SIDE_RIGHT] - ( bottom_right_corner.x - screen_rect.position .x ) ) {
230230 // Split the difference horizontally (center it).
231231 screen_rect.position .x = (limit[SIDE_LEFT] + limit[SIDE_RIGHT] - (bottom_right_corner.x - screen_rect.position .x )) / 2 ;
232232 } else if (screen_rect.position .x < limit[SIDE_LEFT]) {
@@ -238,7 +238,7 @@ Transform2D Camera2D::get_camera_transform() {
238238 }
239239
240240 // Apply vertical limiting.
241- if (bottom_right_corner.y - screen_rect.position .y > limit[SIDE_BOTTOM] - limit[SIDE_TOP] ) {
241+ if (limit[SIDE_TOP] > limit[SIDE_BOTTOM] - ( bottom_right_corner.y - screen_rect.position .y ) ) {
242242 // Split the limit difference vertically.
243243 screen_rect.position .y = (limit[SIDE_TOP] + limit[SIDE_BOTTOM] - (bottom_right_corner.y - screen_rect.position .y )) / 2 ;
244244 } else if (screen_rect.position .y < limit[SIDE_TOP]) {
0 commit comments