console fixes
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user