console notify box
This commit is contained in:
@@ -40,7 +40,7 @@
|
|||||||
"V": {
|
"V": {
|
||||||
"Order": -999999999,
|
"Order": -999999999,
|
||||||
"Size": {
|
"Size": {
|
||||||
"X": 1456.0,
|
"X": 1401.0,
|
||||||
"Y": 813.0
|
"Y": 813.0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -138,7 +138,7 @@
|
|||||||
},
|
},
|
||||||
"V": {
|
"V": {
|
||||||
"Size": {
|
"Size": {
|
||||||
"X": 1456.0,
|
"X": 1401.0,
|
||||||
"Y": 813.0
|
"Y": 813.0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -165,7 +165,7 @@
|
|||||||
},
|
},
|
||||||
"Control": "FlaxEngine.GUI.Label",
|
"Control": "FlaxEngine.GUI.Label",
|
||||||
"Data": {
|
"Data": {
|
||||||
"Text": "FPS: 15\nrFPS: 11\nCon: NaNms\nDirectX11\nGC memory: 13.52053MB",
|
"Text": "FPS: 767\nrFPS: 767\nCon: NaNms\nDirectX11\nGC memory: 7.908752MB",
|
||||||
"TextColor": {
|
"TextColor": {
|
||||||
"R": 1.0,
|
"R": 1.0,
|
||||||
"G": 1.0,
|
"G": 1.0,
|
||||||
|
|||||||
@@ -6,6 +6,21 @@ using System.Reflection;
|
|||||||
|
|
||||||
namespace Cabrito
|
namespace Cabrito
|
||||||
{
|
{
|
||||||
|
public class ConsoleLine
|
||||||
|
{
|
||||||
|
public string content;
|
||||||
|
|
||||||
|
internal ConsoleLine(string line)
|
||||||
|
{
|
||||||
|
content = line;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static implicit operator string(ConsoleLine line) => line.content;
|
||||||
|
public static explicit operator ConsoleLine(string line) => new ConsoleLine(line);
|
||||||
|
|
||||||
|
public override string ToString() => content.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
public static class Console
|
public static class Console
|
||||||
{
|
{
|
||||||
private static ConsoleScriptBase scriptInstance = null;
|
private static ConsoleScriptBase scriptInstance = null;
|
||||||
@@ -28,7 +43,8 @@ namespace Cabrito
|
|||||||
public static string LinePrefix { get; internal set; } = "]";
|
public static string LinePrefix { get; internal set; } = "]";
|
||||||
|
|
||||||
|
|
||||||
private static List<string> consoleLines = new List<string>();
|
//private static List<string> consoleLines = new List<string>();
|
||||||
|
private static List<ConsoleLine> consoleLines = new List<ConsoleLine>();
|
||||||
private static Dictionary<string, ConsoleCommand> consoleCommands = new Dictionary<string, ConsoleCommand>();
|
private static Dictionary<string, ConsoleCommand> consoleCommands = new Dictionary<string, ConsoleCommand>();
|
||||||
private static Dictionary<string, ConsoleVariable> consoleVariables = new Dictionary<string, ConsoleVariable>();
|
private static Dictionary<string, ConsoleVariable> consoleVariables = new Dictionary<string, ConsoleVariable>();
|
||||||
|
|
||||||
@@ -166,8 +182,8 @@ namespace Cabrito
|
|||||||
OnOpen += instance.OnConsoleOpen;
|
OnOpen += instance.OnConsoleOpen;
|
||||||
OnClose += instance.OnConsoleClose;
|
OnClose += instance.OnConsoleClose;
|
||||||
|
|
||||||
foreach (var line in consoleLines)
|
//foreach (var line in consoleLines)
|
||||||
scriptInstance.AddLine(line);
|
// scriptInstance.OnLineAdded(line);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Unregister already registered Console script.
|
/// Unregister already registered Console script.
|
||||||
@@ -183,7 +199,7 @@ namespace Cabrito
|
|||||||
OnClose -= instance.OnConsoleClose;
|
OnClose -= instance.OnConsoleClose;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IReadOnlyCollection<string> Lines
|
public static IReadOnlyCollection<ConsoleLine> Lines
|
||||||
{
|
{
|
||||||
get => consoleLines.AsReadOnly();
|
get => consoleLines.AsReadOnly();
|
||||||
}
|
}
|
||||||
@@ -191,29 +207,33 @@ namespace Cabrito
|
|||||||
// Echoes text to Console.
|
// Echoes text to Console.
|
||||||
public static void Print(string text)
|
public static void Print(string text)
|
||||||
{
|
{
|
||||||
consoleLines.Add(text);
|
ConsoleLine line = new ConsoleLine(text);
|
||||||
scriptInstance?.AddLine(text);
|
consoleLines.Add(line);
|
||||||
|
scriptInstance?.OnLineAdded(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Echoes warning text to Console.
|
// Echoes warning text to Console.
|
||||||
public static void PrintWarning(string text)
|
public static void PrintWarning(string text)
|
||||||
{
|
{
|
||||||
consoleLines.Add(text);
|
ConsoleLine line = new ConsoleLine(text);
|
||||||
scriptInstance?.AddLine(text);
|
consoleLines.Add(line);
|
||||||
|
scriptInstance?.OnLineAdded(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Echoes error text to Console.
|
// Echoes error text to Console.
|
||||||
public static void PrintError(string text)
|
public static void PrintError(string text)
|
||||||
{
|
{
|
||||||
consoleLines.Add(text);
|
ConsoleLine line = new ConsoleLine(text);
|
||||||
scriptInstance?.AddLine(text);
|
consoleLines.Add(line);
|
||||||
|
scriptInstance?.OnLineAdded(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Echoes developer/debug text to Console.
|
// Echoes developer/debug text to Console.
|
||||||
public static void PrintDebug(string text)
|
public static void PrintDebug(string text)
|
||||||
{
|
{
|
||||||
consoleLines.Add(text);
|
ConsoleLine line = new ConsoleLine(text);
|
||||||
scriptInstance?.AddLine(text);
|
consoleLines.Add(line);
|
||||||
|
scriptInstance?.OnLineAdded(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Opens the Console.
|
// Opens the Console.
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ namespace Cabrito
|
|||||||
public float CaretFlashSpeed = 0;
|
public float CaretFlashSpeed = 0;
|
||||||
public Color BorderColor;
|
public Color BorderColor;
|
||||||
public Color TextColor = Color.White;
|
public Color TextColor = Color.White;
|
||||||
|
|
||||||
public int DefaultMargin = 1;
|
public int DefaultMargin = 1;
|
||||||
public int ScrollOffset = 0;
|
public int ScrollOffset = 0;
|
||||||
public int ScrollMouseLines = 3;
|
public int ScrollMouseLines = 3;
|
||||||
@@ -110,12 +111,13 @@ namespace Cabrito
|
|||||||
|
|
||||||
public override void OnParentResized()
|
public override void OnParentResized()
|
||||||
{
|
{
|
||||||
|
if (HeightMultiplier > 0)
|
||||||
Height = Screen.Size.Y * HeightMultiplier;
|
Height = Screen.Size.Y * HeightMultiplier;
|
||||||
base.OnParentResized();
|
base.OnParentResized();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void CalculateVisibleLines(IReadOnlyCollection<string> lines, out int firstVisibleLine, out int lastVisibleLine, out LineInfo[] wrappedLines)
|
private void CalculateVisibleLines(IReadOnlyCollection<ConsoleLine> lines, out int firstVisibleLine, out int lastVisibleLine, out LineInfo[] wrappedLines)
|
||||||
{
|
{
|
||||||
wrappedLines = null;
|
wrappedLines = null;
|
||||||
firstVisibleLine = 0;
|
firstVisibleLine = 0;
|
||||||
@@ -309,7 +311,7 @@ namespace Cabrito
|
|||||||
foreach (LineInfo li in wrappedLines)
|
foreach (LineInfo li in wrappedLines)
|
||||||
{
|
{
|
||||||
var lineIndex = li.lineIndex;
|
var lineIndex = li.lineIndex;
|
||||||
string line = lines.ElementAt(lineIndex).Substring(li.lineOffset, li.lineLength);
|
string line = lines.ElementAt(lineIndex).content.Substring(li.lineOffset, li.lineLength);
|
||||||
Render2D.DrawText(font, line, TextColor, ref layout);
|
Render2D.DrawText(font, line, TextColor, ref layout);
|
||||||
layout.Bounds.Y += lineHeight;
|
layout.Bounds.Y += lineHeight;
|
||||||
}
|
}
|
||||||
@@ -383,7 +385,7 @@ namespace Cabrito
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
hitLine = wrappedLines[hitWrappedLine].lineIndex;
|
hitLine = wrappedLines[hitWrappedLine].lineIndex;
|
||||||
string line = lines.ElementAt(hitLine).Substring(wrappedLines[hitWrappedLine].lineOffset, wrappedLines[hitWrappedLine].lineLength);
|
string line = lines.ElementAt(hitLine).content.Substring(wrappedLines[hitWrappedLine].lineOffset, wrappedLines[hitWrappedLine].lineLength);
|
||||||
|
|
||||||
layout.Bounds.Y = top + ((hitWrappedLine) * lineHeight);
|
layout.Bounds.Y = top + ((hitWrappedLine) * lineHeight);
|
||||||
layout.Bounds.Height = top + 9999;//(visibleHeight / Platform.DpiScale);
|
layout.Bounds.Height = top + 9999;//(visibleHeight / Platform.DpiScale);
|
||||||
@@ -474,7 +476,7 @@ namespace Cabrito
|
|||||||
selectionStartChar = hitChar;
|
selectionStartChar = hitChar;
|
||||||
selectionEndLine = hitLine;
|
selectionEndLine = hitLine;
|
||||||
selectionEndChar = hitChar;
|
selectionEndChar = hitChar;
|
||||||
FlaxEngine.Debug.Log(string.Format("start line {0} char {1}", hitLine, hitChar));
|
//FlaxEngine.Debug.Log(string.Format("start line {0} char {1}", hitLine, hitChar));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw new Exception("no???");
|
throw new Exception("no???");
|
||||||
@@ -507,7 +509,7 @@ namespace Cabrito
|
|||||||
{
|
{
|
||||||
selectionEndLine = hitLine;
|
selectionEndLine = hitLine;
|
||||||
selectionEndChar = hitChar;
|
selectionEndChar = hitChar;
|
||||||
FlaxEngine.Debug.Log(string.Format("end line {0} char {1}", hitLine, hitChar));
|
//FlaxEngine.Debug.Log(string.Format("end line {0} char {1}", hitLine, hitChar));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,9 @@ namespace Cabrito
|
|||||||
|
|
||||||
private ConsoleContentTextBox contentBox;
|
private ConsoleContentTextBox contentBox;
|
||||||
|
|
||||||
|
protected override Rectangle TextRectangle => new Rectangle(0, 0, Width, Height);
|
||||||
|
protected override Rectangle TextClipRectangle => new Rectangle(0, 0, Width, Height);
|
||||||
|
|
||||||
public ConsoleInputTextBox() : base()
|
public ConsoleInputTextBox() : base()
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -41,7 +44,7 @@ namespace Cabrito
|
|||||||
Input.InputText.ToLowerInvariant().Contains('æ') ||
|
Input.InputText.ToLowerInvariant().Contains('æ') ||
|
||||||
Input.InputText.ToLowerInvariant().Contains('ø')))
|
Input.InputText.ToLowerInvariant().Contains('ø')))
|
||||||
{
|
{
|
||||||
continue; // Scandinavian keyboards layouts
|
continue; // Scandinavian keyboard layouts
|
||||||
}
|
}
|
||||||
else if (mapping.Key == KeyboardKeys.BackQuote && Input.InputText.ToLowerInvariant().Contains('\''))
|
else if (mapping.Key == KeyboardKeys.BackQuote && Input.InputText.ToLowerInvariant().Contains('\''))
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ namespace Cabrito
|
|||||||
public abstract void OnConsoleOpen();
|
public abstract void OnConsoleOpen();
|
||||||
public abstract void OnConsoleClose();
|
public abstract void OnConsoleClose();
|
||||||
public abstract void SetInput(string text);
|
public abstract void SetInput(string text);
|
||||||
public abstract void AddLine(string text);
|
public abstract void OnLineAdded(string text);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ConsoleScript : ConsoleScriptBase
|
public class ConsoleScript : ConsoleScriptBase
|
||||||
@@ -23,6 +23,12 @@ namespace Cabrito
|
|||||||
[Limit(0.05f, 1.0f, 1)]
|
[Limit(0.05f, 1.0f, 1)]
|
||||||
public float ConsoleHeight = 0.65f;
|
public float ConsoleHeight = 0.65f;
|
||||||
|
|
||||||
|
[Limit(0)]
|
||||||
|
public int ConsoleNotifyLines = 3;
|
||||||
|
|
||||||
|
[Limit(0f)]
|
||||||
|
public float ConsoleSpeed = 3500f;
|
||||||
|
|
||||||
[Limit(0.5f, 4f, 0.05f)]
|
[Limit(0.5f, 4f, 0.05f)]
|
||||||
public float LineSpacing
|
public float LineSpacing
|
||||||
{
|
{
|
||||||
@@ -33,6 +39,8 @@ namespace Cabrito
|
|||||||
|
|
||||||
if (consoleBox != null)
|
if (consoleBox != null)
|
||||||
consoleBox.LineSpacing = value;
|
consoleBox.LineSpacing = value;
|
||||||
|
if (consoleNotifyBox != null)
|
||||||
|
consoleNotifyBox.LineSpacing = value;
|
||||||
if (consoleInputBox != null)
|
if (consoleInputBox != null)
|
||||||
consoleInputBox.LineSpacing = value;
|
consoleInputBox.LineSpacing = value;
|
||||||
|
|
||||||
@@ -50,6 +58,7 @@ namespace Cabrito
|
|||||||
private UIControl rootControl;
|
private UIControl rootControl;
|
||||||
private ConsoleContentTextBox consoleBox;
|
private ConsoleContentTextBox consoleBox;
|
||||||
private ConsoleInputTextBox consoleInputBox;
|
private ConsoleInputTextBox consoleInputBox;
|
||||||
|
private ConsoleContentTextBox consoleNotifyBox;
|
||||||
|
|
||||||
internal InputEvent consoleInputEvent;
|
internal InputEvent consoleInputEvent;
|
||||||
|
|
||||||
@@ -137,6 +146,35 @@ namespace Cabrito
|
|||||||
parentControl.Name = "ConsoleContent";
|
parentControl.Name = "ConsoleContent";
|
||||||
parentControl.Control = consoleBox;
|
parentControl.Control = consoleBox;
|
||||||
consoleBox.Location = locationFix; // workaround to UIControl.Control overriding the old position
|
consoleBox.Location = locationFix; // workaround to UIControl.Control overriding the old position
|
||||||
|
|
||||||
|
if (consoleNotifyBox == null)
|
||||||
|
{
|
||||||
|
//consoleBox = new ConsoleContentTextBox(null, 0, 0, consoleSize.X, consoleSize.Y - fontHeight);
|
||||||
|
consoleNotifyBox = new ConsoleContentTextBox(null, 0, 0, 0, 0);
|
||||||
|
consoleNotifyBox.HeightMultiplier = 0;
|
||||||
|
consoleNotifyBox.Height = ConsoleNotifyLines * fontHeight;
|
||||||
|
consoleNotifyBox.SetAnchorPreset(AnchorPresets.HorizontalStretchTop, true);
|
||||||
|
//consoleBox.AnchorMax = new Vector2(1.0f, ConsoleHeight);
|
||||||
|
|
||||||
|
consoleNotifyBox.Font = fontReference;
|
||||||
|
|
||||||
|
//consoleBox.HorizontalAlignment = TextAlignment.Near;
|
||||||
|
//consoleBox.VerticalAlignment = TextAlignment.Near;
|
||||||
|
//consoleNotifyBox.HeightMultiplier = ConsoleHeight;
|
||||||
|
consoleNotifyBox.Wrapping = TextWrapping.WrapWords;
|
||||||
|
consoleNotifyBox.BackgroundColor = Color.Transparent;
|
||||||
|
consoleNotifyBox.BackgroundSelectedColor = Color.Transparent;
|
||||||
|
consoleNotifyBox.BackgroundSelectedFlashSpeed = 0;
|
||||||
|
consoleNotifyBox.BorderSelectedColor = Color.Transparent;
|
||||||
|
consoleNotifyBox.CaretFlashSpeed = 0;
|
||||||
|
consoleNotifyBox.LineSpacing = LineSpacing;
|
||||||
|
}
|
||||||
|
|
||||||
|
var locationFix2 = consoleNotifyBox.Location;
|
||||||
|
var parentControl2 = Actor.AddChild<UIControl>();
|
||||||
|
parentControl2.Name = "ConsoleNotifyContent";
|
||||||
|
parentControl2.Control = consoleNotifyBox;
|
||||||
|
consoleNotifyBox.Location = locationFix2; // workaround to UIControl.Control overriding the old position
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -176,7 +214,7 @@ namespace Cabrito
|
|||||||
Console.RegisterConsoleScript(this);
|
Console.RegisterConsoleScript(this);
|
||||||
RefreshLayout();
|
RefreshLayout();
|
||||||
|
|
||||||
#if true
|
#if false
|
||||||
//for (int i = 0; i < 10; i++)
|
//for (int i = 0; i < 10; i++)
|
||||||
{
|
{
|
||||||
string[] teststr = {
|
string[] teststr = {
|
||||||
@@ -259,12 +297,12 @@ namespace Cabrito
|
|||||||
|
|
||||||
private void OnSendLog(LogType level, string msg, FlaxEngine.Object obj, string stackTrace)
|
private void OnSendLog(LogType level, string msg, FlaxEngine.Object obj, string stackTrace)
|
||||||
{
|
{
|
||||||
//Console.Print("[DEBUG] " + msg);
|
Console.Print("[DEBUG] " + msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnSendExceptionLog(Exception exception, FlaxEngine.Object obj)
|
private void OnSendExceptionLog(Exception exception, FlaxEngine.Object obj)
|
||||||
{
|
{
|
||||||
//Console.Print("[EXCEP] " + exception.Message);
|
Console.Print("[EXCEP] " + exception.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnDestroy()
|
public override void OnDestroy()
|
||||||
@@ -273,6 +311,7 @@ namespace Cabrito
|
|||||||
//consoleInputEvent.Triggered -= OnConsoleInputEvent;
|
//consoleInputEvent.Triggered -= OnConsoleInputEvent;
|
||||||
consoleInputEvent?.Dispose();
|
consoleInputEvent?.Dispose();
|
||||||
consoleBox?.Dispose();
|
consoleBox?.Dispose();
|
||||||
|
consoleNotifyBox?.Dispose();
|
||||||
|
|
||||||
Debug.Logger.LogHandler.SendLog -= OnSendLog;
|
Debug.Logger.LogHandler.SendLog -= OnSendLog;
|
||||||
Debug.Logger.LogHandler.SendExceptionLog -= OnSendExceptionLog;
|
Debug.Logger.LogHandler.SendExceptionLog -= OnSendExceptionLog;
|
||||||
@@ -359,8 +398,6 @@ namespace Cabrito
|
|||||||
Profiler.BeginEvent("ConsoleScript_OnUpdate");
|
Profiler.BeginEvent("ConsoleScript_OnUpdate");
|
||||||
base.OnUpdate();
|
base.OnUpdate();
|
||||||
|
|
||||||
const float consoleSpeed = 3500f;
|
|
||||||
|
|
||||||
float targetY;
|
float targetY;
|
||||||
if (!Console.IsOpen)
|
if (!Console.IsOpen)
|
||||||
targetY = -rootControl.Control.Height;
|
targetY = -rootControl.Control.Height;
|
||||||
@@ -372,28 +409,49 @@ namespace Cabrito
|
|||||||
{
|
{
|
||||||
if (location.Y > targetY)
|
if (location.Y > targetY)
|
||||||
{
|
{
|
||||||
location.Y -= Time.UnscaledDeltaTime * consoleSpeed;
|
// closing
|
||||||
|
location.Y -= Time.UnscaledDeltaTime * ConsoleSpeed;
|
||||||
if (location.Y < targetY)
|
if (location.Y < targetY)
|
||||||
location.Y = targetY;
|
location.Y = targetY;
|
||||||
|
|
||||||
|
if (location.Y < targetY * ConsoleHeight)
|
||||||
|
location.Y = targetY;
|
||||||
}
|
}
|
||||||
else if (location.Y < targetY)
|
else if (location.Y < targetY)
|
||||||
{
|
{
|
||||||
location.Y += Time.UnscaledDeltaTime * consoleSpeed;
|
// opening
|
||||||
|
if (location.Y < -rootControl.Control.Height * ConsoleHeight)
|
||||||
|
location.Y = -rootControl.Control.Height * ConsoleHeight;
|
||||||
|
|
||||||
|
location.Y += Time.UnscaledDeltaTime * ConsoleSpeed;
|
||||||
if (location.Y > targetY)
|
if (location.Y > targetY)
|
||||||
location.Y = targetY;
|
location.Y = targetY;
|
||||||
}
|
}
|
||||||
|
|
||||||
rootControl.Control.Location = location;
|
rootControl.Control.Location = location;
|
||||||
|
|
||||||
|
if (Console.IsOpen)
|
||||||
|
{
|
||||||
|
consoleNotifyBox.Visible = false;
|
||||||
|
consoleInputBox.Visible = true;
|
||||||
|
}
|
||||||
|
else if (!Console.IsOpen)
|
||||||
|
{
|
||||||
|
int fontHeight = consoleNotifyBox.Font.GetFont().Height;
|
||||||
|
if (location.Y < (-rootControl.Control.Height * ConsoleHeight) + fontHeight)
|
||||||
|
{
|
||||||
|
consoleNotifyBox.Visible = true;
|
||||||
|
consoleInputBox.Visible = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Profiler.EndEvent();
|
Profiler.EndEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void AddLine(string text)
|
public override void OnLineAdded(string text)
|
||||||
{
|
{
|
||||||
/*if (string.IsNullOrEmpty(consoleBox.Text))
|
int fontHeight = consoleNotifyBox.Font.GetFont().Height;
|
||||||
consoleBox.Text += text;
|
consoleNotifyBox.Height = Math.Min(ConsoleNotifyLines, Console.Lines.Count) * fontHeight;
|
||||||
else
|
|
||||||
consoleBox.Text += "\n" + text;*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void SetInput(string text)
|
public override void SetInput(string text)
|
||||||
|
|||||||
@@ -150,14 +150,14 @@ namespace Cabrito
|
|||||||
TargetViewOffset = new Vector2(0, GetRealLineSpacing());
|
TargetViewOffset = new Vector2(0, GetRealLineSpacing());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ScrollToEnd()
|
/*public void ScrollToEnd()
|
||||||
{
|
{
|
||||||
float maxY = TextSize.Y - Height;
|
float maxY = TextSize.Y - Height;
|
||||||
float spacing = GetRealLineSpacing();
|
float spacing = GetRealLineSpacing();
|
||||||
maxY += spacing;
|
maxY += spacing;
|
||||||
|
|
||||||
TargetViewOffset = new Vector2(0, Math.Max(0, maxY));
|
TargetViewOffset = new Vector2(0, Math.Max(0, maxY));
|
||||||
}
|
}*/
|
||||||
|
|
||||||
public override void ScrollToCaret()
|
public override void ScrollToCaret()
|
||||||
{
|
{
|
||||||
@@ -175,7 +175,7 @@ namespace Cabrito
|
|||||||
TargetViewOffset = Vector2.Clamp(newLocation, new Vector2(0, spacing), new Vector2(_targetViewOffset.X, maxY));
|
TargetViewOffset = Vector2.Clamp(newLocation, new Vector2(0, spacing), new Vector2(_targetViewOffset.X, maxY));
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool smoothScrolling = false;
|
/*const bool smoothScrolling = false;
|
||||||
|
|
||||||
public override bool OnMouseWheel(Vector2 location, float delta)
|
public override bool OnMouseWheel(Vector2 location, float delta)
|
||||||
{
|
{
|
||||||
@@ -192,7 +192,7 @@ namespace Cabrito
|
|||||||
maxY += offset;
|
maxY += offset;
|
||||||
TargetViewOffset = Vector2.Clamp(_targetViewOffset - new Vector2(0, delta), new Vector2(0, offset), new Vector2(_targetViewOffset.X, maxY));
|
TargetViewOffset = Vector2.Clamp(_targetViewOffset - new Vector2(0, delta), new Vector2(0, offset), new Vector2(_targetViewOffset.X, maxY));
|
||||||
return true;
|
return true;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
public override Vector2 GetTextSize()
|
public override Vector2 GetTextSize()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user