diff options
author | Maxim Nikolenko <maximnproductengine@lindenlab.com> | 2023-03-24 00:06:15 +0200 |
---|---|---|
committer | Maxim Nikolenko <maximnproductengine@lindenlab.com> | 2023-03-24 00:06:15 +0200 |
commit | cc98d967796e552432a59c2ad81742ad55bff983 (patch) | |
tree | 16f372d92a3b61bd44f4bc3672384e280ee9af96 | |
parent | 04501955c7d0cd19d13ac1374f6f06e944f6ea61 (diff) |
SL-19379 WIP add drag and drop out of Gallery
-rw-r--r-- | indra/newview/llinventorygallery.cpp | 43 | ||||
-rw-r--r-- | indra/newview/llinventorygallery.h | 2 |
2 files changed, 44 insertions, 1 deletions
diff --git a/indra/newview/llinventorygallery.cpp b/indra/newview/llinventorygallery.cpp index a3a1fbcc16..86f60b5644 100644 --- a/indra/newview/llinventorygallery.cpp +++ b/indra/newview/llinventorygallery.cpp @@ -46,6 +46,7 @@ #include "llgesturemgr.h" #include "llmarketplacefunctions.h" #include "lltrans.h" +#include "llviewerassettype.h" #include "llviewermessage.h" #include "llviewerobjectlist.h" #include "llvoavatarself.h" @@ -970,7 +971,13 @@ void LLInventoryGalleryItem::setSelected(bool value) BOOL LLInventoryGalleryItem::handleMouseDown(S32 x, S32 y, MASK mask) { setFocus(TRUE); - return LLUICtrl::handleMouseDown(x, y, mask); + + gFocusMgr.setMouseCapture(this); + S32 screen_x; + S32 screen_y; + localPointToScreen(x, y, &screen_x, &screen_y ); + LLToolDragAndDrop::getInstance()->setDragStart(screen_x, screen_y); + return TRUE; } BOOL LLInventoryGalleryItem::handleRightMouseDown(S32 x, S32 y, MASK mask) @@ -979,6 +986,40 @@ BOOL LLInventoryGalleryItem::handleRightMouseDown(S32 x, S32 y, MASK mask) return LLUICtrl::handleRightMouseDown(x, y, mask); } +BOOL LLInventoryGalleryItem::handleMouseUp(S32 x, S32 y, MASK mask) +{ + if(hasMouseCapture()) + { + gFocusMgr.setMouseCapture(NULL); + return TRUE; + } + return LLPanel::handleMouseUp(x, y, mask); +} + +BOOL LLInventoryGalleryItem::handleHover(S32 x, S32 y, MASK mask) +{ + if(hasMouseCapture()) + { + S32 screen_x; + S32 screen_y; + const LLInventoryItem *item = gInventory.getItem(mUUID);; + + localPointToScreen(x, y, &screen_x, &screen_y ); + if(item && LLToolDragAndDrop::getInstance()->isOverThreshold(screen_x, screen_y)) + { + EDragAndDropType type = LLViewerAssetType::lookupDragAndDropType(item->getType()); + LLToolDragAndDrop::ESource src = LLToolDragAndDrop::SOURCE_LIBRARY; + if(item->getPermissions().getOwner() == gAgent.getID()) + { + src = LLToolDragAndDrop::SOURCE_AGENT; + } + LLToolDragAndDrop::getInstance()->beginDrag(type, item->getUUID(), src); + return LLToolDragAndDrop::getInstance()->handleHover(x, y, mask ); + } + } + return LLUICtrl::handleHover(x,y,mask); +} + BOOL LLInventoryGalleryItem::handleDoubleClick(S32 x, S32 y, MASK mask) { if (mIsFolder && mGallery) diff --git a/indra/newview/llinventorygallery.h b/indra/newview/llinventorygallery.h index 7dd8187af3..0a779037db 100644 --- a/indra/newview/llinventorygallery.h +++ b/indra/newview/llinventorygallery.h @@ -200,6 +200,8 @@ public: BOOL handleMouseDown(S32 x, S32 y, MASK mask); BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); BOOL handleDoubleClick(S32 x, S32 y, MASK mask); + BOOL handleMouseUp(S32 x, S32 y, MASK mask); + BOOL handleHover(S32 x, S32 y, MASK mask); BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void* cargo_data, |