コード例 #1
0
ファイル: slider.cs プロジェクト: moto2002/UIWidgets
        void _paintTickMarks(
            Canvas canvas,
            Rect trackLeft,
            Rect trackRight,
            Paint leftPaint,
            Paint rightPaint)
        {
            if (this.isDiscrete)
            {
                const float tickRadius = _trackHeight / 2.0f;
                float       trackWidth = trackRight.right - trackLeft.left;
                float       dx         = (trackWidth - _trackHeight) / this.divisions.Value;

                if (dx >= 3.0 * _trackHeight)
                {
                    for (int i = 0; i <= this.divisions.Value; i += 1)
                    {
                        float  left   = trackLeft.left + i * dx;
                        Offset center = new Offset(left + tickRadius, trackLeft.top + tickRadius);
                        if (trackLeft.contains(center))
                        {
                            canvas.drawCircle(center, tickRadius, leftPaint);
                        }
                        else if (trackRight.contains(center))
                        {
                            canvas.drawCircle(center, tickRadius, rightPaint);
                        }
                    }
                }
            }
        }
コード例 #2
0
        public bool?hitTest(Offset position)
        {
            if (_thumbRect == null)
            {
                return(null);
            }

            if (fadeoutOpacityAnimation.value == 0.0f)
            {
                return(false);
            }

            return(_thumbRect.contains(position));
        }
コード例 #3
0
        public bool hitTestInteractive(Offset position)
        {
            if (_thumbRect == null)
            {
                return(false);
            }

            if (fadeoutOpacityAnimation.value == 0.0f)
            {
                return(false);
            }
            Rect interactiveThumbRect = _thumbRect.expandToInclude(
                Rect.fromCircle(center: _thumbRect.center, radius: ScrollbarPainterUtils._kMinInteractiveSize / 2)
                );

            return(interactiveThumbRect.contains(position));
        }