@ericchen1990/pano-view 3.1.3 → 3.2.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 +63 -0
- package/README.zh-CN.md +53 -0
- package/dist/index.cjs +1413 -984
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +172 -81
- package/dist/index.d.ts +172 -81
- package/dist/index.mjs +1474 -1042
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -1791,3 +1791,66 @@ import "@ericchen1990/pano-view/styles.css";
|
|
|
1791
1791
|
```
|
|
1792
1792
|
|
|
1793
1793
|
See [Stylesheet (HTML chrome)](#stylesheet-html-chrome).
|
|
1794
|
+
|
|
1795
|
+
## Spherical multiresolution tiles
|
|
1796
|
+
|
|
1797
|
+
`SphereTile` renders full 2:1 equirectangular pyramids without assembling a full-resolution texture:
|
|
1798
|
+
|
|
1799
|
+
```tsx
|
|
1800
|
+
import { PanoViewer, SphereTile } from "@ericchen1990/pano-view";
|
|
1801
|
+
|
|
1802
|
+
<PanoViewer>
|
|
1803
|
+
<SphereTile
|
|
1804
|
+
baseUrl="/panoramas/legacy"
|
|
1805
|
+
multires="512,257x129,513x257,1025x513,2050x1025,4100x2050"
|
|
1806
|
+
urlTemplate="tiles/%l/%h_%v.webp"
|
|
1807
|
+
previewUrl="previews/400.webp"
|
|
1808
|
+
indexBase={0}
|
|
1809
|
+
/>
|
|
1810
|
+
</PanoViewer>;
|
|
1811
|
+
```
|
|
1812
|
+
|
|
1813
|
+
This layout matches Sharp Deep Zoom with `size: 512`, `depth: "onetile"`,
|
|
1814
|
+
`layout: "dz"`, and no overlap. Set `indexBase={0}` for that raw Sharp output, including partial edge tiles.
|
|
1815
|
+
The default `indexBase={1}` matches existing krpano sphere resources whose
|
|
1816
|
+
level, column and row all start at **1**. Logical addresses passed to callbacks
|
|
1817
|
+
and `resolveTileUrl` always start at 0; `indexBase` only affects URL templates.
|
|
1818
|
+
`multires` accepts the string above or `{ tileSize, levels: [{ width, height }] }`.
|
|
1819
|
+
Copy actual dimensions rather than deriving each level by multiplying by two:
|
|
1820
|
+
odd dimensions round independently. Each level must describe a full 2:1 image
|
|
1821
|
+
(with up to two pixels of rounding tolerance).
|
|
1822
|
+
|
|
1823
|
+
Relative paths resolve under `baseUrl`; absolute paths/URLs remain absolute.
|
|
1824
|
+
`resolveTileUrl(address)` overrides the template. Templates support `%l`,
|
|
1825
|
+
horizontal `%h`/`%x`/`%u`/`%c`, vertical `%v`/`%y`/`%w`/`%r`, and padding such as
|
|
1826
|
+
`%00h`. `yawOffset` rotates the source; the source image center faces yaw 0,
|
|
1827
|
+
right is positive yaw, and top is positive pitch.
|
|
1828
|
+
|
|
1829
|
+
`maxTextureMemoryMb` (128), `maxConcurrentLoads` (4), and `retryCount` (1)
|
|
1830
|
+
configure the per-component tile cache. The preview uses separate memory. If the
|
|
1831
|
+
visible detail and its fallback levels exceed the tile budget, the viewer uses a
|
|
1832
|
+
coarser level; the preview stays underneath. `loadMode` is `full` (default),
|
|
1833
|
+
`base`, or `preview`. `visible={false}` preloads without drawing.
|
|
1834
|
+
`onReady` fires once per source when a preview or tile becomes paintable, even
|
|
1835
|
+
if the preview failed. `onPreviewError`, `onTileError`, `onLoadProgress`, and
|
|
1836
|
+
`onLevelChange` expose failures/progress; levels in callbacks start at 0.
|
|
1837
|
+
Unmounting disposes owned textures and ignores late results.
|
|
1838
|
+
|
|
1839
|
+
Use `SphereTile` directly as a `PanoViewer` child; `Scenes` currently accepts
|
|
1840
|
+
`sphere` and cube `tile` definitions only.
|
|
1841
|
+
|
|
1842
|
+
## Accessibility matrices and tooltip typography
|
|
1843
|
+
|
|
1844
|
+
`PanoFilter` also accepts `colorMatrix`, a readonly row-major 4×5 RGBA matrix
|
|
1845
|
+
(20 finite numbers, matching SVG `feColorMatrix`). The matrix is applied in
|
|
1846
|
+
display/sRGB space after the panorama preset. `intensity` mixes each effect
|
|
1847
|
+
with the original; `enabled={false}` disables both. Set
|
|
1848
|
+
`colorMatrixScope="all"` to include hotspot textures; the default `"panorama"`
|
|
1849
|
+
keeps existing behavior. Artistic presets always affect only the panorama.
|
|
1850
|
+
HTML tooltips, iframes and other DOM chrome remain host-styled.
|
|
1851
|
+
|
|
1852
|
+
Hotspot `tooltipAppearance` now accepts `fontFamily`, `lineHeight`, and
|
|
1853
|
+
`letterSpacing`, in addition to `fontSize` and existing paint options.
|
|
1854
|
+
`lineHeight` numbers are unitless; numeric `letterSpacing` values are CSS pixels.
|
|
1855
|
+
|
|
1856
|
+
Regression checks: `pnpm --filter @ericchen1990/pano-view test` (Node 22+).
|
package/README.zh-CN.md
CHANGED
|
@@ -1493,3 +1493,56 @@ import "@ericchen1990/pano-view/styles.css";
|
|
|
1493
1493
|
```
|
|
1494
1494
|
|
|
1495
1495
|
见 [样式表(HTML 叠加层)](#样式表html-叠加层)。
|
|
1496
|
+
|
|
1497
|
+
## 球面多分辨率瓦片
|
|
1498
|
+
|
|
1499
|
+
`SphereTile` 直接渲染完整的 2:1 等距柱状全景瓦片,不拼接高分辨率整图:
|
|
1500
|
+
|
|
1501
|
+
```tsx
|
|
1502
|
+
import { PanoViewer, SphereTile } from "@ericchen1990/pano-view";
|
|
1503
|
+
|
|
1504
|
+
<PanoViewer>
|
|
1505
|
+
<SphereTile
|
|
1506
|
+
baseUrl="/panoramas/legacy"
|
|
1507
|
+
multires="512,257x129,513x257,1025x513,2050x1025,4100x2050"
|
|
1508
|
+
urlTemplate="tiles/%l/%h_%v.webp"
|
|
1509
|
+
previewUrl="previews/400.webp"
|
|
1510
|
+
indexBase={0}
|
|
1511
|
+
/>
|
|
1512
|
+
</PanoViewer>;
|
|
1513
|
+
```
|
|
1514
|
+
|
|
1515
|
+
格式对应 Sharp Deep Zoom 的 `size: 512`、`depth: "onetile"`、`layout: "dz"`、
|
|
1516
|
+
无重叠瓦片。Sharp 原始输出使用 `indexBase={0}`,支持不足一块的边缘瓦片。
|
|
1517
|
+
默认的 `indexBase={1}` 兼容层级、列、行都从 **1** 开始的存量 krpano 球面资源。
|
|
1518
|
+
回调与 `resolveTileUrl` 接收的逻辑地址始终从 0 开始,`indexBase` 只作用于 URL 模板。`multires` 也可传 `{ tileSize, levels: [{ width, height }] }`。
|
|
1519
|
+
应使用资源的真实层级尺寸,奇数尺寸逐级取整,不能简单乘二推导。每级应为完整的
|
|
1520
|
+
2:1 全景,允许最多两像素的取整误差。
|
|
1521
|
+
|
|
1522
|
+
相对路径基于 `baseUrl`,绝对路径与 URL 保持原样。`resolveTileUrl(address)` 优先于
|
|
1523
|
+
模板。模板支持 `%l`、横向 `%h`/`%x`/`%u`/`%c`、纵向 `%v`/`%y`/`%w`/`%r`,
|
|
1524
|
+
以及 `%00h` 等补零。`yawOffset` 旋转图像;图像中心为 yaw 0,向右为正 yaw,向上为正 pitch。
|
|
1525
|
+
|
|
1526
|
+
`maxTextureMemoryMb`(默认 128)、`maxConcurrentLoads`(4)、`retryCount`(1)
|
|
1527
|
+
控制单个组件的瓦片缓存。预览图内存单独计算。当可见细节与回退层级超出预算时,
|
|
1528
|
+
采用较粗层级,预览始终作为底图。`loadMode` 支持 `full`(默认)、`base` 和 `preview`;
|
|
1529
|
+
`visible={false}` 仅预加载。`onReady` 在一个源的首个可绘制预览或瓦片就绪时触发一次,
|
|
1530
|
+
预览失败时仍可通过瓦片就绪。错误与进度通过 `onPreviewError`、`onTileError`、
|
|
1531
|
+
`onLoadProgress`、`onLevelChange` 提供;回调中的层级同样从 0 开始。
|
|
1532
|
+
卸载时释放组件纹理,丢弃迟到的加载结果。
|
|
1533
|
+
|
|
1534
|
+
将 `SphereTile` 直接放在 `PanoViewer` 下;当前 `Scenes` 仍只接受 `sphere` 和立方体
|
|
1535
|
+
`tile` 场景定义。
|
|
1536
|
+
|
|
1537
|
+
## 无障碍颜色矩阵与标签排版
|
|
1538
|
+
|
|
1539
|
+
`PanoFilter.colorMatrix` 接收只读的行优先 4×5 RGBA 矩阵(20 个有限数值,与 SVG
|
|
1540
|
+
`feColorMatrix` 一致),在预设滤镜之后、显示/sRGB 颜色空间中应用。`intensity`
|
|
1541
|
+
控制效果混合比例,`enabled={false}` 关闭预设和矩阵。`colorMatrixScope="all"`
|
|
1542
|
+
将矩阵同时应用于热点纹理;默认 `"panorama"` 保持原有行为。艺术预设始终仅作用于
|
|
1543
|
+
全景。HTML 标签、iframe 和其他 DOM 界面仍由宿主设置样式。
|
|
1544
|
+
|
|
1545
|
+
热点的 `tooltipAppearance` 新增 `fontFamily`、`lineHeight`、`letterSpacing`,
|
|
1546
|
+
配合原有的 `fontSize` 使用。数字 `lineHeight` 为无单位倍数,数字 `letterSpacing` 为 CSS 像素。
|
|
1547
|
+
|
|
1548
|
+
回归验证:`pnpm --filter @ericchen1990/pano-view test`(Node 22+)。
|