Fixed selectionrect becoming active when moving entities in the editor, null check in ConnectionPanel.UpdateHUD

This commit is contained in:
Regalis
2016-11-14 16:29:15 +02:00
parent c2098f06f8
commit b86231170f
2 changed files with 26 additions and 22 deletions
@@ -46,8 +46,8 @@ namespace Barotrauma.Items.Components
if (HighlightedWire != null) if (HighlightedWire != null)
{ {
HighlightedWire.Item.IsHighlighted = true; HighlightedWire.Item.IsHighlighted = true;
if (HighlightedWire.Connections[0].Item != null) HighlightedWire.Connections[0].Item.IsHighlighted = true; if (HighlightedWire.Connections[0] != null && HighlightedWire.Connections[0].Item != null) HighlightedWire.Connections[0].Item.IsHighlighted = true;
if (HighlightedWire.Connections[1].Item != null) HighlightedWire.Connections[1].Item.IsHighlighted = true; if (HighlightedWire.Connections[1] != null && HighlightedWire.Connections[1].Item != null) HighlightedWire.Connections[1].Item.IsHighlighted = true;
} }
} }
+5 -1
View File
@@ -421,7 +421,9 @@ namespace Barotrauma
} }
//started moving selected entities //started moving selected entities
if (startMovingPos != Vector2.Zero && PlayerInput.LeftButtonReleased()) if (startMovingPos != Vector2.Zero)
{
if (PlayerInput.LeftButtonReleased())
{ {
//mouse released -> move the entities to the new position of the mouse //mouse released -> move the entities to the new position of the mouse
@@ -445,6 +447,8 @@ namespace Barotrauma
startMovingPos = Vector2.Zero; startMovingPos = Vector2.Zero;
} }
}
//started dragging a "selection rectangle" //started dragging a "selection rectangle"
else if (selectionPos != Vector2.Zero) else if (selectionPos != Vector2.Zero)
{ {