2f107db...5202af9
This commit is contained in:
@@ -15,7 +15,7 @@ namespace Barotrauma
|
||||
{
|
||||
public event TextBoxEvent OnSelected;
|
||||
public event TextBoxEvent OnDeselected;
|
||||
|
||||
|
||||
bool caretVisible;
|
||||
float caretTimer;
|
||||
|
||||
@@ -76,10 +76,24 @@ namespace Barotrauma
|
||||
set { textBlock.TextGetter = value; }
|
||||
}
|
||||
|
||||
private bool selected;
|
||||
public bool Selected
|
||||
{
|
||||
get;
|
||||
set;
|
||||
get
|
||||
{
|
||||
return selected;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!selected && value)
|
||||
{
|
||||
Select();
|
||||
}
|
||||
else if (selected && !value)
|
||||
{
|
||||
Deselect();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool Wrap
|
||||
@@ -326,9 +340,9 @@ namespace Barotrauma
|
||||
{
|
||||
memento.Store(Text);
|
||||
}
|
||||
Selected = true;
|
||||
CaretIndex = GetCaretIndexFromScreenPos(PlayerInput.MousePosition);
|
||||
ClearSelection();
|
||||
selected = true;
|
||||
GUI.KeyboardDispatcher.Subscriber = this;
|
||||
OnSelected?.Invoke(this, Keys.None);
|
||||
}
|
||||
@@ -336,7 +350,8 @@ namespace Barotrauma
|
||||
public void Deselect()
|
||||
{
|
||||
memento.Clear();
|
||||
Selected = false;
|
||||
selected = false;
|
||||
|
||||
if (GUI.KeyboardDispatcher.Subscriber == this)
|
||||
{
|
||||
GUI.KeyboardDispatcher.Subscriber = null;
|
||||
@@ -382,6 +397,7 @@ namespace Barotrauma
|
||||
}
|
||||
else
|
||||
{
|
||||
if (PlayerInput.LeftButtonClicked() && selected) Deselect();
|
||||
isSelecting = false;
|
||||
state = ComponentState.None;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user