@ericchen1990/pano-view 3.1.0 → 3.1.1
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 +26 -3
- package/README.zh-CN.md +25 -3
- package/dist/index.cjs +385 -382
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +6 -7
- package/dist/index.d.ts +6 -7
- package/dist/index.mjs +340 -337
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +0 -34
- package/package.json +12 -3
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
Composable React components for equirectangular and krpano-style multiresolution panorama viewers.
|
|
6
6
|
|
|
7
|
-
Try the components in the [live playground](https://pano-view-playground.vercel.app
|
|
7
|
+
Try the components in the [live playground](https://pano-view-playground.vercel.app/?utm_source=github&utm_medium=readme&utm_campaign=package-readme&utm_content=playground).
|
|
8
8
|
|
|
9
9
|
## krpano-compatible tile output
|
|
10
10
|
|
|
@@ -72,6 +72,29 @@ Skip this import only if you do not use those overlays, or if you restyle
|
|
|
72
72
|
them entirely through `className`, `style`, and appearance props. Without
|
|
73
73
|
the stylesheet, the overlays still mount, but they render unstyled.
|
|
74
74
|
|
|
75
|
+
## Start with a panorama
|
|
76
|
+
|
|
77
|
+
Give PanoViewer an explicit size and render one panorama source inside it.
|
|
78
|
+
Import the stylesheet once when you use built-in HTML overlays such as video
|
|
79
|
+
controls, captions, tooltips, the context menu, or WebVR UI.
|
|
80
|
+
|
|
81
|
+
~~~tsx
|
|
82
|
+
import "@ericchen1990/pano-view/styles.css";
|
|
83
|
+
import { PanoViewer, Sphere } from "@ericchen1990/pano-view";
|
|
84
|
+
|
|
85
|
+
export function Panorama() {
|
|
86
|
+
return (
|
|
87
|
+
<PanoViewer style={{ height: 560 }}>
|
|
88
|
+
<Sphere src="/panoramas/room.webp" previewUrl="preview.webp" />
|
|
89
|
+
</PanoViewer>
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
~~~
|
|
93
|
+
|
|
94
|
+
For existing krpano tile pyramids, read the [migration
|
|
95
|
+
guide](../../docs/krpano-migration.md) before replacing Sphere with Tile. The
|
|
96
|
+
guide documents the XML-to-prop mapping and the relative-path rules.
|
|
97
|
+
|
|
75
98
|
## Exported components
|
|
76
99
|
|
|
77
100
|
### Viewer
|
|
@@ -203,7 +226,7 @@ which use their spherical center. Hotspot ids must be unique within a viewer.
|
|
|
203
226
|
|
|
204
227
|
### Mobile media activation
|
|
205
228
|
|
|
206
|
-
By default,
|
|
229
|
+
By default, when a child has an initial playback intent (`PanoVideo autoPlay`, an active `BackgroundAudio`, `VideoHotspot`, or `AudioHotspot`), the viewer silently unlocks audible playback on the first user gesture when the browser requires one, or immediately when autoplay policy already allows it. Muted video can still preview inline. The same gesture resumes Web Audio and gives the host the final choice of which media becomes audible, so video, music, and positional sound never all start by assumption. Pass `mediaActivation={false}` to retain the 2.x no-automatic-activation behavior.
|
|
207
230
|
|
|
208
231
|
```tsx
|
|
209
232
|
<PanoViewer
|
|
@@ -219,7 +242,7 @@ By default, the viewer shows a **Tap to enable sound** entry layer only when a c
|
|
|
219
242
|
</PanoViewer>
|
|
220
243
|
```
|
|
221
244
|
|
|
222
|
-
The `media` argument provides `resumeAudio()`, `playVideo({ unmute })`, and `playBackgroundAudio()`. Controlled background audio remains host-owned: update its `playing` state from this callback. `viewer.activateMedia()` lets a custom
|
|
245
|
+
The `media` argument provides `resumeAudio()`, `playVideo({ unmute })`, and `playBackgroundAudio()`. Controlled background audio remains host-owned: update its `playing` state from this callback. `viewer.activateMedia()` lets a custom control reuse the same path.
|
|
223
246
|
|
|
224
247
|
Methods that depend on an unmounted child component (e.g. `enterVR` without `<WebVR />`) are safe no-ops — they return `false`, `void`, or `null`.
|
|
225
248
|
|
package/README.zh-CN.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
用于等距圆柱(equirectangular)与 krpano 风格多分辨率全景查看器的可组合 React 组件。
|
|
6
6
|
|
|
7
|
-
在[在线 playground](https://pano-view-playground.vercel.app
|
|
7
|
+
在[在线 playground](https://pano-view-playground.vercel.app/?utm_source=github&utm_medium=readme&utm_campaign=package-readme&utm_content=playground) 中试用这些组件。
|
|
8
8
|
|
|
9
9
|
## 兼容 krpano 的 tile 输出
|
|
10
10
|
|
|
@@ -55,6 +55,28 @@ import "@ericchen1990/pano-view/styles.css";
|
|
|
55
55
|
|
|
56
56
|
仅当你不使用这些叠加层,或完全通过 `className`、`style` 与外观属性重设样式时,可跳过该导入。若不导入样式表,叠加层仍会挂载,但会无样式显示。
|
|
57
57
|
|
|
58
|
+
## 快速渲染一个全景图
|
|
59
|
+
|
|
60
|
+
为 PanoViewer 提供明确尺寸,并在其内部渲染一个全景源。使用内置 HTML 叠加层
|
|
61
|
+
(例如视频控件、字幕、tooltip、右键菜单或 WebVR UI)时,需导入一次样式表。
|
|
62
|
+
|
|
63
|
+
~~~tsx
|
|
64
|
+
import "@ericchen1990/pano-view/styles.css";
|
|
65
|
+
import { PanoViewer, Sphere } from "@ericchen1990/pano-view";
|
|
66
|
+
|
|
67
|
+
export function Panorama() {
|
|
68
|
+
return (
|
|
69
|
+
<PanoViewer style={{ height: 560 }}>
|
|
70
|
+
<Sphere src="/panoramas/room.webp" previewUrl="preview.webp" />
|
|
71
|
+
</PanoViewer>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
~~~
|
|
75
|
+
|
|
76
|
+
如需复用现有 krpano tile 金字塔,请在将 Sphere 换成 Tile 前阅读
|
|
77
|
+
[迁移指南](../../docs/krpano-migration.zh-CN.md)。指南说明 XML 到 prop 的映射与
|
|
78
|
+
相对路径规则。
|
|
79
|
+
|
|
58
80
|
## 导出组件
|
|
59
81
|
|
|
60
82
|
### 查看器
|
|
@@ -184,7 +206,7 @@ await viewer.zoomTo(48, { duration: 400, easing: "linear" });
|
|
|
184
206
|
|
|
185
207
|
### 移动端媒体激活
|
|
186
208
|
|
|
187
|
-
默认情况下,只要子组件带有初始播放意图(`PanoVideo autoPlay`、播放中的 `BackgroundAudio`、`VideoHotspot` 或 `AudioHotspot
|
|
209
|
+
默认情况下,只要子组件带有初始播放意图(`PanoVideo autoPlay`、播放中的 `BackgroundAudio`、`VideoHotspot` 或 `AudioHotspot`),查看器会在浏览器需要用户手势时于首次交互静默解锁有声播放;若自动播放策略已允许,则立即激活。静音视频仍会内联预览;激活在同一用户手势内恢复 Web Audio,再把播放选择交给宿主,避免视频、BGM 与定点声同时出声。传 `mediaActivation={false}` 可保留 2.x 的无自动激活行为。
|
|
188
210
|
|
|
189
211
|
```tsx
|
|
190
212
|
<PanoViewer
|
|
@@ -200,7 +222,7 @@ await viewer.zoomTo(48, { duration: 400, easing: "linear" });
|
|
|
200
222
|
</PanoViewer>
|
|
201
223
|
```
|
|
202
224
|
|
|
203
|
-
`onActivate` 的 `media` 提供 `resumeAudio()`、`playVideo({ unmute })` 和 `playBackgroundAudio()`。背景音乐若使用受控 `playing`,仍由宿主在回调内更新该状态;`viewer.activateMedia()`
|
|
225
|
+
`onActivate` 的 `media` 提供 `resumeAudio()`、`playVideo({ unmute })` 和 `playBackgroundAudio()`。背景音乐若使用受控 `playing`,仍由宿主在回调内更新该状态;`viewer.activateMedia()` 可供自定义控件复用同一流程。
|
|
204
226
|
|
|
205
227
|
依赖未挂载子组件的方法(如无 `<WebVR />` 时调 `enterVR`)安全空操作,返回 `false`、`void` 或 `null`。
|
|
206
228
|
|