Пример #1
0
        /// <summary>
        /// Called every frame after update.
        /// DropDown entity override this function to close the list if necessary and to remove the selected item panel from self.
        /// </summary>
        /// <param name="input">Input helper instance.</param>
        override protected void DoAfterUpdate(InputHelper input)
        {
            // if list currently visible we want to check if we need to close it
            if (_isListVisible)
            {
                // first calculate dest rect
                _destRect = CalcDestRect();

                // temporarily set to use dest rect and not actual dest rect
                bool prevUseActualSizeForCollision = UseActualSizeForCollision;
                UseActualSizeForCollision = false;

                // check if mouse down and not inside list
                if (input.AnyMouseButtonDown() && !IsInsideEntity(input.MousePosition))
                {
                    _isListVisible = false;
                }

                // return use actual rect state back to normal
                UseActualSizeForCollision = prevUseActualSizeForCollision;
            }

            // remove selection panel from self
            if (_selectedTextPanel.Parent != null)
            {
                RemoveChild(_selectedTextPanel);
            }

            // call base do-before-update
            base.DoAfterUpdate(input);
        }
Пример #2
0
        /// <summary>
        /// Called every frame after update.
        /// DropDown entity override this function to close the list if necessary and to remove the selected item panel from self.
        /// </summary>
        /// <param name="input">Input helper instance.</param>
        override protected void DoAfterUpdate(InputHelper input)
        {
            // if list currently visible we want to check if we need to close it
            if (ListVisible)
            {
                // check if mouse down and not inside list
                if (input.AnyMouseButtonDown() && !IsInsideEntity(input.MousePosition))
                {
                    if (!IsInsideEntity(input.MousePosition))
                    {
                        ListVisible = false;
                    }
                }
            }

            // call base do-before-update
            base.DoAfterUpdate(input);
        }