@ericchen1990/pano-view 3.0.0 → 3.1.0

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/README.md CHANGED
@@ -143,6 +143,9 @@ export function ControlledExample() {
143
143
  <button onClick={() => viewer.setView({ yaw: 90, fov: 55 })}>
144
144
  Look right
145
145
  </button>
146
+ <button onClick={() => void viewer.lookTo({ yaw: -45, pitch: 8 })}>
147
+ Animate left
148
+ </button>
146
149
  <PanoViewer
147
150
  ref={viewer.ref}
148
151
  controls={{
@@ -166,7 +169,27 @@ export function ControlledExample() {
166
169
 
167
170
  The handle exposes view, fullscreen, scene, VR, video, and background-audio controls so custom UIs can drive the viewer from a single ref:
168
171
 
169
- **View** — `getView`, `setView`, `reset`.
172
+ **View** — `getView`, `setView`, `reset`, `lookTo`, `moveTo`, `zoomTo`, `lookToHotspot`.
173
+
174
+ `setView` and `reset` remain immediate. The navigation methods return a Promise
175
+ with `{ status: "completed" | "cancelled" | "not-found" }`; each new navigation
176
+ or user interaction cancels the previous one. They default to 700 ms with
177
+ `easeInOutCubic` and take the shortest yaw path. `lookTo` and `lookToHotspot`
178
+ preserve the current FOV unless `fov` is provided.
179
+
180
+ ```tsx
181
+ const result = await viewer.lookToHotspot("visitor-guide", { fov: 55 });
182
+
183
+ if (result.status === "not-found") {
184
+ // The hotspot is not mounted in this PanoViewer.
185
+ }
186
+
187
+ await viewer.moveTo({ yaw: 170, pitch: 0 }, { shortestPath: false });
188
+ await viewer.zoomTo(48, { duration: 400, easing: "linear" });
189
+ ```
190
+
191
+ Every mounted hotspot type can be targeted, including polygons and polylines,
192
+ which use their spherical center. Hotspot ids must be unique within a viewer.
170
193
 
171
194
  **Fullscreen** — `enterFullscreen`, `exitFullscreen`, `toggleFullscreen`, `isFullscreen`.
172
195
 
package/README.zh-CN.md CHANGED
@@ -126,6 +126,9 @@ export function ControlledExample() {
126
126
  <button onClick={() => viewer.setView({ yaw: 90, fov: 55 })}>
127
127
  Look right
128
128
  </button>
129
+ <button onClick={() => void viewer.lookTo({ yaw: -45, pitch: 8 })}>
130
+ Animate left
131
+ </button>
129
132
  <PanoViewer
130
133
  ref={viewer.ref}
131
134
  controls={{
@@ -149,7 +152,25 @@ export function ControlledExample() {
149
152
 
150
153
  句柄从单个 `ref` 暴露视图、全屏、场景、VR、视频与背景音乐控制,方便宿主自绘 UI:
151
154
 
152
- **视图** — `getView`、`setView`、`reset`。
155
+ **视图** — `getView`、`setView`、`reset`、`lookTo`、`moveTo`、`zoomTo`、`lookToHotspot`。
156
+
157
+ `setView` 与 `reset` 仍立即生效。导航方法返回
158
+ `Promise<{ status: "completed" | "cancelled" | "not-found" }>`;新的导航或用户操作会取消前一个导航。默认时长为 700ms,缓动为
159
+ `easeInOutCubic`,YAW 默认走最短路径。`lookTo` 与 `lookToHotspot`
160
+ 未传 `fov` 时保持当前 FOV。
161
+
162
+ ```tsx
163
+ const result = await viewer.lookToHotspot("visitor-guide", { fov: 55 });
164
+
165
+ if (result.status === "not-found") {
166
+ // 该热点尚未挂载在这个 PanoViewer 中。
167
+ }
168
+
169
+ await viewer.moveTo({ yaw: 170, pitch: 0 }, { shortestPath: false });
170
+ await viewer.zoomTo(48, { duration: 400, easing: "linear" });
171
+ ```
172
+
173
+ 所有已挂载热点都可作为目标,包括使用球面中心点的多边形与折线。每个 viewer 内的热点 `id` 必须唯一。
153
174
 
154
175
  **全屏** — `enterFullscreen`、`exitFullscreen`、`toggleFullscreen`、`isFullscreen`。
155
176