Exemplo n.º 1
0
        public static bool OnMouseButton(GUIControl hoveredControl, int x, int y, bool down)
        {
            if (!down)
            {
                m_LastPressedControl = null;

                // Not carrying anything, allow normal actions
                if (CurrentPackage == null)
                    return false;

                // We were carrying something, drop it.
                onDrop(x, y);
                return true;
            }

            if (hoveredControl == null) 
                return false;
            if (!hoveredControl.DragAndDrop_Draggable()) 
                return false;

            // Store the last clicked on control. Don't do anything yet, 
            // we'll check it in OnMouseMoved, and if it moves further than
            // x pixels with the mouse down, we'll start to drag.
            m_LastPressedPos = new Point(x, y);
            m_LastPressedControl = hoveredControl;

            return false;
        }