Exemplo n.º 1
0
        public void Tracking()
        {
            if (Parent.Count < 2)
            {
                return;
            }
            // remove itself and on the same linked list.
            var interactSet = Parent.Where(i =>
            {
                // ignore itself.
                if (i == _pivot)
                {
                    return(false);
                }
                // ignore member.
                if (_pivot.HeadOf(i))
                {
                    return(false);
                }
                if (_pivot.DoAll(ele => ele.HasDescendents(i)))
                {
                    return(false);
                }
                // ignore ancestor
                if (_pivot.IsDescendents(i))
                {
                    return(false);
                }
                return(true);
            }).ToList();

            //prioritize for middle->bottom->above
            Watch(interactSet);
            // current is stateless, we revert the change of previous state.
            if (_currentState.Stateless())
            {
                _previousState.InteractShape?.DoAll(i => i.Redo());
                _previousParentShape?.UpdateMiddleSpace();
                _previousParentShape = null;
                var prev = _pivot.Prev;
                _pivot.RemoveHead();
                _pivot.DoAll(i => i.Alone());
                prev?.DoInverseAll(i => i.VirtualHeight = i.ReCalculateVirtualHeight());
                _currentParentShape = null;
            }

            if (_currentState.InteractDirection != State.ShapeState.Middle)
            {
                _previousParentShape?.UpdateMiddleSpace();
            }

            // interact with control block
            if (!_currentState.Stateless() && _currentState.InteractDirection == State.ShapeState.Middle)
            {
                if (_currentState.InteractShape != _previousParentShape)
                {
                    _previousParentShape?.UpdateMiddleSpace();
                }
                _currentParentShape = _currentState.InteractShape;
                interactSet         = _currentParentShape.ChildrenNode.ToList();
                _currentParentShape.Expand(_pivot.Height + 8.8);
                _previousParentShape = _currentParentShape;
                Watch(interactSet);
            }
            ProcessInLinear();
        }