summaryrefslogtreecommitdiff
path: root/scene/2d
diff options
context:
space:
mode:
authorrobfram <robfram@gmail.com>2018-01-27 19:37:04 +0100
committerrobfram <robfram@gmail.com>2018-01-27 19:37:04 +0100
commit3cf2d6524b85c5e536dbb00f16de720c3eccbce8 (patch)
treea35ff56eb1d8a776379c8cc3fe714c0a6b58cad6 /scene/2d
parent4a042b1f7a4d6d9d41ab46c5e0f069d848b408f5 (diff)
Fix inverted RIGHT/LEFT TOP/BOTTOM Camera2D drag margin in runtime (editor works fine). Fix #16095.
Diffstat (limited to 'scene/2d')
-rw-r--r--scene/2d/camera_2d.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp
index e7e62a197c..d172da5bd9 100644
--- a/scene/2d/camera_2d.cpp
+++ b/scene/2d/camera_2d.cpp
@@ -91,8 +91,8 @@ Transform2D Camera2D::get_camera_transform() {
if (anchor_mode == ANCHOR_MODE_DRAG_CENTER) {
if (h_drag_enabled && !Engine::get_singleton()->is_editor_hint()) {
- camera_pos.x = MIN(camera_pos.x, (new_camera_pos.x + screen_size.x * 0.5 * drag_margin[MARGIN_RIGHT]));
- camera_pos.x = MAX(camera_pos.x, (new_camera_pos.x - screen_size.x * 0.5 * drag_margin[MARGIN_LEFT]));
+ camera_pos.x = MIN(camera_pos.x, (new_camera_pos.x + screen_size.x * 0.5 * drag_margin[MARGIN_LEFT]));
+ camera_pos.x = MAX(camera_pos.x, (new_camera_pos.x - screen_size.x * 0.5 * drag_margin[MARGIN_RIGHT]));
} else {
if (h_ofs < 0) {
@@ -104,8 +104,8 @@ Transform2D Camera2D::get_camera_transform() {
if (v_drag_enabled && !Engine::get_singleton()->is_editor_hint()) {
- camera_pos.y = MIN(camera_pos.y, (new_camera_pos.y + screen_size.y * 0.5 * drag_margin[MARGIN_BOTTOM]));
- camera_pos.y = MAX(camera_pos.y, (new_camera_pos.y - screen_size.y * 0.5 * drag_margin[MARGIN_TOP]));
+ camera_pos.y = MIN(camera_pos.y, (new_camera_pos.y + screen_size.y * 0.5 * drag_margin[MARGIN_TOP]));
+ camera_pos.y = MAX(camera_pos.y, (new_camera_pos.y - screen_size.y * 0.5 * drag_margin[MARGIN_BOTTOM]));
} else {