@retor/react-native 0.5.1 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -36,6 +36,13 @@ interface RetorTag {
36
36
  * tag's position. Positive = uphill, negative = downhill. Same calculation as
37
37
  * `LineProgressPayload.pitchDeg`. Null if not georeferenced. */
38
38
  pitchDeg?: number | null;
39
+ /** Monotonic HORIZONTAL distance (meters, ENU east/north plane) from the line start to
40
+ * this tag. Use this — not `distanceFromStart` — when feeding into Naismith / Tobler
41
+ * walking-time models so vertical travel isn't double-counted. */
42
+ cumulativeHorizontalM?: number | null;
43
+ /** Monotonic sum of POSITIVE elevation deltas (meters) from the line start to this tag.
44
+ * Descents are ignored, so this is the "elevation gain" used by walking-time models. */
45
+ cumulativeElevationGainM?: number | null;
39
46
  }
40
47
  interface RetorLine {
41
48
  _id: string;
@@ -92,6 +99,10 @@ interface LineProgressPayload {
92
99
  sectionIndex?: number | null;
93
100
  /** 0..1 progress of the cursor within the current section. */
94
101
  sectionProgress?: number | null;
102
+ /** Monotonic HORIZONTAL distance (meters) from line start to the cursor. */
103
+ cumulativeHorizontalM?: number | null;
104
+ /** Monotonic sum of positive elevation deltas (meters) from line start to the cursor. */
105
+ cumulativeElevationGainM?: number | null;
95
106
  }
96
107
  interface ViewerHandle {
97
108
  openLine: (lineId: string) => void;
@@ -180,6 +191,8 @@ declare function useLineProgress(): {
180
191
  sectionLengthM: number | null;
181
192
  sectionIndex: number | null;
182
193
  sectionProgress: number | null;
194
+ cumulativeHorizontalM: number | null;
195
+ cumulativeElevationGainM: number | null;
183
196
  };
184
197
  /**
185
198
  * Returns the autoplay state and controls.
package/dist/index.d.ts CHANGED
@@ -36,6 +36,13 @@ interface RetorTag {
36
36
  * tag's position. Positive = uphill, negative = downhill. Same calculation as
37
37
  * `LineProgressPayload.pitchDeg`. Null if not georeferenced. */
38
38
  pitchDeg?: number | null;
39
+ /** Monotonic HORIZONTAL distance (meters, ENU east/north plane) from the line start to
40
+ * this tag. Use this — not `distanceFromStart` — when feeding into Naismith / Tobler
41
+ * walking-time models so vertical travel isn't double-counted. */
42
+ cumulativeHorizontalM?: number | null;
43
+ /** Monotonic sum of POSITIVE elevation deltas (meters) from the line start to this tag.
44
+ * Descents are ignored, so this is the "elevation gain" used by walking-time models. */
45
+ cumulativeElevationGainM?: number | null;
39
46
  }
40
47
  interface RetorLine {
41
48
  _id: string;
@@ -92,6 +99,10 @@ interface LineProgressPayload {
92
99
  sectionIndex?: number | null;
93
100
  /** 0..1 progress of the cursor within the current section. */
94
101
  sectionProgress?: number | null;
102
+ /** Monotonic HORIZONTAL distance (meters) from line start to the cursor. */
103
+ cumulativeHorizontalM?: number | null;
104
+ /** Monotonic sum of positive elevation deltas (meters) from line start to the cursor. */
105
+ cumulativeElevationGainM?: number | null;
95
106
  }
96
107
  interface ViewerHandle {
97
108
  openLine: (lineId: string) => void;
@@ -180,6 +191,8 @@ declare function useLineProgress(): {
180
191
  sectionLengthM: number | null;
181
192
  sectionIndex: number | null;
182
193
  sectionProgress: number | null;
194
+ cumulativeHorizontalM: number | null;
195
+ cumulativeElevationGainM: number | null;
183
196
  };
184
197
  /**
185
198
  * Returns the autoplay state and controls.
package/dist/index.js CHANGED
@@ -67,6 +67,8 @@ var RetorProgressContext = (0, import_react.createContext)({
67
67
  sectionLengthM: null,
68
68
  sectionIndex: null,
69
69
  sectionProgress: null,
70
+ cumulativeHorizontalM: null,
71
+ cumulativeElevationGainM: null,
70
72
  isPlaying: false
71
73
  });
72
74
  function noop() {
@@ -123,7 +125,9 @@ function useLineProgress() {
123
125
  elevationGainM,
124
126
  sectionLengthM,
125
127
  sectionIndex,
126
- sectionProgress
128
+ sectionProgress,
129
+ cumulativeHorizontalM,
130
+ cumulativeElevationGainM
127
131
  } = useRetorProgress();
128
132
  return (0, import_react.useMemo)(
129
133
  () => ({
@@ -138,7 +142,9 @@ function useLineProgress() {
138
142
  elevationGainM,
139
143
  sectionLengthM,
140
144
  sectionIndex,
141
- sectionProgress
145
+ sectionProgress,
146
+ cumulativeHorizontalM,
147
+ cumulativeElevationGainM
142
148
  }),
143
149
  [
144
150
  progress,
@@ -152,7 +158,9 @@ function useLineProgress() {
152
158
  elevationGainM,
153
159
  sectionLengthM,
154
160
  sectionIndex,
155
- sectionProgress
161
+ sectionProgress,
162
+ cumulativeHorizontalM,
163
+ cumulativeElevationGainM
156
164
  ]
157
165
  );
158
166
  }
@@ -273,6 +281,8 @@ var Viewer = (0, import_react2.forwardRef)(function Viewer2({ projectId, id = "d
273
281
  const [sectionLengthM, setSectionLengthM] = (0, import_react2.useState)(null);
274
282
  const [sectionIndex, setSectionIndex] = (0, import_react2.useState)(null);
275
283
  const [sectionProgress, setSectionProgress] = (0, import_react2.useState)(null);
284
+ const [cumulativeHorizontalM, setCumulativeHorizontalM] = (0, import_react2.useState)(null);
285
+ const [cumulativeElevationGainM, setCumulativeElevationGainM] = (0, import_react2.useState)(null);
276
286
  const [isPlaying, setIsPlaying] = (0, import_react2.useState)(false);
277
287
  const [isAddNoteOpen, setIsAddNoteOpen] = (0, import_react2.useState)(false);
278
288
  const [addNoteTagId, setAddNoteTagId] = (0, import_react2.useState)(null);
@@ -429,6 +439,8 @@ var Viewer = (0, import_react2.forwardRef)(function Viewer2({ projectId, id = "d
429
439
  setSectionLengthM(payload.sectionLengthM ?? null);
430
440
  setSectionIndex(payload.sectionIndex ?? null);
431
441
  setSectionProgress(payload.sectionProgress ?? null);
442
+ setCumulativeHorizontalM(payload.cumulativeHorizontalM ?? null);
443
+ setCumulativeElevationGainM(payload.cumulativeElevationGainM ?? null);
432
444
  onLineProgress?.(payload);
433
445
  break;
434
446
  }
@@ -489,6 +501,8 @@ var Viewer = (0, import_react2.forwardRef)(function Viewer2({ projectId, id = "d
489
501
  sectionLengthM,
490
502
  sectionIndex,
491
503
  sectionProgress,
504
+ cumulativeHorizontalM,
505
+ cumulativeElevationGainM,
492
506
  isPlaying
493
507
  }),
494
508
  [
@@ -504,6 +518,8 @@ var Viewer = (0, import_react2.forwardRef)(function Viewer2({ projectId, id = "d
504
518
  sectionLengthM,
505
519
  sectionIndex,
506
520
  sectionProgress,
521
+ cumulativeHorizontalM,
522
+ cumulativeElevationGainM,
507
523
  isPlaying
508
524
  ]
509
525
  );
package/dist/index.mjs CHANGED
@@ -14,6 +14,8 @@ var RetorProgressContext = createContext({
14
14
  sectionLengthM: null,
15
15
  sectionIndex: null,
16
16
  sectionProgress: null,
17
+ cumulativeHorizontalM: null,
18
+ cumulativeElevationGainM: null,
17
19
  isPlaying: false
18
20
  });
19
21
  function noop() {
@@ -70,7 +72,9 @@ function useLineProgress() {
70
72
  elevationGainM,
71
73
  sectionLengthM,
72
74
  sectionIndex,
73
- sectionProgress
75
+ sectionProgress,
76
+ cumulativeHorizontalM,
77
+ cumulativeElevationGainM
74
78
  } = useRetorProgress();
75
79
  return useMemo(
76
80
  () => ({
@@ -85,7 +89,9 @@ function useLineProgress() {
85
89
  elevationGainM,
86
90
  sectionLengthM,
87
91
  sectionIndex,
88
- sectionProgress
92
+ sectionProgress,
93
+ cumulativeHorizontalM,
94
+ cumulativeElevationGainM
89
95
  }),
90
96
  [
91
97
  progress,
@@ -99,7 +105,9 @@ function useLineProgress() {
99
105
  elevationGainM,
100
106
  sectionLengthM,
101
107
  sectionIndex,
102
- sectionProgress
108
+ sectionProgress,
109
+ cumulativeHorizontalM,
110
+ cumulativeElevationGainM
103
111
  ]
104
112
  );
105
113
  }
@@ -229,6 +237,8 @@ var Viewer = forwardRef(function Viewer2({ projectId, id = "default", baseUrl =
229
237
  const [sectionLengthM, setSectionLengthM] = useState(null);
230
238
  const [sectionIndex, setSectionIndex] = useState(null);
231
239
  const [sectionProgress, setSectionProgress] = useState(null);
240
+ const [cumulativeHorizontalM, setCumulativeHorizontalM] = useState(null);
241
+ const [cumulativeElevationGainM, setCumulativeElevationGainM] = useState(null);
232
242
  const [isPlaying, setIsPlaying] = useState(false);
233
243
  const [isAddNoteOpen, setIsAddNoteOpen] = useState(false);
234
244
  const [addNoteTagId, setAddNoteTagId] = useState(null);
@@ -385,6 +395,8 @@ var Viewer = forwardRef(function Viewer2({ projectId, id = "default", baseUrl =
385
395
  setSectionLengthM(payload.sectionLengthM ?? null);
386
396
  setSectionIndex(payload.sectionIndex ?? null);
387
397
  setSectionProgress(payload.sectionProgress ?? null);
398
+ setCumulativeHorizontalM(payload.cumulativeHorizontalM ?? null);
399
+ setCumulativeElevationGainM(payload.cumulativeElevationGainM ?? null);
388
400
  onLineProgress?.(payload);
389
401
  break;
390
402
  }
@@ -445,6 +457,8 @@ var Viewer = forwardRef(function Viewer2({ projectId, id = "default", baseUrl =
445
457
  sectionLengthM,
446
458
  sectionIndex,
447
459
  sectionProgress,
460
+ cumulativeHorizontalM,
461
+ cumulativeElevationGainM,
448
462
  isPlaying
449
463
  }),
450
464
  [
@@ -460,6 +474,8 @@ var Viewer = forwardRef(function Viewer2({ projectId, id = "default", baseUrl =
460
474
  sectionLengthM,
461
475
  sectionIndex,
462
476
  sectionProgress,
477
+ cumulativeHorizontalM,
478
+ cumulativeElevationGainM,
463
479
  isPlaying
464
480
  ]
465
481
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@retor/react-native",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "description": "React Native SDK for embedding Retor 3D experiences",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",