summaryrefslogtreecommitdiff
path: root/scene/2d
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2018-08-13 09:03:34 +0200
committerGitHub <noreply@github.com>2018-08-13 09:03:34 +0200
commit2062d6126d70f5c70b7b03ecb9372ec637c0ea3e (patch)
tree7a9b2c214bc9d8b482af164bf93c1b23a8f811c7 /scene/2d
parent284b56f2fbddea4a5e951279ae897900a21baed1 (diff)
parenteb7f4ddccebfc0aca0a8981f3ba62971cb9838d4 (diff)
Merge pull request #20587 from groud/fix_2deditor_scrollable_zone
Fixes bugs on the 2D editor scrollable area
Diffstat (limited to 'scene/2d')
-rw-r--r--scene/2d/tile_map.cpp11
-rw-r--r--scene/2d/tile_map.h2
2 files changed, 8 insertions, 5 deletions
diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp
index ee7058d4a6..80565fa455 100644
--- a/scene/2d/tile_map.cpp
+++ b/scene/2d/tile_map.cpp
@@ -631,11 +631,7 @@ void TileMap::_recompute_rect_cache() {
r_total = r_total.merge(r);
}
- if (r_total == Rect2()) {
- rect_cache = Rect2(-10, -10, 20, 20);
- } else {
- rect_cache = r_total.grow(MAX(cell_size.x, cell_size.y) * _get_quadrant_size());
- }
+ rect_cache = r_total;
item_rect_changed();
@@ -1152,6 +1148,11 @@ PoolVector<int> TileMap::_get_tile_data() const {
return data;
}
+Rect2 TileMap::_edit_get_rect() const {
+ const_cast<TileMap *>(this)->update_dirty_quadrants();
+ return rect_cache;
+}
+
void TileMap::set_collision_layer(uint32_t p_layer) {
collision_layer = p_layer;
diff --git a/scene/2d/tile_map.h b/scene/2d/tile_map.h
index c8aceac17d..52aa6e8e2a 100644
--- a/scene/2d/tile_map.h
+++ b/scene/2d/tile_map.h
@@ -223,6 +223,8 @@ public:
INVALID_CELL = -1
};
+ virtual Rect2 _edit_get_rect() const;
+
void set_tileset(const Ref<TileSet> &p_tileset);
Ref<TileSet> get_tileset() const;