예제 #1
0
        bool isSameAsAlreadySelectedElement(GuiElement element)
        {
            // is not the same if no element is selected
            if (!selectionTracker.isAnyGuiElementSelected)
            {
                return(false);
            }

            return(element == selectionTracker.selectedElement);
        }
예제 #2
0
        void trySendDeselectionToElementIfNotSameElement(GuiElement element)
        {
            // if no element is/was selected we can't send it an deselection event
            if (!selectionTracker.isAnyGuiElementSelected)
            {
                return;
            }

            // if it is the same gui element sending it a deselection event is useless
            if (isSameAsAlreadySelectedElement(element))
            {
                return;
            }

            // all fine, send delesection event
            sendDelesectionEventTo(selectionTracker.selectedElement);
        }
예제 #3
0
        // called from outside when the mouse button was released
        public void eventMouseReleased(SpatialVectorDouble mousePosition)
        {
            IEnumerable <GuiElement> guiElementsUnderMousePositionAsEnumerable =
                positionChecker.getElementsWhichOverlapTheMousePosition(mousePosition);
            IList <GuiElement> guiElementsUnderMousePosition = new List <GuiElement>(guiElementsUnderMousePositionAsEnumerable);

            if (guiElementsUnderMousePosition.Count > 0)
            {
                // change the selection

                // we just take first GuiElement in case of multiple
                // NOTE< could be a problem if there are multiple elements under the mouse position, we let it this way for now >
                GuiElement elementUnderMousePosition = guiElementsUnderMousePosition[0];

                // delesection
                trySendDeselectionToElementIfNotSameElement(elementUnderMousePosition);

                // selection
                if (!isSameAsAlreadySelectedElement(elementUnderMousePosition))
                {
                    changeSelectionTo(elementUnderMousePosition);
                }
            }
        }
예제 #4
0
        public void removeAndDisposeGuiElement(GuiElement element)
        {
            guiElements.elements.Remove(element);

            // TODO< dispose >
        }
예제 #5
0
 public void addGuiElement(GuiElement element)
 {
     guiElements.elements.Add(element);
 }
예제 #6
0
 void sendDelesectionEventTo(GuiElement element)
 {
     throw new NotImplementedException(); // TODO
 }
예제 #7
0
 void changeSelectionTo(GuiElement element)
 {
     selectionTracker.selectedElement = element;
     sendSelectionEventTo(element);
 }