Пример #1
0
        public virtual float applyBoundaryConditions(ScrollMetrics position, float value)
        {
            if (parent == null)
            {
                return(0.0f);
            }

            return(parent.applyBoundaryConditions(position, value));
        }
Пример #2
0
        protected float applyBoundaryConditions(float value)
        {
            float result = physics.applyBoundaryConditions(this, value);

            D.assert(() => {
                float delta = value - pixels;
                if (result.abs() > delta.abs())
                {
                    throw new UIWidgetsError(
                        $"{physics.GetType()}.applyBoundaryConditions returned invalid overscroll value.\n" +
                        $"The method was called to consider a change from {pixels} to {value}, which is a " +
                        $"delta of {delta:F1} units. However, it returned an overscroll of " +
                        $"${result:F1} units, which has a greater magnitude than the delta. " +
                        "The applyBoundaryConditions method is only supposed to reduce the possible range " +
                        "of movement, not increase it.\n" +
                        $"The scroll extents are {minScrollExtent} .. {maxScrollExtent}, and the " +
                        $"viewport dimension is {viewportDimension}.");
                }

                return(true);
            });

            return(result);
        }