mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-10 09:19:01 +00:00
Orphaned widgets won't get stuck.
This commit is contained in:
parent
f30054a26c
commit
c5b8f30bb9
1 changed files with 43 additions and 19 deletions
|
@ -2409,6 +2409,30 @@ namespace NLGUI
|
||||||
// must not capture a new element if a sheet is currentlty being dragged.
|
// must not capture a new element if a sheet is currentlty being dragged.
|
||||||
// This may happen when alt-tab has been used => the sheet is dragged but the left button is up
|
// This may happen when alt-tab has been used => the sheet is dragged but the left button is up
|
||||||
if (!CCtrlDraggable::getDraggedSheet())
|
if (!CCtrlDraggable::getDraggedSheet())
|
||||||
|
{
|
||||||
|
|
||||||
|
if( CInterfaceElement::getEditorMode() )
|
||||||
|
{
|
||||||
|
std::vector< NLMISC::CRefPtr< CInterfaceElement > >::reverse_iterator itr = _OrphanElements.rbegin();
|
||||||
|
while( itr != _OrphanElements.rend() )
|
||||||
|
{
|
||||||
|
CInterfaceElement *e = *itr;
|
||||||
|
|
||||||
|
int x = getPointer()->getXReal();
|
||||||
|
int y = getPointer()->getYReal();
|
||||||
|
|
||||||
|
if( e->isIn( x, y ) )
|
||||||
|
{
|
||||||
|
_CapturedView = static_cast< CViewBase* >( e );
|
||||||
|
captured = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
++itr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !captured )
|
||||||
{
|
{
|
||||||
// Take the top most control.
|
// Take the top most control.
|
||||||
uint nMaxDepth = 0;
|
uint nMaxDepth = 0;
|
||||||
|
@ -2427,6 +2451,7 @@ namespace NLGUI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if( CInterfaceElement::getEditorMode() && !captured )
|
if( CInterfaceElement::getEditorMode() && !captured )
|
||||||
{
|
{
|
||||||
|
@ -2674,23 +2699,22 @@ namespace NLGUI
|
||||||
if( draggedElement != NULL )
|
if( draggedElement != NULL )
|
||||||
{
|
{
|
||||||
CInterfaceGroup *g = getGroupUnder( draggedElement->getXReal(), draggedElement->getYReal() );
|
CInterfaceGroup *g = getGroupUnder( draggedElement->getXReal(), draggedElement->getYReal() );
|
||||||
|
|
||||||
if( g != NULL )
|
|
||||||
{
|
|
||||||
CInterfaceElement *e = draggedElement;
|
CInterfaceElement *e = draggedElement;
|
||||||
e->setName( "=MARKED=" );
|
|
||||||
e->setParent( g );
|
e->setParent( g );
|
||||||
e->setIdRecurse( e->getShortId() );
|
e->setIdRecurse( e->getShortId() );
|
||||||
g->addElement( e );
|
|
||||||
|
|
||||||
e->setParentPos( g );
|
e->setParentPos( g );
|
||||||
e->setParentSize( g );
|
e->setParentSize( g );
|
||||||
|
|
||||||
checkCoords();
|
if( g != NULL )
|
||||||
|
{
|
||||||
|
g->addElement( e );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
_OrphanElements.push_back( draggedElement );
|
_OrphanElements.push_back( draggedElement );
|
||||||
|
|
||||||
|
checkCoords();
|
||||||
|
|
||||||
draggedElement = NULL;
|
draggedElement = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue