예제 #1
0
        public override SnapResult FindSnappedPositionAndTime(Vector2 screenSpacePosition)
        {
            var result = base.FindSnappedPositionAndTime(screenSpacePosition);

            result.ScreenSpacePosition.X = screenSpacePosition.X;

            if (distanceSnapGrid.IsPresent && distanceSnapGrid.GetSnappedPosition(result.ScreenSpacePosition) is SnapResult snapResult &&
                Vector2.Distance(snapResult.ScreenSpacePosition, result.ScreenSpacePosition) < distance_snap_radius)
            {
                result = snapResult;
            }

            return(result);
        }
예제 #2
0
        public override SnapResult FindSnappedPositionAndTime(Vector2 screenSpacePosition, SnapType snapType = SnapType.All)
        {
            var result = base.FindSnappedPositionAndTime(screenSpacePosition, snapType);

            result.ScreenSpacePosition.X = screenSpacePosition.X;

            if (snapType.HasFlagFast(SnapType.Grids))
            {
                if (distanceSnapGrid.IsPresent && distanceSnapGrid.GetSnappedPosition(result.ScreenSpacePosition) is SnapResult snapResult &&
                    Vector2.Distance(snapResult.ScreenSpacePosition, result.ScreenSpacePosition) < distance_snap_radius)
                {
                    result = snapResult;
                }
            }

            return(result);
        }