Exemplo n.º 1
0
        internal protected override bool PartialHitTest(ref HitTestArgs args)
        {
            if (Widget == null)
            {
                return(false);
            }
            var plane    = GetPlane();
            var ray      = args.Ray;
            var distance = ray.Intersects(plane);

            if (distance.HasValue && distance <= args.Distance)
            {
                var oldPoint = args.Point;
                try {
                    args.Point = (Vector2)GlobalTransform.CalcInverted().TransformVector(ray.Position + ray.Direction * distance.Value) * new Vector2(1, -1);
                    Widget.RenderChainBuilder?.AddToRenderChain(renderChain);
                    if (renderChain.HitTest(ref args))
                    {
                        args.Distance = distance.Value;
                        return(true);
                    }
                } finally {
                    args.Point = oldPoint;
                    renderChain.Clear();
                }
            }
            return(false);
        }