Explorar el Código

Update docs

customisations
alemart hace 8 meses
padre
commit
897be48206
Se han modificado 2 ficheros con 14 adiciones y 3 borrados
  1. 6
    2
      docs/api/pointer-tracker.md
  2. 8
    1
      src/trackers/pointer-tracker/pointer-tracker.ts

+ 6
- 2
docs/api/pointer-tracker.md Ver fichero

@@ -24,7 +24,7 @@ A new `PointerTracker`.
24 24
 **Example**
25 25
 
26 26
 ```js
27
-// Use default settings
27
+// Use the default settings
28 28
 const pointerTracker = AR.Tracker.Pointer();
29 29
 
30 30
 // Track pointers in adjusted space
@@ -47,10 +47,14 @@ The space in which pointers are located. You may set it when instantiating the t
47 47
 
48 48
 - In `"normalized"` space, pointers are located in [-1,1]x[-1,1]. The origin of the space is at the center of the [viewport](viewport.md). The x-axis points to the right and the y-axis points up. This is the default space.
49 49
 
50
+    - Point (0,0) is at the center of the viewport
51
+    - The top-right corner of the viewport is at (+1,+1)
52
+    - The bottom-left corner of the viewport is at (-1,-1)
53
+
50 54
 - The `"adjusted"` space is similar to the normalized space, except that it is scaled so that it matches the [aspect ratio](viewport.md#aspectratio) of the viewport.
51 55
 
52 56
     Pointers in adjusted space are contained in normalized space, but unless the viewport is a square, one of their coordinates, x or y, will no longer range from -1 to +1. It will range from *-s* to *+s*, where *s = min(a, 1/a)*. In this expression, *a* is the aspect ratio of the viewport and *s* is less than or equal to 1.
53 57
 
54 58
     Selecting the adjusted space is useful for making sure that pointer speeds are equivalent in both axes and for preserving movement curves. Speeds are not equivalent and movement curves are not preserved by default because the normalized space is a square, whereas the viewport is a rectangle.
55 59
 
56
-    In summary: prefer the adjusted space when tracking movements.
60
+    In summary, prefer the adjusted space when working with velocities and movement curves.

+ 8
- 1
src/trackers/pointer-tracker/pointer-tracker.ts Ver fichero

@@ -59,6 +59,10 @@ export interface PointerTrackerOutput extends TrackerOutput
59 59
  *   of the space is at the center of the viewport. The x-axis points to the
60 60
  *   right and the y-axis points up. This is the default space.
61 61
  *
62
+ *   - Point (0,0) is at the center of the viewport
63
+ *   - The top-right corner of the viewport is at (+1,+1)
64
+ *   - The bottom-left corner of the viewport is at (-1,-1)
65
+ *
62 66
  * - The "adjusted" space is similar to the normalized space, except that it is
63 67
  *   scaled so that it matches the aspect ratio of the viewport.
64 68
  *
@@ -72,8 +76,11 @@ export interface PointerTrackerOutput extends TrackerOutput
72 76
  *   are equivalent in both axes and for preserving movement curves. Speeds are
73 77
  *   not equivalent and movement curves are not preserved by default because
74 78
  *   the normalized space is a square, whereas the viewport is a rectangle.
79
+ *
80
+ *   In summary, prefer the adjusted space when working with velocities and
81
+ *   movement curves.
75 82
  */
76
-export type PointerSpace = 'normalized' | 'adjusted'; // | 'viewport';
83
+export type PointerSpace = 'normalized' | 'adjusted';
77 84
 
78 85
 /**
79 86
  * Options for instantiating a PointerTracker

Loading…
Cancelar
Guardar