Ejemplo n.º 1
0
        /// <summary>
        /// set the movement range of the thumb for the vertical axis.
        ///
        /// The values specified here are relative to the parent window for the thumb, and are specified in whichever
        /// metrics mode is active for the widget.
        /// </summary>
        /// <param name="min">
        /// the minimum setting for the thumb on the vertical axis.
        /// </param>
        /// <param name="max">
        /// the maximum setting for the thumb on the vertical axis.
        /// </param>
        public void SetVertRange(float min, float max)
        {
            // ensure min <= max, swap if not.
            if (min > max)
            {
                var tmp = min;
                max = min;
                min = tmp;
            }

            _vertMax = max;
            _vertMin = min;

            // validate current position.
            var cp = CoordConverter.AsRelative(GetYPosition(), GetParentPixelSize().Height);

            if (cp < min)
            {
                SetYPosition(UDim.Relative(min));
            }
            else if (cp > max)
            {
                SetYPosition(UDim.Relative(max));
            }
        }