//Detects the release of the mouse button
        public virtual void OnPointerUp(PointerEventData eventData)
        {
            if (!eventData.dragging)
            {
                Stack stack = InventoryManager.UI.stack;

                bool isUnstacking = stack != null && stack.item != null;
                //Check if we are currently unstacking the item
                if (isUnstacking && Container.StackOrAdd(this, stack.item))
                {
                    stack.item = null;
                    UICursor.Clear();
                }

                if (isUnstacking)
                {
                    return;
                }

                if (Container.useButton.HasFlag((InputButton)Mathf.Clamp(((int)eventData.button * 2), 1, int.MaxValue)) && ObservedItem != null)
                {
                    if (Container.UseContextMenu)
                    {
                        UIWidgets.ContextMenu menu = InventoryManager.UI.contextMenu;
                        if (menu == null)
                        {
                            return;
                        }
                        menu.Clear();
                        if (Trigger.currentUsedTrigger != null && Trigger.currentUsedTrigger is VendorTrigger && Container.CanSellItems)
                        {
                            menu.AddMenuItem("Sell", Use);
                        }
                        else if (ObservedItem is UsableItem)
                        {
                            menu.AddMenuItem("Use", Use);
                        }
                        if (ObservedItem.MaxStack > 1 || ObservedItem.MaxStack == 0)
                        {
                            menu.AddMenuItem("Unstack", Unstack);
                        }

                        menu.AddMenuItem("Drop", DropItem);

                        menu.Show();
                    }
                    else
                    {
                        Use();
                    }
                }
            }
        }
        //Detects the release of the mouse button
        public virtual void OnPointerUp(PointerEventData eventData)
        {
            EventSystem.current.SetSelectedGameObject(null);
            if (!eventData.dragging)
            {
                Stack stack = InventoryManager.UI.stack;

                bool isUnstacking = stack != null && stack.item != null;

                if (!isUnstacking && InventoryManager.Input.unstackEvent.HasFlag <Configuration.Input.UnstackInput>(Configuration.Input.UnstackInput.OnClick) && Input.GetKey(InventoryManager.Input.unstackKeyCode) && ObservedItem.Stack > 1)
                {
                    Unstack();
                    return;
                }

                //Check if we are currently unstacking the item
                if (isUnstacking && Container.StackOrAdd(this, stack.item))
                {
                    stack.item = null;
                    UICursor.Clear();
                }

                if (isUnstacking)
                {
                    return;
                }

                if (ObservedItem == null)
                {
                    return;
                }

                if (Container.useButton.HasFlag((InputButton)Mathf.Clamp(((int)eventData.button * 2), 1, int.MaxValue)))
                {
                    Use();
                }
                else if (Container.UseContextMenu && Container.ContextMenuButton.HasFlag((InputButton)Mathf.Clamp(((int)eventData.button * 2), 1, int.MaxValue)))
                {
                    UIWidgets.ContextMenu menu = InventoryManager.UI.contextMenu;
                    if (menu == null)
                    {
                        return;
                    }
                    menu.Clear();

                    if (Trigger.currentUsedTrigger != null && Trigger.currentUsedTrigger is VendorTrigger && Container.CanSellItems)
                    {
                        menu.AddMenuItem("Sell", Use);
                    }
                    else if (ObservedItem is UsableItem)
                    {
                        menu.AddMenuItem("Use", Use);
                    }
                    if (ObservedItem.MaxStack > 1 || ObservedItem.MaxStack == 0)
                    {
                        menu.AddMenuItem("Unstack", Unstack);
                    }

                    menu.AddMenuItem("Drop", DropItem);

                    if (ObservedItem.EnchantingRecipe != null)
                    {
                        menu.AddMenuItem("Enchant", delegate() {
                            ItemContainer container = WidgetUtility.Find <ItemContainer>("Enchanting");
                            container.Show();

                            container.ReplaceItem(0, ObservedItem);
                        });
                    }

                    if (ObservedItem.CanDestroy)
                    {
                        menu.AddMenuItem("Destroy", DestroyItem);
                    }

                    for (int i = 0; i < Container.ContextMenuFunctions.Count; i++)
                    {
                        int cnt = i;
                        if (!string.IsNullOrEmpty(Container.ContextMenuFunctions[cnt]))
                        {
                            menu.AddMenuItem(Container.ContextMenuFunctions[cnt], () => { Container.gameObject.SendMessage(Container.ContextMenuFunctions[cnt], ObservedItem, SendMessageOptions.DontRequireReceiver); });
                        }
                    }

                    menu.Show();
                }
            }
        }