Add option to disable selecting text in text box

5dadaf70f9
This commit is contained in:
Wojciech Figat
2022-08-08 13:51:55 +02:00
parent 183e87d147
commit 07b02e6cf3
2 changed files with 5 additions and 2 deletions

View File

@@ -207,7 +207,7 @@ namespace FlaxEngine.GUI
{ {
// Select the word under the mouse // Select the word under the mouse
int textLength = TextLength; int textLength = TextLength;
if (textLength != 0) if (textLength != 0 && IsSelectable)
{ {
var hitPos = CharIndexAtPoint(ref location); var hitPos = CharIndexAtPoint(ref location);
int spaceLoc = _text.LastIndexOfAny(Separators, hitPos - 2); int spaceLoc = _text.LastIndexOfAny(Separators, hitPos - 2);

View File

@@ -234,7 +234,10 @@ namespace FlaxEngine.GUI
/// <inheritdoc /> /// <inheritdoc />
public override bool OnMouseDoubleClick(Float2 location, MouseButton button) public override bool OnMouseDoubleClick(Float2 location, MouseButton button)
{ {
SelectAll(); if (IsSelectable)
{
SelectAll();
}
return base.OnMouseDoubleClick(location, button); return base.OnMouseDoubleClick(location, button);
} }