From 1c8ba271e0375124e6fd8965b5fbe1a040d8af63 Mon Sep 17 00:00:00 2001 From: Leroy Hopson Date: Fri, 16 Oct 2020 12:18:22 +0700 Subject: [PATCH] Position background rect at 0,0 This is important when terminal is a child of a Container node and we set the margin properties, otherwise the background rect is drawn with an offset. --- CHANGELOG.md | 1 + addons/godot_xterm/native/src/terminal.cpp | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a64e17a..1e76b2f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Changed - Updated build script (`addons/godot_xterm/native/build.sh`). Git submodules will now be initialized if they haven't already. Moved nix-shell related stuff to a seperate shell.nix file so the same build command can be used on all Linux based OSes. +- Positioned background rect at 0,0 so it is no longer offset if a margin is added when Terminal is a child of a Container node. ## [1.0.0] - 2020-10-05 ### Added diff --git a/addons/godot_xterm/native/src/terminal.cpp b/addons/godot_xterm/native/src/terminal.cpp index d690ef5..58815e0 100644 --- a/addons/godot_xterm/native/src/terminal.cpp +++ b/addons/godot_xterm/native/src/terminal.cpp @@ -371,7 +371,7 @@ void Terminal::_draw() return; /* Draw the full terminal rect background */ - draw_rect(get_rect(), get_color("Background", "Terminal")); + draw_rect(Rect2(Vector2(0, 0), get_rect().size), get_color("Background", "Terminal")); for (int row = 0; row < rows; row++) { @@ -597,4 +597,4 @@ void Terminal::write(Variant data) tsm_vte_input(vte, u8, len); framebuffer_age = tsm_screen_draw(screen, text_draw_cb, this); -} \ No newline at end of file +}