Skip to content

ChartPointer

StructChartGuruChartGuru
public readonly struct ChartPointer

One pointer event in the host-neutral form every chart host feeds to its ChartInteractionController. Hosts translate uGUI, UI Toolkit or custom input into this stream, so the runtime never reads an input API.

ChartPointer.Position is in the host's surface pixels with a bottom-left origin: chart pixels for 2D hosts and screen pixels for 3D charts in the world. ChartPointer.Ray is the world ray through the pointer when the host has one; 3D hit testing uses it.

ChartPointer(int, ChartPointerPhase, Vector2, float, float)

Section titled “ChartPointer(int, ChartPointerPhase, Vector2, float, float)”
public ChartPointer(int id, ChartPointerPhase phase, Vector2 position, float timestamp, float scrollDelta = 0)

Creates a pointer event without a world ray.

Parameters

Name Type
id System.Int32
phase ChartGuru.ChartPointerPhase
position UnityEngine.Vector2
timestamp System.Single
scrollDelta System.Single

ChartPointer(int, ChartPointerPhase, Vector2, Ray, float, float)

Section titled “ChartPointer(int, ChartPointerPhase, Vector2, Ray, float, float)”
public ChartPointer(int id, ChartPointerPhase phase, Vector2 position, Ray ray, float timestamp, float scrollDelta = 0)

Creates a pointer event with the world ray through the pointer.

Parameters

Name Type
id System.Int32
phase ChartGuru.ChartPointerPhase
position UnityEngine.Vector2
ray UnityEngine.Ray
timestamp System.Single
scrollDelta System.Single

public int Id { get; }

Identifies the mouse, finger or pen, so two fingers can pinch.

Returns

System.Int32

public ChartPointerPhase Phase { get; }

What happened to the pointer.

Returns

ChartGuru.ChartPointerPhase

public Vector2 Position { get; }

Pointer position in the host's surface pixels with a bottom-left origin.

Returns

UnityEngine.Vector2

public Ray Ray { get; }

World ray through the pointer; valid when ChartPointer.HasRay is true.

Returns

UnityEngine.Ray

public bool HasRay { get; }

True when the host supplied a world ray, as 3D hosts do.

Returns

System.Boolean

public float ScrollDelta { get; }

Scroll amount for ChartPointerPhase.Scroll; positive scrolls up, which zooms in.

Returns

System.Single

public float Timestamp { get; }

Event time in seconds, used to tell taps, double taps and long presses apart.

Returns

System.Single

public static float Now { get; }

Clock used by the built-in hosts for ChartPointer.Timestamp; it also runs in Edit Mode.

Returns

System.Single