示例#1
0
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public void UpdateBeforeCursors()
        {
            IsHighlightPrevented = (
                !Item.IsEnabled ||
                !Item.IsVisible ||
                !Item.IsAncestryEnabled ||
                !Item.IsAncestryVisible ||
                !(Item is ISelectableItem) ||
                vPreventSelectionViaDisplayMap.Any(x => x.Value)
                );

            if (!IsHighlightPrevented)
            {
                vIsInResetState = false;
                return;
            }

            ResetAllCursorInteractions();
            vSelectionStart = null;

            ISelectableItem selItem = (Item as ISelectableItem);

            if (selItem != null)
            {
                selItem.DeselectStickySelections();
            }
        }
        /*--------------------------------------------------------------------------------------------*/
        public void ReloadActiveGroups()
        {
            if (vActiveGroups == null)
            {
                return;
            }

            foreach (IItemGroup group in vActiveGroups)
            {
                group.OnItemSelected -= HandleItemSelected;

                foreach (IBaseItem item in group.Items)
                {
                    ISelectableItem selItem = (item as ISelectableItem);

                    if (selItem == null)
                    {
                        continue;
                    }

                    selItem.DeselectStickySelections();
                }
            }

            vActiveGroups = null;             //list will be reloaded upon next "Items" property use
        }
示例#3
0
        /*--------------------------------------------------------------------------------------------*/
        public bool UpdateSelectionProcess()
        {
            ISelectableItem selItem = (Item as ISelectableItem);

            if (selItem == null)
            {
                return(false);
            }

            ////

            float selectProg = SelectionProgress;

            if (selectProg <= 0 || !IsNearestHighlight)
            {
                selItem.DeselectStickySelections();
            }

            if (!IsNearestHighlight || !selItem.AllowSelection)
            {
                IsSelectionPrevented = false;
                vSelectionStart      = null;
                return(false);
            }

            ////

            bool allNearestCursorsHavePartialHighlight = true;             //where "partial" == "not 100%"

            foreach (CursorType cursorType in vCursorWorldPosMap.Keys)
            {
                if (vIsNearestHighlightMap[cursorType] && vHighlightProgressMap[cursorType] >= 1)
                {
                    allNearestCursorsHavePartialHighlight = false;
                }
            }

            if (allNearestCursorsHavePartialHighlight)
            {
                IsSelectionPrevented = false;
                vSelectionStart      = null;
                return(false);
            }

            ////

            if (IsSelectionPrevented)
            {
                vSelectionStart = null;
                return(false);
            }

            if (vSelectionStart == null)
            {
                vSelectionStart = DateTime.UtcNow;
                return(false);
            }

            if (selectProg < 1)
            {
                return(false);
            }

            vSelectionStart        = null;
            IsSelectionPrevented   = true;
            vDistanceUponSelection = MinHighlightDistance;
            selItem.Select();
            return(true);
        }