@ericchen1990/pano-view 3.2.3 → 3.3.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 +35 -3
- package/README.zh-CN.md +33 -3
- package/dist/index.cjs +211 -173
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +10 -2
- package/dist/index.d.ts +10 -2
- package/dist/index.mjs +170 -132
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -702,7 +702,7 @@ a single non-stereo cube panorama.
|
|
|
702
702
|
|
|
703
703
|
## Scenes
|
|
704
704
|
|
|
705
|
-
`Scenes` switches controlled sphere and
|
|
705
|
+
`Scenes` switches controlled sphere, cube-tile, and equirectangular-tile scenes with GPU-only
|
|
706
706
|
snapshot blending. The target scene loads its sphere or tile preview first;
|
|
707
707
|
once ready, the current framebuffer becomes a temporary GPU texture, its source
|
|
708
708
|
textures are released, and the target scene blends in. This avoids holding two
|
|
@@ -1834,8 +1834,40 @@ if the preview failed. `onPreviewError`, `onTileError`, `onLoadProgress`, and
|
|
|
1834
1834
|
`onLevelChange` expose failures/progress; levels in callbacks start at 0.
|
|
1835
1835
|
Unmounting disposes owned textures and ignores late results.
|
|
1836
1836
|
|
|
1837
|
-
Use `SphereTile` directly as a `PanoViewer` child
|
|
1838
|
-
`
|
|
1837
|
+
Use `SphereTile` directly as a `PanoViewer` child, or define a `SphereTileScene`
|
|
1838
|
+
with `type: "sphereTile"` inside `Scenes`. All transition presets, including
|
|
1839
|
+
`dissolve`, work across `sphere`, cube `tile`, and `sphereTile` scenes:
|
|
1840
|
+
|
|
1841
|
+
```tsx
|
|
1842
|
+
import { Scenes, type Scene } from "@ericchen1990/pano-view";
|
|
1843
|
+
|
|
1844
|
+
const scenes: Scene[] = [
|
|
1845
|
+
{
|
|
1846
|
+
id: "courtyard",
|
|
1847
|
+
type: "sphereTile",
|
|
1848
|
+
baseUrl: "/panoramas/courtyard/",
|
|
1849
|
+
multires: "512,500x250,1000x500,2000x1000",
|
|
1850
|
+
previewUrl: "previews/400.webp",
|
|
1851
|
+
urlTemplate: "tiles/%l/%h_%v.webp",
|
|
1852
|
+
indexBase: 1,
|
|
1853
|
+
},
|
|
1854
|
+
// Add sphere, tile, or other sphereTile scenes here.
|
|
1855
|
+
];
|
|
1856
|
+
|
|
1857
|
+
<Scenes scenes={scenes} activeSceneId={activeSceneId} transition="dissolve" />;
|
|
1858
|
+
```
|
|
1859
|
+
|
|
1860
|
+
`onSceneReady(sceneId)` fires when the first scene becomes paintable and when an
|
|
1861
|
+
incoming scene takes over after the outgoing snapshot is captured. The transition
|
|
1862
|
+
may still be running; use this callback to apply the incoming camera view without
|
|
1863
|
+
changing the outgoing snapshot. `onTransitionEnd` marks completion of the blend.
|
|
1864
|
+
|
|
1865
|
+
`SphereTileScene` accepts the source options of `SphereTile`, including
|
|
1866
|
+
`indexBase`, `resolveTileUrl`, and `yawOffset`. `Scenes` owns visibility,
|
|
1867
|
+
preloading, readiness, and transitions. Use `onTransitionEnd` and
|
|
1868
|
+
`onTransitionError` on `Scenes`; its shared texture budget and request limit
|
|
1869
|
+
apply to both cube and equirectangular tiles. Standalone `SphereTile` retains
|
|
1870
|
+
its own cache, callbacks, and loading options.
|
|
1839
1871
|
|
|
1840
1872
|
## Accessibility matrices and tooltip typography
|
|
1841
1873
|
|
package/README.zh-CN.md
CHANGED
|
@@ -637,7 +637,7 @@ MAKE PANO (MULTIRES) 文件夹布局常为 `tiles/%s/l%l/%v/l%l_%s_%v_%h.jpg`,
|
|
|
637
637
|
|
|
638
638
|
## Scenes
|
|
639
639
|
|
|
640
|
-
`Scenes`
|
|
640
|
+
`Scenes` 在受控的普通球面、立方体瓦片与球面多级瓦片场景之间切换,采用纯 GPU 快照混合。目标场景先加载其球面或 tile 预览;就绪后,当前帧缓冲成为临时 GPU 纹理,释放其源纹理,目标场景再混合进入。这样避免在 WebGL 内存中同时持有两个高分辨率 tile 场景。
|
|
641
641
|
|
|
642
642
|
```tsx
|
|
643
643
|
import {
|
|
@@ -1529,8 +1529,38 @@ import { PanoViewer, SphereTile } from "@ericchen1990/pano-view";
|
|
|
1529
1529
|
`onLoadProgress`、`onLevelChange` 提供;回调中的层级同样从 0 开始。
|
|
1530
1530
|
卸载时释放组件纹理,丢弃迟到的加载结果。
|
|
1531
1531
|
|
|
1532
|
-
|
|
1533
|
-
`
|
|
1532
|
+
可以将 `SphereTile` 直接放在 `PanoViewer` 下,也可以在 `Scenes` 中使用
|
|
1533
|
+
`type: "sphereTile"` 的 `SphereTileScene`。所有过渡预设(包括 `dissolve`)均支持
|
|
1534
|
+
`sphere`、立方体 `tile` 和球面多级瓦片 `sphereTile` 之间的切换:
|
|
1535
|
+
|
|
1536
|
+
```tsx
|
|
1537
|
+
import { Scenes, type Scene } from "@ericchen1990/pano-view";
|
|
1538
|
+
|
|
1539
|
+
const scenes: Scene[] = [
|
|
1540
|
+
{
|
|
1541
|
+
id: "courtyard",
|
|
1542
|
+
type: "sphereTile",
|
|
1543
|
+
baseUrl: "/panoramas/courtyard/",
|
|
1544
|
+
multires: "512,500x250,1000x500,2000x1000",
|
|
1545
|
+
previewUrl: "previews/400.webp",
|
|
1546
|
+
urlTemplate: "tiles/%l/%h_%v.webp",
|
|
1547
|
+
indexBase: 1,
|
|
1548
|
+
},
|
|
1549
|
+
// 在此添加 sphere、tile 或其他 sphereTile 场景。
|
|
1550
|
+
];
|
|
1551
|
+
|
|
1552
|
+
<Scenes scenes={scenes} activeSceneId={activeSceneId} transition="dissolve" />;
|
|
1553
|
+
```
|
|
1554
|
+
|
|
1555
|
+
`onSceneReady(sceneId)` 在首个场景可绘制、或旧画面截图完成且新场景接管时触发。
|
|
1556
|
+
此时过渡可能仍在进行,可在该回调中设置新场景视角而不改变旧画面快照;
|
|
1557
|
+
`onTransitionEnd` 表示混合效果播放完成。
|
|
1558
|
+
|
|
1559
|
+
`SphereTileScene` 保留 `SphereTile` 的资源选项,包括 `indexBase`、`resolveTileUrl`
|
|
1560
|
+
和 `yawOffset`。可见性、预加载、就绪判断与过渡由 `Scenes` 管理;通过其
|
|
1561
|
+
`onTransitionEnd` 和 `onTransitionError` 接收结果。`Scenes` 的共享纹理预算与请求
|
|
1562
|
+
并发上限同时作用于立方体和球面瓦片。独立使用的 `SphereTile` 仍保留原有缓存、
|
|
1563
|
+
回调与加载选项。
|
|
1534
1564
|
|
|
1535
1565
|
## 无障碍颜色矩阵与标签排版
|
|
1536
1566
|
|