From: Perttu Ahola Date: Thu, 1 Dec 2011 09:32:51 +0000 (+0200) Subject: Enable simple drag and drop in inventory X-Git-Url: http://81.2.79.47:8989/gitweb/?a=commitdiff_plain;h=f4272ccf8f0b0bbd76b28bbc715dd8534507a9bf;p=zefram%2Fminetest%2Fminetest_engine.git Enable simple drag and drop in inventory --- diff --git a/src/guiInventoryMenu.cpp b/src/guiInventoryMenu.cpp index 47393e80..45733bcd 100644 --- a/src/guiInventoryMenu.cpp +++ b/src/guiInventoryMenu.cpp @@ -328,6 +328,9 @@ bool GUIInventoryMenu::OnEvent(const SEvent& event) { char amount = -1; + v2s32 p(event.MouseInput.X, event.MouseInput.Y); + ItemSpec s = getItemAtPos(p); + if(event.MouseInput.Event==EMIE_MOUSE_MOVED) m_pointer = v2s32(event.MouseInput.X, event.MouseInput.Y); else if(event.MouseInput.Event == EMIE_LMOUSE_PRESSED_DOWN) @@ -336,15 +339,19 @@ bool GUIInventoryMenu::OnEvent(const SEvent& event) amount = 1; else if(event.MouseInput.Event == EMIE_MMOUSE_PRESSED_DOWN) amount = 10; + else if(event.MouseInput.Event == EMIE_LMOUSE_LEFT_UP && + m_selected_item && + (m_selected_item->listname != s.listname + || m_selected_item->i != s.i)) + amount = 0; + if(amount >= 0) { - v2s32 p(event.MouseInput.X, event.MouseInput.Y); - //infostream<<"Mouse down at p=("<