Merge pull request #30361 from LikeLakers2/camera2d-offset-ignores-limit

Camera2D's offset now ignores the limit property
This commit is contained in:
Rémi Verschelde 2019-07-08 13:40:35 +02:00 committed by GitHub
commit 410cb13abd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 17 deletions

View File

@ -140,9 +140,6 @@ Transform2D Camera2D::get_camera_transform() {
Point2 screen_offset = (anchor_mode == ANCHOR_MODE_DRAG_CENTER ? (screen_size * 0.5 * zoom) : Point2());
Rect2 screen_rect(-screen_offset + camera_pos, screen_size * zoom);
if (offset != Vector2())
screen_rect.position += offset;
if (limit_smoothing_enabled) {
if (screen_rect.position.x < limit[MARGIN_LEFT])
camera_pos.x -= screen_rect.position.x - limit[MARGIN_LEFT];
@ -193,21 +190,8 @@ Transform2D Camera2D::get_camera_transform() {
if (screen_rect.position.y < limit[MARGIN_TOP])
screen_rect.position.y = limit[MARGIN_TOP];
if (offset != Vector2()) {
if (offset != Vector2())
screen_rect.position += offset;
if (screen_rect.position.x + screen_rect.size.x > limit[MARGIN_RIGHT])
screen_rect.position.x = limit[MARGIN_RIGHT] - screen_rect.size.x;
if (screen_rect.position.y + screen_rect.size.y > limit[MARGIN_BOTTOM])
screen_rect.position.y = limit[MARGIN_BOTTOM] - screen_rect.size.y;
if (screen_rect.position.x < limit[MARGIN_LEFT])
screen_rect.position.x = limit[MARGIN_LEFT];
if (screen_rect.position.y < limit[MARGIN_TOP])
screen_rect.position.y = limit[MARGIN_TOP];
}
camera_screen_center = screen_rect.position + screen_rect.size * 0.5;