日本語翻訳ドキュメントはサポートを終了しました

MRTK 2.6 以降のドキュメントについては、公式の Microsoft ドキュメント を参照してください。

    Show / Hide Table of Contents

    Class CanvasExtensions

    Extensions for the Canvas class.

    Inheritance
    Object
    CanvasExtensions
    Inherited Members
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: Microsoft.MixedReality.Toolkit
    Assembly: cs.temp.dll.dll
    Syntax
    public static class CanvasExtensions

    Methods

    GetChildRectTransformAtPoint(RectTransform, Vector3, Boolean, Boolean, Boolean)

    Gets a child rect transform for the given point and parameters.

    Declaration
    public static RectTransform GetChildRectTransformAtPoint(this RectTransform rectTransformParent, Vector3 worldPoint, bool recursive, bool shouldReturnActive, bool shouldReturnRaycastable)
    Parameters
    Type Name Description
    RectTransform rectTransformParent

    The rect transform to look for children that may contain the projected (orthogonal to the child's normal) world point

    Vector3 worldPoint

    The world point

    Boolean recursive

    Indicates if the check should be done recursively

    Boolean shouldReturnActive

    If true, will only check children that are active, otherwise it will check all children.

    Boolean shouldReturnRaycastable

    If true, will only check children that if they have a graphic and have its member raycastTarget set to true, otherwise will ignore the raycastTarget value. Will still allow children to be checked that do not have a graphic component.

    Returns
    Type Description
    RectTransform

    GetLocalCorners(Canvas)

    Convenience method for getting the corners of the canvas in local coordinates. Ordered clockwise from bottom-left.

    Declaration
    public static Vector3[] GetLocalCorners(this Canvas canvas)
    Parameters
    Type Name Description
    Canvas canvas

    The canvas to get the local corners from.

    Returns
    Type Description
    Vector3[]

    An array of Vector3s that represent the corners of the canvas in local coordinates.

    GetPlane(Canvas)

    Convenience method for getting a plane for this canvas in world coordinates.

    Declaration
    public static Plane GetPlane(this Canvas canvas)
    Parameters
    Type Name Description
    Canvas canvas

    The canvas to get the plane from.

    Returns
    Type Description
    Plane

    A Plane for this canvas.

    GetScreenCorners(Canvas)

    Gets the position of the corners for a canvas in screen space. 1 -- 2 | | 0 -- 3

    Declaration
    public static Vector3[] GetScreenCorners(this Canvas canvas)
    Parameters
    Type Name Description
    Canvas canvas

    The canvas to get the screen corners for.

    Returns
    Type Description
    Vector3[]

    GetScreenRect(Canvas)

    Returns a rectangle in screen coordinates that encompasses the bounds of the target canvas.

    Declaration
    public static Rect GetScreenRect(this Canvas canvas)
    Parameters
    Type Name Description
    Canvas canvas

    The canvas the get the screen rect for

    Returns
    Type Description
    Rect

    GetViewportCorners(Canvas)

    Convenience method for getting the corners of the canvas in viewport coordinates. Note that the points have the same ordering as the array returned in GetWorldCorners()

    Declaration
    public static Vector3[] GetViewportCorners(this Canvas canvas)
    Parameters
    Type Name Description
    Canvas canvas

    The canvas to get the viewport corners from

    Returns
    Type Description
    Vector3[]

    An array of Vector3s that represent the corners of the canvas in viewport coordinates

    GetWorldCorners(Canvas)

    Convenience method for getting the corners of the canvas in world coordinates. Ordered clockwise from bottom-left.

    Declaration
    public static Vector3[] GetWorldCorners(this Canvas canvas)
    Parameters
    Type Name Description
    Canvas canvas

    The canvas to get the world corners from.

    Returns
    Type Description
    Vector3[]

    An array of Vector3s that represent the corners of the canvas in world coordinates.

    Raycast(Canvas, Vector3, Vector3, out Single, out Vector3, out GameObject)

    Raycast against a canvas using a ray.

    Declaration
    public static bool Raycast(this Canvas canvas, Vector3 rayOrigin, Vector3 rayDirection, out float distance, out Vector3 hitPoint, out GameObject hitChildObject)
    Parameters
    Type Name Description
    Canvas canvas

    The canvas to raycast against

    Vector3 rayOrigin

    The origin of the ray

    Vector3 rayDirection

    The direction of the ray

    Single distance

    The distance of the ray

    Vector3 hitPoint

    The hitpoint of the ray

    GameObject hitChildObject

    The child object that was hit or the canvas itself if it has no active children that were within the hit range.

    Returns
    Type Description
    Boolean
    Back to top Generated by DocFX