Wire selection fixes:
- Fixed MathUtils.LineToPointDistance returning NaN if both points of the line are at the same position, preventing from selecting some wire nodes in the wiring mode. - Added an indicator that shows when a node is highlighted. - Wire nodes a higher preference for being highlighted than wire sections. Makes it easier to select nodes that are on top of another wire. Closes #215
This commit is contained in:
@@ -30,21 +30,13 @@ namespace Barotrauma.Items.Components
|
||||
const float nodeDistance = 32.0f;
|
||||
const float heightFromFloor = 128.0f;
|
||||
|
||||
static Sprite wireSprite;
|
||||
|
||||
private List<Vector2> nodes;
|
||||
private List<WireSection> sections;
|
||||
|
||||
Connection[] connections;
|
||||
private Connection[] connections;
|
||||
|
||||
private Vector2 newNodePos;
|
||||
|
||||
|
||||
|
||||
private static Wire draggingWire;
|
||||
private static int? selectedNodeIndex;
|
||||
private static int? highlightedNodeIndex;
|
||||
|
||||
public bool Hidden, Locked;
|
||||
|
||||
public Connection[] Connections
|
||||
@@ -55,12 +47,14 @@ namespace Barotrauma.Items.Components
|
||||
public Wire(Item item, XElement element)
|
||||
: base(item, element)
|
||||
{
|
||||
#if CLIENT
|
||||
if (wireSprite == null)
|
||||
{
|
||||
wireSprite = new Sprite("Content/Items/wireHorizontal.png", new Vector2(0.5f, 0.5f));
|
||||
wireSprite.Depth = 0.85f;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
nodes = new List<Vector2>();
|
||||
sections = new List<WireSection>();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user