summaryrefslogtreecommitdiff
path: root/editor/plugins/tiles/tiles_editor_plugin.cpp
diff options
context:
space:
mode:
authorkobewi <kobewi4e@gmail.com>2022-05-08 21:52:36 +0200
committerkobewi <kobewi4e@gmail.com>2022-12-09 14:46:17 +0100
commit871278cdf0d885866bd75fb5b6d7d57b917eae8d (patch)
tree20ee83a7c657377e0ed97387ffe8848211e4020c /editor/plugins/tiles/tiles_editor_plugin.cpp
parent45cac42c0b511672240c1fcccecfd3cc0580edcb (diff)
Improve tile editor selection appearance
Diffstat (limited to 'editor/plugins/tiles/tiles_editor_plugin.cpp')
-rw-r--r--editor/plugins/tiles/tiles_editor_plugin.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/editor/plugins/tiles/tiles_editor_plugin.cpp b/editor/plugins/tiles/tiles_editor_plugin.cpp
index 5d93f58f34..ee29913334 100644
--- a/editor/plugins/tiles/tiles_editor_plugin.cpp
+++ b/editor/plugins/tiles/tiles_editor_plugin.cpp
@@ -385,6 +385,15 @@ bool TilesEditorPlugin::handles(Object *p_object) const {
return p_object->is_class("TileMap") || p_object->is_class("TileSet");
}
+void TilesEditorPlugin::draw_selection_rect(CanvasItem *p_ci, const Rect2 &p_rect, const Color &p_color) {
+ real_t scale = p_ci->get_global_transform().get_scale().x * 0.5;
+ p_ci->draw_set_transform(p_rect.position, 0, Vector2(1, 1) / scale);
+ RS::get_singleton()->canvas_item_add_nine_patch(
+ p_ci->get_canvas_item(), Rect2(Vector2(), p_rect.size * scale), Rect2(), EditorNode::get_singleton()->get_gui_base()->get_theme_icon(SNAME("TileSelection"), SNAME("EditorIcons"))->get_rid(),
+ Vector2(2, 2), Vector2(2, 2), RS::NINE_PATCH_STRETCH, RS::NINE_PATCH_STRETCH, false, p_color);
+ p_ci->draw_set_transform_matrix(Transform2D());
+}
+
TilesEditorPlugin::TilesEditorPlugin() {
set_process_internal(true);