Exemplo n.º 1
0
        private void insertButtonIntoStack(List <TimelineViewButton> buttonStack, TimelineViewButton insert)
        {
            //Sort the stack in order from top to bottom.
            buttonStack.Sort(topSortButtons);
            //Search the stack looking for a space in the buttons.
            int insertYPos     = yPosition;
            int lastButtonYPos = -1;

            foreach (TimelineViewButton button in buttonStack)
            {
                if (lastButtonYPos != button.Top) //Make sure the next button is actually lower, its possible that it is not
                {
                    lastButtonYPos = button.Top;
                    if (button.Top == insertYPos)
                    {
                        insertYPos = button.Bottom + STACKED_BUTTON_SPACE;
                    }
                    else
                    {
                        break;
                    }
                }
            }
            insert._moveTop(insertYPos);
        }
Exemplo n.º 2
0
        private void computeButtonPosition(TimelineViewButton movedButton)
        {
            //Find the buttons that currently intersect the moved button
            List <TimelineViewButton> currentStackedButtons = new List <TimelineViewButton>();

            findIntersectingButtons(currentStackedButtons, movedButton.Left, movedButton.Right);
            currentStackedButtons.Remove(movedButton);

            //If there are no buttons currently intersecting the new position, put the button at the top.
            if (currentStackedButtons.Count == 0)
            {
                movedButton._moveTop(yPosition);
            }
            //Put the button at the first blank space that can be found
            else
            {
                insertButtonIntoStack(currentStackedButtons, movedButton);
            }
        }