console fixes

This commit is contained in:
2022-04-24 17:18:58 +03:00
parent ad5ed57c3a
commit a60c27b55a
4 changed files with 13 additions and 62 deletions

View File

@@ -76,7 +76,7 @@
},
"Control": "FlaxEngine.GUI.Label",
"Data": {
"Text": "eFPS: 120 uTime: 3.3759838\nuFPS: 120 uTime: 0\nrFPS: 120 rTime: 0\npFPS: 30 pTime: 0",
"Text": "eFPS: 120 uTime: 5.1785762\nuFPS: 120 uTime: 0.00833330024033785\nrFPS: 120 rTime: 0\npFPS: 30 pTime: 0",
"TextColor": {
"R": 1.0,
"G": 1.0,
@@ -123,7 +123,7 @@
},
"Offsets": {
"Left": 0.0,
"Right": 161.0,
"Right": 231.0,
"Top": -97.0,
"Bottom": 64.0
},
@@ -151,12 +151,6 @@
"AutoFocus": false
}
},
{
"ID": "7261228a42b41682cf48e89d910ddcff",
"TypeName": "FlaxEngine.UIControl",
"ParentID": "ff6b6db54b5aa08e7286ef86246149ef",
"Name": "UIControl"
},
{
"ID": "9b0c532d4247061970c809a0af58c82a",
"TypeName": "FlaxEngine.PostFxVolume",

View File

@@ -1,39 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using FlaxEditor;
using FlaxEngine;
using FlaxEngine.GUI;
namespace Cabrito
{
// Container that keeps the focus on the input box
public class ConsoleContainerControl : ContainerControl
{
[HideInEditor] public ConsoleInputTextBox inputBox;
public ConsoleContainerControl() : base()
{
}
public ConsoleContainerControl(float x, float y, float width, float height) : base(x, y, width, height)
{
}
public ConsoleContainerControl(Rectangle bounds) : base(bounds)
{
}
public override void OnGotFocus()
{
base.OnGotFocus();
if (inputBox != null)
Focus(inputBox);
}
public override void OnLostFocus()
{
base.OnLostFocus();
}
}
}

View File

@@ -523,8 +523,6 @@ namespace Cabrito
selectionEndChar = hitChar;
//FlaxEngine.Debug.Log(string.Format("start line {0} char {1}", hitLine, hitChar));
}
else
throw new Exception("no???");
// Select range with shift
@@ -572,6 +570,17 @@ namespace Cabrito
return false;
}
public override void OnMouseLeave()
{
base.OnMouseLeave();
if (selectionActive)
{
OnSelectingEnd();
Focus(inputBox);
}
}
protected void Copy()
{
if (!selectionActive)

View File

@@ -49,18 +49,6 @@ namespace Cabrito
rootControl.Name = "ConsoleRoot";
rootControl.Control = rootContainerControl;
// Create a container that keeps the focus in the input box when clicked outside the console window.
// The container must be created before the content box so interacting with the console lines wont get
// stolen by this container.
var containerControl = new ConsoleContainerControl(new Rectangle());
containerControl.SetAnchorPreset(AnchorPresets.StretchAll, false);
var focusControl = new UIControl()
{
Parent = rootControl,
Name = "ConsoleInputContainer",
Control = containerControl
};
var contentContainer = new VerticalPanel()
{
AutoSize = true,
@@ -149,7 +137,6 @@ namespace Cabrito
consoleInputBox.CaretFlashSpeed = 0;
}
containerControl.inputBox = consoleInputBox;
var locationFix = consoleInputBox.Location;