From 473695ab47190f39abfc131cb70bb71766a772d2 Mon Sep 17 00:00:00 2001 From: Poommetee Ketson Date: Sat, 26 Aug 2017 23:02:52 +0700 Subject: [PATCH] Monitor: add hint, fix certain graph not drawn Add a hint that helps user discover monitor graph Fix last row drawn outside when only one graph is in that row --- editor/script_editor_debugger.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp index 689bea27494..d1d9f86b669 100644 --- a/editor/script_editor_debugger.cpp +++ b/editor/script_editor_debugger.cpp @@ -789,14 +789,17 @@ void ScriptEditorDebugger::_performance_draw() { which.push_back(i); } - if (which.empty()) - return; - - Ref graph_sb = get_stylebox("normal", "TextEdit"); Ref graph_font = get_font("font", "TextEdit"); + if (which.empty()) { + perf_draw->draw_string(graph_font, Point2(0, graph_font->get_ascent()), TTR("Pick one or more items from the list to display the graph."), get_color("font_color", "Label"), perf_draw->get_size().x); + return; + } + + Ref graph_sb = get_stylebox("normal", "TextEdit"); + int cols = Math::ceil(Math::sqrt((float)which.size())); - int rows = (which.size() + 1) / cols; + int rows = Math::ceil((float)which.size() / cols); if (which.size() == 1) rows = 1;