Returns the elapsed time, in milliseconds since the initial value
Returns the oldest value in the buffer
Last seen value. If no values have been added, it will return the initial value
Returns the total length of accumulated points. Returns 0 if points were not saved, or there's only one
Returns a polyline representation of stored points. Returns an empty array if points were not saved, or there's only one.
Returns a line from initial point to last point.
If there are less than two points, Lines.Empty is returned
Returns number of recorded values (includes the initial value in the count)
Returns a vector of the initial/last points of the tracker. Returns as a Cartesian coordinate
Returns a vector of the initial/last points of the tracker. Returns as a polar coordinate
Returns the last x coord
Returns the last y coord
Returns the last z coord (or undefined if not available)
Returns angle (in radians) from latest point to the initial point If there are less than two points, undefined is return.
Angle in radians
Tracks a point, returning data on its relation to the initial point and the last received point.
Use seenEvent to track a raw PointerEvent
.
Point
Returns distance from latest point to initial point. If there are less than two points, zero is returned.
This is the direct distance from initial to last, not the accumulated length.
Distance
Makes a 'mark' in the tracker, allowing you to compare values to this point.
Notification that buffer has been knocked down to sampleLimit
.
This will reset the initialRelation
, which will use the new oldest value.
Reset tracker
Adds a value, returning computed result.
At this point, we check if the buffer is larger than resetAfterSamples
. If so, reset()
is called.
If not, we check sampleLimit
. If the buffer is twice as large as sample limit, trimStore()
is
called to take it down to sample limit, and onTrimmed()
is called.
Adds a PointerEvent along with its coalesced events, if available.
Reduces size of value store to limit
.
Returns number of remaining items
Protected
debugReadonly
id
A tracked point. Mutable. Useful for monitoring how it changes over time. Eg. when a pointerdown event happens, to record the start position and then track the pointer as it moves until pointerup.
See also
Compute based on last seen point
Housekeeping
By default, the tracker only keeps track of the initial point and does not store intermediate 'seen' points. To use the tracker as a buffer, set
storeIntermediate
option to true.When using a buffer limited by
sampleLimit
, the 'initial' point will be the oldest in the buffer, not actually the very first point seen.