Skip to content

Commit c0ff3be

Browse files
committed
Fix layout
1 parent 4c205f7 commit c0ff3be

File tree

3 files changed

+19
-11
lines changed

3 files changed

+19
-11
lines changed

Editor/Core/UI/LogWindow-DebugChan.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ public void OnGenericMessage(string message, object sender, int messageCount){
1414
}
1515
}
1616

17-
void DrawLoggerTextView(float time){
17+
void DrawLoggerTextView(float time, int? height){
1818
string content;
1919
if(browsing && !useHistory){
2020
content = model.dcRange.Format();
2121
}else{
2222
content = EvalTextContent(time);
2323
}
24-
DrawTextView(content, ref dc_scroll);
24+
DrawTextView(content, height, ref dc_scroll);
2525
}
2626

2727
string EvalTextContent(float time){

Editor/Core/UI/LogWindow-Prolog.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ public partial class LogWindow{ // Prolog
1818

1919
Vector2 p_scroll;
2020

21-
void DrawPrologView(float time){
21+
void DrawPrologView(float time, int? height){
2222
DrawPrologHeader();
23-
DrawPrologTextView(time);
23+
DrawPrologTextView(time, height);
2424
}
2525

2626
void DrawPrologHeader(){
@@ -34,7 +34,7 @@ void DrawPrologHeader(){
3434
EndHorizontal();
3535
}
3636

37-
void DrawPrologTextView(float time){
37+
void DrawPrologTextView(float time, int? height){
3838
string log;
3939
var rtype = rtypeOptions[Config.rtypeIndex];
4040
if(useHistory){
@@ -43,10 +43,9 @@ void DrawPrologTextView(float time){
4343
}else{
4444
log = model.GetPrologOutput(rtype);
4545
}
46-
4746
if(currentLog != log && Config.step) Ed.isPaused = true;
4847
currentLog = log;
49-
DrawTextView(browsing ? model.pgRange.Format() : log, ref p_scroll);
48+
DrawTextView(browsing ? model.pgRange.Format() : log, height, ref p_scroll);
5049
}
5150

5251
void DrawConfigSelector(){

Editor/Core/UI/LogWindow.cs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,13 @@ void OnGUI(){
4949
instance = this;
5050
if(isPlaying) time = Time.time;
5151
DrawScrubber();
52-
DrawLoggerTextView(time);
53-
if(Config.enableInjection) DrawPrologView(time);
52+
// NOTE: didn't find a clean way to stabilize window
53+
// heights when 2 scrolling text areas are involved;
54+
// therefore if only 1, expand; otherwise do some calc.
55+
// ('position' is the editor window rectangle)
56+
int? height = Config.enableInjection ? (int?)position.height/2 - 48 : null;
57+
DrawLoggerTextView(time, height);
58+
if(Config.enableInjection) DrawPrologView(time, height);
5459
DrawFooter();
5560
}
5661

@@ -100,8 +105,12 @@ void DrawEnableInjection(){
100105
Config.enableInjection, GL.Width(30));
101106
}
102107

103-
void DrawTextView(string text, ref Vector2 scroll){
104-
scroll = BeginScrollView(scroll, GL.Height(360));
108+
void DrawTextView(string text, int? height, ref Vector2 scroll){
109+
if(height.HasValue){
110+
scroll = BeginScrollView(scroll, GL.Height(height.Value));
111+
}else{
112+
scroll = BeginScrollView(scroll);
113+
}
105114
GUI.backgroundColor = Color.black;
106115
ConfigTextAreaStyle();
107116
GL.TextArea(text, GL.ExpandHeight(true));

0 commit comments

Comments
 (0)