Skip to content
Snippets Groups Projects
Commit 6cd91770 authored by Andrey Kleshchev's avatar Andrey Kleshchev
Browse files

SL-19987 Landmark is shifting to the left of the pointed position

There is still a chance user will try to move multiple landmarks one after another, but if it didn't update in the time user moves landmarks it's going to end up out of order either way
parent ec4135da
No related branches found
No related tags found
No related merge requests found
...@@ -320,6 +320,7 @@ class LLItemCopiedCallback : public LLInventoryCallback ...@@ -320,6 +320,7 @@ class LLItemCopiedCallback : public LLInventoryCallback
if (item) if (item)
{ {
LLFavoritesBarCtrl::sWaitingForCallabck = 0.f;
LLFavoritesOrderStorage::instance().setSortIndex(item, mSortField); LLFavoritesOrderStorage::instance().setSortIndex(item, mSortField);
item->setComplete(TRUE); item->setComplete(TRUE);
...@@ -365,6 +366,9 @@ struct LLFavoritesSort ...@@ -365,6 +366,9 @@ struct LLFavoritesSort
} }
}; };
F64 LLFavoritesBarCtrl::sWaitingForCallabck = 0.f;
LLFavoritesBarCtrl::Params::Params() LLFavoritesBarCtrl::Params::Params()
: image_drag_indication("image_drag_indication"), : image_drag_indication("image_drag_indication"),
more_button("more_button"), more_button("more_button"),
...@@ -381,7 +385,7 @@ LLFavoritesBarCtrl::LLFavoritesBarCtrl(const LLFavoritesBarCtrl::Params& p) ...@@ -381,7 +385,7 @@ LLFavoritesBarCtrl::LLFavoritesBarCtrl(const LLFavoritesBarCtrl::Params& p)
mShowDragMarker(FALSE), mShowDragMarker(FALSE),
mLandingTab(NULL), mLandingTab(NULL),
mLastTab(NULL), mLastTab(NULL),
mTabsHighlightEnabled(TRUE), mItemsListDirty(false),
mUpdateDropDownItems(true), mUpdateDropDownItems(true),
mRestoreOverflowMenu(false), mRestoreOverflowMenu(false),
mGetPrevItems(true), mGetPrevItems(true),
...@@ -618,6 +622,9 @@ void LLFavoritesBarCtrl::handleNewFavoriteDragAndDrop(LLInventoryItem *item, con ...@@ -618,6 +622,9 @@ void LLFavoritesBarCtrl::handleNewFavoriteDragAndDrop(LLInventoryItem *item, con
int sortField = 0; int sortField = 0;
LLPointer<LLItemCopiedCallback> cb; LLPointer<LLItemCopiedCallback> cb;
const F64 CALLBACK_WAIT_TIME = 30.f;
sWaitingForCallabck = LLTimer::getTotalSeconds() + CALLBACK_WAIT_TIME;
// current order is saved by setting incremental values (1, 2, 3, ...) for the sort field // current order is saved by setting incremental values (1, 2, 3, ...) for the sort field
for (LLInventoryModel::item_array_t::iterator i = mItems.begin(); i != mItems.end(); ++i) for (LLInventoryModel::item_array_t::iterator i = mItems.begin(); i != mItems.end(); ++i)
{ {
...@@ -691,16 +698,22 @@ void LLFavoritesBarCtrl::changed(U32 mask) ...@@ -691,16 +698,22 @@ void LLFavoritesBarCtrl::changed(U32 mask)
LLFavoritesOrderStorage::instance().getSLURL((*i)->getAssetUUID()); LLFavoritesOrderStorage::instance().getSLURL((*i)->getAssetUUID());
} }
updateButtons(); if (sWaitingForCallabck < LLTimer::getTotalSeconds())
if (!mItemsChangedTimer.getStarted()) {
{ updateButtons();
mItemsChangedTimer.start(); if (!mItemsChangedTimer.getStarted())
} {
else mItemsChangedTimer.start();
{ }
mItemsChangedTimer.reset(); else
} {
mItemsChangedTimer.reset();
}
}
else
{
mItemsListDirty = true;
}
} }
} }
...@@ -754,6 +767,18 @@ void LLFavoritesBarCtrl::draw() ...@@ -754,6 +767,18 @@ void LLFavoritesBarCtrl::draw()
mItemsChangedTimer.start(); mItemsChangedTimer.start();
} }
if (mItemsListDirty && sWaitingForCallabck < LLTimer::getTotalSeconds())
{
updateButtons();
if (!mItemsChangedTimer.getStarted())
{
mItemsChangedTimer.start();
}
else
{
mItemsChangedTimer.reset();
}
}
} }
const LLButton::Params& LLFavoritesBarCtrl::getButtonParams() const LLButton::Params& LLFavoritesBarCtrl::getButtonParams()
...@@ -782,6 +807,7 @@ void LLFavoritesBarCtrl::updateButtons(bool force_update) ...@@ -782,6 +807,7 @@ void LLFavoritesBarCtrl::updateButtons(bool force_update)
return; return;
} }
mItemsListDirty = false;
mItems.clear(); mItems.clear();
if (!collectFavoriteItems(mItems)) if (!collectFavoriteItems(mItems))
......
...@@ -53,6 +53,7 @@ class LLFavoritesBarCtrl : public LLUICtrl, public LLInventoryObserver ...@@ -53,6 +53,7 @@ class LLFavoritesBarCtrl : public LLUICtrl, public LLInventoryObserver
protected: protected:
LLFavoritesBarCtrl(const Params&); LLFavoritesBarCtrl(const Params&);
friend class LLUICtrlFactory; friend class LLUICtrlFactory;
friend class LLItemCopiedCallback;
public: public:
virtual ~LLFavoritesBarCtrl(); virtual ~LLFavoritesBarCtrl();
...@@ -84,7 +85,6 @@ class LLFavoritesBarCtrl : public LLUICtrl, public LLInventoryObserver ...@@ -84,7 +85,6 @@ class LLFavoritesBarCtrl : public LLUICtrl, public LLInventoryObserver
void onButtonRightClick(LLUUID id,LLView* button,S32 x,S32 y,MASK mask); void onButtonRightClick(LLUUID id,LLView* button,S32 x,S32 y,MASK mask);
void onButtonMouseDown(LLUUID id, LLUICtrl* button, S32 x, S32 y, MASK mask); void onButtonMouseDown(LLUUID id, LLUICtrl* button, S32 x, S32 y, MASK mask);
void onOverflowMenuItemMouseDown(LLUUID id, LLUICtrl* item, S32 x, S32 y, MASK mask);
void onButtonMouseUp(LLUUID id, LLUICtrl* button, S32 x, S32 y, MASK mask); void onButtonMouseUp(LLUUID id, LLUICtrl* button, S32 x, S32 y, MASK mask);
void onEndDrag(); void onEndDrag();
...@@ -164,7 +164,8 @@ class LLFavoritesBarCtrl : public LLUICtrl, public LLInventoryObserver ...@@ -164,7 +164,8 @@ class LLFavoritesBarCtrl : public LLUICtrl, public LLInventoryObserver
BOOL mStartDrag; BOOL mStartDrag;
LLInventoryModel::item_array_t mItems; LLInventoryModel::item_array_t mItems;
BOOL mTabsHighlightEnabled; static F64 sWaitingForCallabck;
bool mItemsListDirty;
S32 mMouseX; S32 mMouseX;
S32 mMouseY; S32 mMouseY;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment