Fix C# editor
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
namespace FlaxEngine.GUI
|
||||
{
|
||||
@@ -262,7 +261,7 @@ namespace FlaxEngine.GUI
|
||||
Render2D.DrawRectangle(clientRect, borderColor, BorderThickness);
|
||||
|
||||
// Draw text
|
||||
Render2D.DrawText(_font?.GetFont(), TextMaterial, _text, clientRect, textColor, TextAlignment.Center, TextAlignment.Center);
|
||||
FallbackTextUtils.DrawText(_font?.GetFont(), TextMaterial, _text, clientRect, textColor, TextAlignment.Center, TextAlignment.Center);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace FlaxEngine.GUI
|
||||
{
|
||||
@@ -674,7 +673,7 @@ namespace FlaxEngine.GUI
|
||||
var textRect = new Rectangle(margin, 0, clientRect.Width - boxSize - 2.0f * margin, clientRect.Height);
|
||||
Render2D.PushClip(textRect);
|
||||
var textColor = TextColor;
|
||||
Render2D.DrawText(Font.GetFont(), FontMaterial, _items[_selectedIndex], textRect, enabled ? textColor : textColor * 0.5f, TextAlignment.Near, TextAlignment.Center);
|
||||
FallbackTextUtils.DrawText(Font.GetFont(), FontMaterial, _items[_selectedIndex], textRect, enabled ? textColor : textColor * 0.5f, TextAlignment.Near, TextAlignment.Center);
|
||||
Render2D.PopClip();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
|
||||
|
||||
using FlaxEditor.Options;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
|
||||
namespace FlaxEngine.GUI
|
||||
{
|
||||
@@ -235,7 +233,7 @@ namespace FlaxEngine.GUI
|
||||
}
|
||||
}
|
||||
|
||||
Render2D.DrawText(_font.GetFont(), Material, _text, rect, color, hAlignment, wAlignment, Wrapping, BaseLinesGapScale, scale);
|
||||
FallbackTextUtils.DrawText(_font.GetFont(), Material, _text, rect, color, hAlignment, wAlignment, Wrapping, BaseLinesGapScale, scale);
|
||||
|
||||
if (ClipText)
|
||||
Render2D.PopClip();
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
|
||||
|
||||
using FlaxEngine.Utilities;
|
||||
using System.Linq;
|
||||
|
||||
namespace FlaxEngine.GUI
|
||||
{
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace FlaxEngine.GUI
|
||||
{
|
||||
|
||||
@@ -154,7 +154,7 @@ namespace FlaxEngine.GUI
|
||||
if (!font)
|
||||
break;
|
||||
height = font.Height / DpiScale;
|
||||
return textBlock.Bounds.Location + font.GetCharPosition(_text, ref textBlock.Range, index - textBlock.Range.StartIndex);
|
||||
return textBlock.Bounds.Location + FallbackTextUtils.GetCharPosition(font, _text, ref textBlock.Range, index - textBlock.Range.StartIndex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,7 +196,7 @@ namespace FlaxEngine.GUI
|
||||
var font = textBlock.Style.Font.GetFont();
|
||||
if (!font && textBlock.Range.Length > 0)
|
||||
break;
|
||||
return font.HitTestText(_text, ref textBlock.Range, location - textBlock.Bounds.Location) + textBlock.Range.StartIndex;
|
||||
return FallbackTextUtils.HitTestText(font, _text, ref textBlock.Range, location - textBlock.Bounds.Location) + textBlock.Range.StartIndex;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -288,8 +288,8 @@ namespace FlaxEngine.GUI
|
||||
// Selection
|
||||
if (hasSelection && textBlock.Style.BackgroundSelectedBrush != null && textBlock.Range.Intersect(ref selection))
|
||||
{
|
||||
var leftEdge = selection.StartIndex <= textBlock.Range.StartIndex ? textBlock.Bounds.UpperLeft : font.GetCharPosition(_text, selection.StartIndex);
|
||||
var rightEdge = selection.EndIndex >= textBlock.Range.EndIndex ? textBlock.Bounds.UpperRight : font.GetCharPosition(_text, selection.EndIndex);
|
||||
var leftEdge = selection.StartIndex <= textBlock.Range.StartIndex ? textBlock.Bounds.UpperLeft : FallbackTextUtils.GetCharPosition(font, _text, selection.StartIndex);
|
||||
var rightEdge = selection.EndIndex >= textBlock.Range.EndIndex ? textBlock.Bounds.UpperRight : FallbackTextUtils.GetCharPosition(font, _text, selection.EndIndex);
|
||||
float height = font.Height / DpiScale;
|
||||
float alpha = Mathf.Min(1.0f, Mathf.Cos(_animateTime * BackgroundSelectedFlashSpeed) * 0.5f + 1.3f);
|
||||
alpha *= alpha;
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
|
||||
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
|
||||
namespace FlaxEngine.GUI
|
||||
{
|
||||
@@ -120,7 +118,7 @@ namespace FlaxEngine.GUI
|
||||
}
|
||||
|
||||
height = font.Height / DpiScale;
|
||||
return font.GetCharPosition(_text, index, ref _layout);
|
||||
return FallbackTextUtils.GetCharPosition(font, _text, index, ref _layout);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -132,7 +130,7 @@ namespace FlaxEngine.GUI
|
||||
return 0;
|
||||
}
|
||||
|
||||
return font.HitTestText(_text, location, ref _layout);
|
||||
return FallbackTextUtils.HitTestText(font, _text, location, ref _layout);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -171,8 +169,8 @@ namespace FlaxEngine.GUI
|
||||
// Check if sth is selected to draw selection
|
||||
if (HasSelection)
|
||||
{
|
||||
var leftEdge = font.GetCharPosition(_text, SelectionLeft, ref _layout);
|
||||
var rightEdge = font.GetCharPosition(_text, SelectionRight, ref _layout);
|
||||
var leftEdge = FallbackTextUtils.GetCharPosition(font, _text, SelectionLeft, ref _layout);
|
||||
var rightEdge = FallbackTextUtils.GetCharPosition(font, _text, SelectionRight, ref _layout);
|
||||
float fontHeight = font.Height / DpiScale;
|
||||
|
||||
// Draw selection background
|
||||
@@ -213,25 +211,11 @@ namespace FlaxEngine.GUI
|
||||
var color = TextColor;
|
||||
if (!enabled)
|
||||
color *= 0.6f;
|
||||
if (Render2D.Fallbacks != null)
|
||||
{
|
||||
Render2D.DrawText(font, Render2D.Fallbacks, _text, color, ref _layout, TextMaterial);
|
||||
}
|
||||
else
|
||||
{
|
||||
Render2D.DrawText(font, _text, color, ref _layout, TextMaterial);
|
||||
}
|
||||
FallbackTextUtils.DrawText(font, _text, color, ref _layout, TextMaterial);
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(_watermarkText) && !IsFocused)
|
||||
{
|
||||
if (Render2D.Fallbacks != null)
|
||||
{
|
||||
Render2D.DrawText(font, Render2D.Fallbacks, _watermarkText, WatermarkTextColor, ref _layout, TextMaterial);
|
||||
}
|
||||
else
|
||||
{
|
||||
Render2D.DrawText(font, _watermarkText, WatermarkTextColor, ref _layout, TextMaterial);
|
||||
}
|
||||
FallbackTextUtils.DrawText(font, _watermarkText, WatermarkTextColor, ref _layout, TextMaterial);
|
||||
}
|
||||
|
||||
// Caret
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
namespace FlaxEngine.GUI
|
||||
{
|
||||
@@ -375,7 +374,7 @@ namespace FlaxEngine.GUI
|
||||
textColor *= 0.6f;
|
||||
}
|
||||
|
||||
Render2D.DrawText(HeaderTextFont.GetFont(), HeaderTextMaterial, HeaderText, textRect, textColor, TextAlignment.Near, TextAlignment.Center);
|
||||
FallbackTextUtils.DrawText(HeaderTextFont.GetFont(), HeaderTextMaterial, HeaderText, textRect, textColor, TextAlignment.Near, TextAlignment.Center);
|
||||
|
||||
if (!_isClosed && EnableContainmentLines)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
|
||||
|
||||
using System.Linq;
|
||||
|
||||
namespace FlaxEngine.GUI
|
||||
{
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
namespace FlaxEngine.GUI
|
||||
{
|
||||
@@ -235,7 +234,7 @@ namespace FlaxEngine.GUI
|
||||
Render2D.FillRectangle(new Rectangle(1.1f, 1.1f, Width - 2, Height - 2), style.Background);
|
||||
|
||||
// Tooltip text
|
||||
Render2D.DrawText(
|
||||
FallbackTextUtils.DrawText(
|
||||
style.FontMedium,
|
||||
_currentText,
|
||||
GetClientArea(),
|
||||
|
||||
Reference in New Issue
Block a user