Editbox selection should be stopped when the mouse button goes up, even if it happens outside of the box.

This commit is contained in:
dfighter1985 2014-09-26 23:29:38 +02:00
parent a943c939ef
commit 161c8e5edc
2 changed files with 17 additions and 10 deletions

View file

@ -1320,6 +1320,16 @@ namespace NLGUI
}
}
// if click, and not frozen, then get the focus
if (eventDesc.getEventTypeExtended() == NLGUI::CEventDescriptorMouse::mouseleftup && !_Frozen)
{
_SelectingText = false;
if (_SelectCursorPos == _CursorPos)
_CurrSelection = NULL;
return true;
}
if (!isIn(eventDesc.getX(), eventDesc.getY()))
return false;
@ -1329,6 +1339,7 @@ namespace NLGUI
_SelectingText = true;
stopParentBlink();
CWidgetManager::getInstance()->setCaptureKeyboard (this);
CWidgetManager::getInstance()->setCapturePointerLeft (this);
// set the right cursor position
uint newCurPos;
bool cursorAtPreviousLineEnd;
@ -1356,16 +1367,6 @@ namespace NLGUI
return true;
}
// if click, and not frozen, then get the focus
if (eventDesc.getEventTypeExtended() == NLGUI::CEventDescriptorMouse::mouseleftup && !_Frozen)
{
_SelectingText = false;
if (_SelectCursorPos == _CursorPos)
_CurrSelection = NULL;
return true;
}
if (eventDesc.getEventTypeExtended() == NLGUI::CEventDescriptorMouse::mouserightdown)
{
CWidgetManager::getInstance()->setCapturePointerRight(this);

View file

@ -2539,6 +2539,12 @@ namespace NLGUI
{
if ( getCapturePointerLeft() != NULL)
{
if( !handled )
{
CCtrlBase *c = getCapturePointerLeft();
c->handleEvent( evnt );
}
setCapturePointerLeft(NULL);
handled = true;
}