fix for low Task EXT-2881 Enough space to place 5 chiclets without arrows in bottom bar when voice indicator isn't shown
change whole chicklet arranging. --HG-- branch : product-enginemaster
parent
d1a857de1f
commit
2fd6bb4b59
|
|
@ -67,7 +67,8 @@ static LLDefaultChildRegistry::Register<LLInvOfferChiclet> t7("chiclet_offer");
|
|||
static const LLRect CHICLET_RECT(0, 25, 25, 0);
|
||||
static const LLRect CHICLET_ICON_RECT(0, 22, 22, 0);
|
||||
static const LLRect VOICE_INDICATOR_RECT(25, 25, 45, 0);
|
||||
static const S32 OVERLAY_ICON_SHIFT = 2; // used for shifting of an overlay icon for new massages in a chiclet
|
||||
static const S32 OVERLAY_ICON_SHIFT = 2; // used for shifting of an overlay icon for new massages in a chiclet
|
||||
static const S32 SCROLL_BUTTON_PAD = 5;
|
||||
|
||||
// static
|
||||
const S32 LLChicletPanel::s_scroll_ratio = 10;
|
||||
|
|
@ -1230,7 +1231,6 @@ bool LLChicletPanel::addChiclet(LLChiclet* chiclet, S32 index)
|
|||
chiclet->setChicletSizeChangedCallback(boost::bind(&LLChicletPanel::onChicletSizeChanged, this, _1, index));
|
||||
|
||||
arrange();
|
||||
showScrollButtonsIfNeeded();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1241,8 +1241,6 @@ bool LLChicletPanel::addChiclet(LLChiclet* chiclet, S32 index)
|
|||
void LLChicletPanel::onChicletSizeChanged(LLChiclet* ctrl, const LLSD& param)
|
||||
{
|
||||
arrange();
|
||||
trimChiclets();
|
||||
showScrollButtonsIfNeeded();
|
||||
}
|
||||
|
||||
void LLChicletPanel::onChicletClick(LLUICtrl*ctrl,const LLSD¶m)
|
||||
|
|
@ -1259,8 +1257,6 @@ void LLChicletPanel::removeChiclet(chiclet_list_t::iterator it)
|
|||
mChicletList.erase(it);
|
||||
|
||||
arrange();
|
||||
trimChiclets();
|
||||
showScrollButtonsIfNeeded();
|
||||
}
|
||||
|
||||
void LLChicletPanel::removeChiclet(S32 index)
|
||||
|
|
@ -1353,8 +1349,6 @@ void LLChicletPanel::reshape(S32 width, S32 height, BOOL called_from_parent )
|
|||
{
|
||||
LLPanel::reshape(width,height,called_from_parent);
|
||||
|
||||
static const S32 SCROLL_BUTTON_PAD = 5;
|
||||
|
||||
//Needed once- to avoid error at first call of reshape() before postBuild()
|
||||
if(!mLeftScrollButton||!mRightScrollButton)
|
||||
return;
|
||||
|
|
@ -1365,9 +1359,21 @@ void LLChicletPanel::reshape(S32 width, S32 height, BOOL called_from_parent )
|
|||
scroll_button_rect = mRightScrollButton->getRect();
|
||||
mRightScrollButton->setRect(LLRect(width - scroll_button_rect.getWidth(),scroll_button_rect.mTop,
|
||||
width, scroll_button_rect.mBottom));
|
||||
mScrollArea->setRect(LLRect(scroll_button_rect.getWidth() + SCROLL_BUTTON_PAD,
|
||||
height, width - scroll_button_rect.getWidth() - SCROLL_BUTTON_PAD, 0));
|
||||
|
||||
|
||||
bool need_show_scroll = needShowScroll();
|
||||
if(need_show_scroll)
|
||||
{
|
||||
mScrollArea->setRect(LLRect(scroll_button_rect.getWidth() + SCROLL_BUTTON_PAD,
|
||||
height, width - scroll_button_rect.getWidth() - SCROLL_BUTTON_PAD, 0));
|
||||
}
|
||||
else
|
||||
{
|
||||
mScrollArea->setRect(LLRect(0,height, width, 0));
|
||||
}
|
||||
|
||||
mShowControls = width >= mMinWidth;
|
||||
|
||||
mScrollArea->setVisible(mShowControls);
|
||||
|
||||
trimChiclets();
|
||||
|
|
@ -1380,8 +1386,8 @@ void LLChicletPanel::arrange()
|
|||
if(mChicletList.empty())
|
||||
return;
|
||||
|
||||
//initial arrange of chicklets positions
|
||||
S32 chiclet_left = getChiclet(0)->getRect().mLeft;
|
||||
|
||||
S32 size = getChicletCount();
|
||||
for( int n = 0; n < size; ++n)
|
||||
{
|
||||
|
|
@ -1395,6 +1401,24 @@ void LLChicletPanel::arrange()
|
|||
|
||||
chiclet_left += chiclet_width + getChicletPadding();
|
||||
}
|
||||
|
||||
//reset size and pos on mScrollArea
|
||||
LLRect rect = getRect();
|
||||
LLRect scroll_button_rect = mLeftScrollButton->getRect();
|
||||
|
||||
bool need_show_scroll = needShowScroll();
|
||||
if(need_show_scroll)
|
||||
{
|
||||
mScrollArea->setRect(LLRect(scroll_button_rect.getWidth() + SCROLL_BUTTON_PAD,
|
||||
rect.getHeight(), rect.getWidth() - scroll_button_rect.getWidth() - SCROLL_BUTTON_PAD, 0));
|
||||
}
|
||||
else
|
||||
{
|
||||
mScrollArea->setRect(LLRect(0,rect.getHeight(), rect.getWidth(), 0));
|
||||
}
|
||||
|
||||
trimChiclets();
|
||||
showScrollButtonsIfNeeded();
|
||||
}
|
||||
|
||||
void LLChicletPanel::trimChiclets()
|
||||
|
|
@ -1412,6 +1436,17 @@ void LLChicletPanel::trimChiclets()
|
|||
}
|
||||
}
|
||||
|
||||
bool LLChicletPanel::needShowScroll()
|
||||
{
|
||||
if(mChicletList.empty())
|
||||
return false;
|
||||
|
||||
S32 chicklet_width = (*mChicletList.rbegin())->getRect().mRight - (*mChicletList.begin())->getRect().mLeft;
|
||||
|
||||
return chicklet_width>getRect().getWidth();
|
||||
}
|
||||
|
||||
|
||||
void LLChicletPanel::showScrollButtonsIfNeeded()
|
||||
{
|
||||
bool can_scroll_left = canScrollLeft();
|
||||
|
|
|
|||
|
|
@ -1020,6 +1020,11 @@ protected:
|
|||
*/
|
||||
bool canScrollRight();
|
||||
|
||||
/**
|
||||
* Returns true if we need to show scroll buttons
|
||||
*/
|
||||
bool needShowScroll();
|
||||
|
||||
/**
|
||||
* Returns true if chiclets can be scrolled left.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in New Issue