summaryrefslogtreecommitdiff
path: root/scene/2d/camera_2d.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2020-06-15 23:36:23 +0200
committerGitHub <noreply@github.com>2020-06-15 23:36:23 +0200
commitc5a2a7a66a55fb258ee62f96afc29a7ccaaf8771 (patch)
tree6a22c98ff4aa8b63886a4dbc64a1d91549ddcdcc /scene/2d/camera_2d.cpp
parentdf5aa9b933c99c2aac1112ee8a70672da530556d (diff)
parentbccc2cdb9c574c3e410b7c96ae3e7b26f071aaa4 (diff)
Merge pull request #39567 from Ranoller/patch-1
Fix bad position in Camera2D offset and camera rotation if smothing e…
Diffstat (limited to 'scene/2d/camera_2d.cpp')
-rw-r--r--scene/2d/camera_2d.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp
index 8f69676da4..68e99445d8 100644
--- a/scene/2d/camera_2d.cpp
+++ b/scene/2d/camera_2d.cpp
@@ -343,7 +343,9 @@ void Camera2D::_notification(int p_what) {
void Camera2D::set_offset(const Vector2 &p_offset) {
offset = p_offset;
+ Point2 old_smoothed_camera_pos = smoothed_camera_pos;
_update_scroll();
+ smoothed_camera_pos = old_smoothed_camera_pos;
}
Vector2 Camera2D::get_offset() const {
@@ -361,7 +363,9 @@ Camera2D::AnchorMode Camera2D::get_anchor_mode() const {
void Camera2D::set_rotating(bool p_rotating) {
rotating = p_rotating;
+ Point2 old_smoothed_camera_pos = smoothed_camera_pos;
_update_scroll();
+ smoothed_camera_pos = old_smoothed_camera_pos;
}
bool Camera2D::is_rotating() const {
@@ -522,7 +526,9 @@ bool Camera2D::is_v_drag_enabled() const {
void Camera2D::set_v_offset(float p_offset) {
v_ofs = p_offset;
v_offset_changed = true;
+ Point2 old_smoothed_camera_pos = smoothed_camera_pos;
_update_scroll();
+ smoothed_camera_pos = old_smoothed_camera_pos;
}
float Camera2D::get_v_offset() const {
@@ -532,7 +538,9 @@ float Camera2D::get_v_offset() const {
void Camera2D::set_h_offset(float p_offset) {
h_ofs = p_offset;
h_offset_changed = true;
+ Point2 old_smoothed_camera_pos = smoothed_camera_pos;
_update_scroll();
+ smoothed_camera_pos = old_smoothed_camera_pos;
}
float Camera2D::get_h_offset() const {