Release selection when the label component loses focus
This commit is contained in:
parent
ab6fed71d7
commit
7c259c0123
@ -121,6 +121,17 @@ void Label::OnMouseMoved(int localx, int localy, int dx, int dy)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Label::Tick(float dt)
|
||||||
|
{
|
||||||
|
if(!this->IsFocused() && (selecting || (selectionIndex0 != -1 && selectionIndex1 != -1)))
|
||||||
|
{
|
||||||
|
selecting = false;
|
||||||
|
selectionIndex0 = -1;
|
||||||
|
selectionIndex1 = -1;
|
||||||
|
updateSelection();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Label::updateSelection()
|
void Label::updateSelection()
|
||||||
{
|
{
|
||||||
std::string currentText;
|
std::string currentText;
|
||||||
|
@ -51,6 +51,7 @@ namespace ui
|
|||||||
virtual void OnMouseUp(int x, int y, unsigned button);
|
virtual void OnMouseUp(int x, int y, unsigned button);
|
||||||
virtual void OnMouseMoved(int localx, int localy, int dx, int dy);
|
virtual void OnMouseMoved(int localx, int localy, int dx, int dy);
|
||||||
virtual void Draw(const Point& screenPos);
|
virtual void Draw(const Point& screenPos);
|
||||||
|
virtual void Tick(float dt);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user