- fixed : drag-and-hold doesn't activate tab buttons on the build floater

meow-7.2.2
Kitty Barnett 2011-06-16 23:02:25 +02:00
parent bd2c153cc0
commit ef59beb300
2 changed files with 48 additions and 7 deletions

View File

@ -228,6 +228,9 @@ LLTabContainer::Params::Params()
LLTabContainer::LLTabContainer(const LLTabContainer::Params& p)
: LLPanel(p),
mCurrentTabIdx(-1),
// [SL:KB] - Checked: UI-TabDndButtonCommit | Checked: 2011-06-16 (Catznip-2.6.0c) | Added: Catznip-2.6.0c
mDragAndDropHoverIdx(-1),
// [/SL:KB]
mTabsHidden(p.hide_tabs),
mScrolled(FALSE),
mScrollPos(0),
@ -834,6 +837,30 @@ BOOL LLTabContainer::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDrag
{
BOOL has_scroll_arrows = (getMaxScrollPos() > 0);
// [SL:KB] - Checked: UI-TabDndButtonCommit | Checked: 2011-06-16 (Catznip-2.6.0c) | Added: Catznip-2.6.0c
S32 curHoverIdx = -1;
if (!getTabsHidden())
{
for(tuple_list_t::const_iterator itTab = mTabList.begin(); itTab != mTabList.end(); ++itTab)
{
const LLTabTuple* pTuple = *itTab;
S32 local_x = x - pTuple->mButton->getRect().mLeft;
S32 local_y = y - pTuple->mButton->getRect().mBottom;
if ( (pTuple->mButton->getEnabled()) && (pTuple->mButton->pointInView(local_x, local_y)) )
curHoverIdx = itTab - mTabList.begin();
}
}
if (-1 == curHoverIdx)
mDragAndDropDelayTimer.stop(); // Mouse not hovering over a tab button
else if ( (mCurrentTabIdx != curHoverIdx) && (!mDragAndDropDelayTimer.getStarted()) )
mDragAndDropDelayTimer.start(); // Mouse hovering over a tab button
else if ( (mDragAndDropHoverIdx != curHoverIdx) && (mDragAndDropDelayTimer.getStarted()) )
mDragAndDropDelayTimer.reset(); // Mouse hovering over a different tab button
mDragAndDropHoverIdx = curHoverIdx;
// [/SL:KB]
if( mDragAndDropDelayTimer.getStarted() && mDragAndDropDelayTimer.getElapsedTimeF32() > SCROLL_DELAY_TIME )
{
if (has_scroll_arrows)
@ -864,18 +891,29 @@ BOOL LLTabContainer::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDrag
}
}
for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
// [SL:KB] - Checked: UI-TabDndButtonCommit | Checked: 2011-06-16 (Catznip-2.6.0c) | Added: Catznip-2.6.0c
if (-1 != mDragAndDropHoverIdx)
{
LLTabTuple* tuple = *iter;
tuple->mButton->setVisible( TRUE );
S32 local_x = x - tuple->mButton->getRect().mLeft;
S32 local_y = y - tuple->mButton->getRect().mBottom;
if (tuple->mButton->pointInView(local_x, local_y) && tuple->mButton->getEnabled() && !tuple->mTabPanel->getVisible())
const LLTabTuple* pTuple = mTabList[mDragAndDropHoverIdx];
if (!pTuple->mTabPanel->getVisible())
{
tuple->mButton->onCommit();
pTuple->mButton->onCommit();
mDragAndDropDelayTimer.stop();
}
}
// [/SL:KB]
// for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
// {
// LLTabTuple* tuple = *iter;
// tuple->mButton->setVisible( TRUE );
// S32 local_x = x - tuple->mButton->getRect().mLeft;
// S32 local_y = y - tuple->mButton->getRect().mBottom;
// if (tuple->mButton->pointInView(local_x, local_y) && tuple->mButton->getEnabled() && !tuple->mTabPanel->getVisible())
// {
// tuple->mButton->onCommit();
// mDragAndDropDelayTimer.stop();
// }
// }
}
return LLView::handleDragAndDrop(x, y, mask, drop, type, cargo_data, accept, tooltip);

View File

@ -291,6 +291,9 @@ private:
S32 mLabelPadLeft;
LLFrameTimer mDragAndDropDelayTimer;
// [SL:KB] - Checked: UI-TabDndButtonCommit | Checked: 2011-06-16 (Catznip-2.6.0c) | Added: Catznip-2.6.0c
S32 mDragAndDropHoverIdx;
// [/SL:KB]
LLFontGL::HAlign mFontHalign;
const LLFontGL* mFont;