Skip to content

Commit 8c946ff

Browse files
committed
added box around highlit item, when background transparency bellow 20%
1 parent 2871078 commit 8c946ff

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

Sources/Sandbox.Graphics/Gui/MyGuiControlGrid.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ public override void Draw(float transitionAlpha, float backgroundTransitionAlpha
546546
{
547547
base.Draw(transitionAlpha, backgroundTransitionAlpha);
548548
RefreshItemsRectangle();
549-
DrawItemBackgrounds(backgroundTransitionAlpha);
549+
DrawItemBackgrounds(transitionAlpha, backgroundTransitionAlpha);
550550
DrawItems(transitionAlpha);
551551
DrawItemTexts(transitionAlpha);
552552
//DebugDraw();
@@ -700,7 +700,7 @@ private void DebugDraw()
700700
}
701701
}
702702

703-
private void DrawItemBackgrounds(float transitionAlpha)
703+
private void DrawItemBackgrounds(float transitionAlpha, float backgroundTransitionAlpha)
704704
{
705705
var normalTexture = m_styleDef.ItemTexture.Normal;
706706
var highlightTexture = m_styleDef.ItemTexture.Highlight;
@@ -729,8 +729,10 @@ private void DrawItemBackgrounds(float transitionAlpha)
729729
texture: highlight ? highlightTexture : normalTexture,
730730
normalizedCoord: drawPositionTopLeft,
731731
normalizedSize: ItemSize,
732-
color: ApplyColorMaskModifiers(ColorMask, enabled, transitionAlpha * blinkingTransparency),
732+
color: ApplyColorMaskModifiers(ColorMask, enabled, backgroundTransitionAlpha * blinkingTransparency),
733733
drawAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP);
734+
if (highlight && backgroundTransitionAlpha < 0.2)
735+
MyGuiManager.DrawBorders(drawPositionTopLeft, ItemSize, ApplyColorMaskModifiers(MyGuiConstants.THEMED_GUI_LINE_COLOR.ToVector4(), Enabled, transitionAlpha),1);
734736
++idx;
735737
}
736738
}

Sources/Sandbox.Graphics/Gui/MyGuiControlListbox.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,8 @@ public override void Draw(float transitionAlpha, float backgroundTransitionAlpha
449449
if (isHighlit)
450450
{
451451
MyGuiManager.DrawSpriteBatch(m_styleDef.ItemTextureHighlight, position, ItemSize, color, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP);
452+
if (backgroundTransitionAlpha < 0.2)
453+
MyGuiManager.DrawBorders(position, ItemSize, ApplyColorMaskModifiers(MyGuiConstants.THEMED_GUI_LINE_COLOR.ToVector4(), Enabled, transitionAlpha), 1);
452454
}
453455

454456
if (!String.IsNullOrEmpty(item.Icon))

0 commit comments

Comments
 (0)