Example #1
0
        public Point GetCandidateDropLocation(AnchorableGump draggedControl, AnchorableGump host, int x, int y)
        {
            if (host.GetType().IsInstanceOfType(draggedControl) && this[draggedControl] == null)
            {
                AnchorDirection direction = GetAnchorDirection(host, x, y);

                if (this[host] == null || this[host].IsEmptyDirection(host, direction))
                {
                    var offset = AnchorDirectionMatrix[direction] * new Point(draggedControl.Width, draggedControl.Height);
                    return(new Point(host.X + offset.X, host.Y + offset.Y));
                }
            }

            return(draggedControl.Location);
        }
Example #2
0
        public void DropControl(AnchorableGump draggedControl, AnchorableGump host, int x, int y)
        {
            if (host.GetType().IsInstanceOfType(draggedControl) && this[draggedControl] == null)
            {
                AnchorDirection direction = GetAnchorDirection(host, x, y);

                if (this[host] == null)
                {
                    this[host] = new AnchorGroup(host);
                }

                if (this[host].IsEmptyDirection(host, direction))
                {
                    this[host].AnchorControlAt(draggedControl, host, direction);
                    this[draggedControl] = this[host];
                }
            }
        }