fix boxes positioning and remove unused constants
This commit is contained in:
@@ -243,7 +243,7 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
{
|
||||
Type = NodeElementType.Input,
|
||||
Position = new Float2(
|
||||
FlaxEditor.Surface.Constants.NodeMarginX - FlaxEditor.Surface.Constants.BoxOffsetX,
|
||||
FlaxEditor.Surface.Constants.NodeMarginX,
|
||||
FlaxEditor.Surface.Constants.NodeMarginY + FlaxEditor.Surface.Constants.NodeHeaderHeight + ylevel * FlaxEditor.Surface.Constants.LayoutOffsetY),
|
||||
Text = "Pose " + _blendPoses.Count,
|
||||
Single = true,
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace FlaxEditor.Surface
|
||||
/// <summary>
|
||||
/// The node header height.
|
||||
/// </summary>
|
||||
public const float NodeHeaderHeight = 23.0f;
|
||||
public const float NodeHeaderHeight = 25.0f;
|
||||
|
||||
/// <summary>
|
||||
/// The scale of the header text.
|
||||
@@ -45,11 +45,6 @@ namespace FlaxEditor.Surface
|
||||
/// </summary>
|
||||
public const float NodeMarginY = 8.0f;
|
||||
|
||||
/// <summary>
|
||||
/// The box position offset on the x axis.
|
||||
/// </summary>
|
||||
public const float BoxOffsetX = 0.0f;
|
||||
|
||||
/// <summary>
|
||||
/// The width of the row that is started by a box.
|
||||
/// </summary>
|
||||
@@ -68,16 +63,11 @@ namespace FlaxEditor.Surface
|
||||
/// <summary>
|
||||
/// The offset between the box text and the box
|
||||
/// </summary>
|
||||
public const float BoxTextOffset = 2.0f;
|
||||
public const float BoxTextOffset = 1.65f;
|
||||
|
||||
/// <summary>
|
||||
/// The width of the rectangle used to draw the box text.
|
||||
/// </summary>
|
||||
public const float BoxTextRectWidth = 500.0f;
|
||||
|
||||
/// <summary>
|
||||
/// The scale of text of boxes.
|
||||
/// </summary>
|
||||
public const float BoxTextScale = 1f;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1443,7 +1443,7 @@ namespace FlaxEditor.Surface.Elements
|
||||
// Draw text
|
||||
var style = Style.Current;
|
||||
var rect = new Rectangle(Width + Constants.BoxTextOffset, 0, Constants.BoxTextRectWidth, Height);
|
||||
Render2D.DrawText(style.FontMedium, Text, rect, Enabled ? style.Foreground : style.ForegroundDisabled, TextAlignment.Near, TextAlignment.Center, TextWrapping.NoWrap, 1f, Constants.BoxTextScale);
|
||||
Render2D.DrawText(style.FontMedium, Text, rect, Enabled ? style.Foreground : style.ForegroundDisabled, TextAlignment.Near, TextAlignment.Center);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -234,8 +234,8 @@ namespace FlaxEditor.Surface.Elements
|
||||
|
||||
// Draw text
|
||||
var style = Style.Current;
|
||||
var rect = new Rectangle(-Constants.BoxTextRectWidth - Constants.BoxTextOffset, 0, Constants.BoxTextRectWidth, Height);
|
||||
Render2D.DrawText(style.FontMedium, Text, rect, Enabled ? style.Foreground : style.ForegroundDisabled, TextAlignment.Far, TextAlignment.Center, TextWrapping.NoWrap, 1f, Constants.BoxTextScale);
|
||||
var rect = new Rectangle(-Constants.BoxTextRectWidth - Constants.BoxTextOffset * 2f, 0f, Constants.BoxTextRectWidth, Height);
|
||||
Render2D.DrawText(style.FontMedium, Text, rect, Enabled ? style.Foreground : style.ForegroundDisabled, TextAlignment.Far, TextAlignment.Center);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ namespace FlaxEditor.Surface
|
||||
{
|
||||
Type = NodeElementType.Input,
|
||||
Position = new Float2(
|
||||
Constants.NodeMarginX - Constants.BoxOffsetX,
|
||||
Constants.NodeMarginX,
|
||||
Constants.NodeMarginY + Constants.NodeHeaderHeight + yLevel * Constants.LayoutOffsetY),
|
||||
Text = text,
|
||||
Single = single,
|
||||
@@ -132,7 +132,7 @@ namespace FlaxEditor.Surface
|
||||
{
|
||||
Type = NodeElementType.Input,
|
||||
Position = new Float2(
|
||||
Constants.NodeMarginX - Constants.BoxOffsetX,
|
||||
Constants.NodeMarginX,
|
||||
Constants.NodeMarginY + Constants.NodeHeaderHeight + yLevel * Constants.LayoutOffsetY),
|
||||
Text = text,
|
||||
Single = single,
|
||||
@@ -157,7 +157,7 @@ namespace FlaxEditor.Surface
|
||||
{
|
||||
Type = NodeElementType.Output,
|
||||
Position = new Float2(
|
||||
Constants.NodeMarginX - Constants.BoxRowHeight + Constants.BoxOffsetX,
|
||||
-Constants.NodeMarginX,
|
||||
Constants.NodeMarginY + Constants.NodeHeaderHeight + yLevel * Constants.LayoutOffsetY),
|
||||
Text = text,
|
||||
Single = single,
|
||||
@@ -182,7 +182,7 @@ namespace FlaxEditor.Surface
|
||||
{
|
||||
Type = NodeElementType.Output,
|
||||
Position = new Float2(
|
||||
Constants.NodeMarginX - Constants.BoxSize + Constants.BoxOffsetX,
|
||||
-Constants.NodeMarginX,
|
||||
Constants.NodeMarginY + Constants.NodeHeaderHeight + yLevel * Constants.LayoutOffsetY),
|
||||
Text = text,
|
||||
Single = single,
|
||||
|
||||
@@ -199,7 +199,7 @@ namespace FlaxEditor.Surface
|
||||
{
|
||||
if (Elements[i] is OutputBox box)
|
||||
{
|
||||
box.Location = box.Archetype.Position + new Float2(width, 0);
|
||||
box.Location = box.Archetype.Position + new Float2(width - Constants.NodeMarginX, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -222,7 +222,7 @@ namespace FlaxEditor.Surface
|
||||
|
||||
private static void DefaultDrawBox(Elements.Box box)
|
||||
{
|
||||
var rect = new Rectangle(0.0f, box.Height * 0.5f - Constants.BoxSize * 0.5f, new Float2(Constants.BoxSize));
|
||||
var rect = new Rectangle(box.Width * 0.5f - Constants.BoxSize * 0.5f, box.Height * 0.5f - Constants.BoxSize * 0.5f, new Float2(Constants.BoxSize));
|
||||
|
||||
// Size culling
|
||||
const float minBoxSize = 5.0f;
|
||||
|
||||
Reference in New Issue
Block a user