@ericchen1990/pano-view 2.0.0 → 2.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 +147 -43
- package/README.zh-CN.md +1111 -0
- package/dist/index.cjs +137 -105
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +31 -7
- package/dist/index.d.ts +31 -7
- package/dist/index.mjs +176 -144
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +339 -0
- package/package.json +8 -4
package/dist/index.d.mts
CHANGED
|
@@ -790,14 +790,25 @@ declare function TouchControls({ enabled, rotateSpeed, invert, pinchZoom, }: Tou
|
|
|
790
790
|
|
|
791
791
|
type SphereProps = {
|
|
792
792
|
src: string;
|
|
793
|
+
/**
|
|
794
|
+
* Low-resolution 2:1 equirectangular image shown while `src` loads.
|
|
795
|
+
* Relative paths resolve against the directory of `src`. Root-absolute and
|
|
796
|
+
* `http(s)` / `blob:` / `data:` URLs are used as-is. For krpano sphere
|
|
797
|
+
* scenes, copy `<preview url>`.
|
|
798
|
+
*/
|
|
799
|
+
previewUrl: string;
|
|
793
800
|
/** Horizontal image offset in degrees. */
|
|
794
801
|
yawOffset?: number;
|
|
802
|
+
/** Called once the first paintable texture (preview or `src`) is ready. */
|
|
803
|
+
onReady?: () => void;
|
|
795
804
|
onLoad?: (texture: Texture) => void;
|
|
796
805
|
onError?: (error: unknown) => void;
|
|
806
|
+
/** Called when `previewUrl` cannot be loaded; `src` still continues. */
|
|
807
|
+
onPreviewError?: (error: unknown) => void;
|
|
797
808
|
/** Keeps the source mounted for preloading without drawing it. */
|
|
798
809
|
visible?: boolean;
|
|
799
810
|
};
|
|
800
|
-
declare function Sphere({ src, yawOffset, onLoad, onError, visible, }: SphereProps): react.JSX.Element | null;
|
|
811
|
+
declare function Sphere({ src, previewUrl, yawOffset, onReady, onLoad, onError, onPreviewError, visible, }: SphereProps): react.JSX.Element | null;
|
|
801
812
|
|
|
802
813
|
type VideoPlaybackState = "playing" | "paused" | "ended" | "blocked";
|
|
803
814
|
type VideoHotspotErrorEvent = {
|
|
@@ -1001,18 +1012,30 @@ type TileLoadError = {
|
|
|
1001
1012
|
};
|
|
1002
1013
|
type TileProps = {
|
|
1003
1014
|
baseUrl: string;
|
|
1015
|
+
/**
|
|
1016
|
+
* Tile size followed by ascending cube-face sizes (`TILESIZE,LEVELSIZE1,...`).
|
|
1017
|
+
* For krpano output, copy `image.cube.multires` from the XML.
|
|
1018
|
+
*/
|
|
1004
1019
|
multires: string | TileMultiresConfig;
|
|
1005
|
-
/**
|
|
1006
|
-
|
|
1020
|
+
/**
|
|
1021
|
+
* Preview atlas path. Relative paths resolve against `baseUrl`; root-absolute
|
|
1022
|
+
* and `http(s)` / `blob:` / `data:` URLs are used as-is. For krpano output,
|
|
1023
|
+
* copy `<preview url>` (often `preview.jpg` at the scene root). This package's
|
|
1024
|
+
* common cube atlas path is `previews/cube-vertical.webp`.
|
|
1025
|
+
*/
|
|
1026
|
+
previewUrl: string;
|
|
1007
1027
|
/**
|
|
1008
1028
|
* Face order in the vertical preview atlas, from top to bottom. Defaults to
|
|
1009
|
-
* `l/f/r/b/u/d`.
|
|
1029
|
+
* `l/f/r/b/u/d`, matching krpano `preview.striporder` `LFRBUD`.
|
|
1010
1030
|
*/
|
|
1011
1031
|
previewFaceOrder?: readonly CubeFaceCode[];
|
|
1012
1032
|
/**
|
|
1013
|
-
*
|
|
1014
|
-
*
|
|
1015
|
-
*
|
|
1033
|
+
* Path relative to `baseUrl`. Defaults to
|
|
1034
|
+
* `tiles/%s/l%l/%v/l%l_%s_%h_%v.webp`. For krpano output, copy `<cube url>`
|
|
1035
|
+
* from the XML; krpano templates often use `%v_%h` instead of this default
|
|
1036
|
+
* `%h_%v`, so omitting `urlTemplate` requests the wrong files. Supports
|
|
1037
|
+
* krpano cube-tile `%s` and `%l` placeholders, horizontal `%h`/`%x`/`%u`/`%c`,
|
|
1038
|
+
* vertical `%v`/`%y`/`%w`/`%r`, and index padding such as `%0h` or `%00v`.
|
|
1016
1039
|
*/
|
|
1017
1040
|
urlTemplate?: string;
|
|
1018
1041
|
/** Returns a path relative to `baseUrl`; takes precedence over `urlTemplate`. */
|
|
@@ -1040,6 +1063,7 @@ type SphereScene = {
|
|
|
1040
1063
|
id: string;
|
|
1041
1064
|
type: "sphere";
|
|
1042
1065
|
src: string;
|
|
1066
|
+
previewUrl: string;
|
|
1043
1067
|
yawOffset?: number;
|
|
1044
1068
|
};
|
|
1045
1069
|
type TileScene = Omit<TileProps, "loadMode" | "visible" | "onReady" | "onPreviewError" | "onLoadProgress" | "onTileError" | "onLevelChange"> & {
|
package/dist/index.d.ts
CHANGED
|
@@ -790,14 +790,25 @@ declare function TouchControls({ enabled, rotateSpeed, invert, pinchZoom, }: Tou
|
|
|
790
790
|
|
|
791
791
|
type SphereProps = {
|
|
792
792
|
src: string;
|
|
793
|
+
/**
|
|
794
|
+
* Low-resolution 2:1 equirectangular image shown while `src` loads.
|
|
795
|
+
* Relative paths resolve against the directory of `src`. Root-absolute and
|
|
796
|
+
* `http(s)` / `blob:` / `data:` URLs are used as-is. For krpano sphere
|
|
797
|
+
* scenes, copy `<preview url>`.
|
|
798
|
+
*/
|
|
799
|
+
previewUrl: string;
|
|
793
800
|
/** Horizontal image offset in degrees. */
|
|
794
801
|
yawOffset?: number;
|
|
802
|
+
/** Called once the first paintable texture (preview or `src`) is ready. */
|
|
803
|
+
onReady?: () => void;
|
|
795
804
|
onLoad?: (texture: Texture) => void;
|
|
796
805
|
onError?: (error: unknown) => void;
|
|
806
|
+
/** Called when `previewUrl` cannot be loaded; `src` still continues. */
|
|
807
|
+
onPreviewError?: (error: unknown) => void;
|
|
797
808
|
/** Keeps the source mounted for preloading without drawing it. */
|
|
798
809
|
visible?: boolean;
|
|
799
810
|
};
|
|
800
|
-
declare function Sphere({ src, yawOffset, onLoad, onError, visible, }: SphereProps): react.JSX.Element | null;
|
|
811
|
+
declare function Sphere({ src, previewUrl, yawOffset, onReady, onLoad, onError, onPreviewError, visible, }: SphereProps): react.JSX.Element | null;
|
|
801
812
|
|
|
802
813
|
type VideoPlaybackState = "playing" | "paused" | "ended" | "blocked";
|
|
803
814
|
type VideoHotspotErrorEvent = {
|
|
@@ -1001,18 +1012,30 @@ type TileLoadError = {
|
|
|
1001
1012
|
};
|
|
1002
1013
|
type TileProps = {
|
|
1003
1014
|
baseUrl: string;
|
|
1015
|
+
/**
|
|
1016
|
+
* Tile size followed by ascending cube-face sizes (`TILESIZE,LEVELSIZE1,...`).
|
|
1017
|
+
* For krpano output, copy `image.cube.multires` from the XML.
|
|
1018
|
+
*/
|
|
1004
1019
|
multires: string | TileMultiresConfig;
|
|
1005
|
-
/**
|
|
1006
|
-
|
|
1020
|
+
/**
|
|
1021
|
+
* Preview atlas path. Relative paths resolve against `baseUrl`; root-absolute
|
|
1022
|
+
* and `http(s)` / `blob:` / `data:` URLs are used as-is. For krpano output,
|
|
1023
|
+
* copy `<preview url>` (often `preview.jpg` at the scene root). This package's
|
|
1024
|
+
* common cube atlas path is `previews/cube-vertical.webp`.
|
|
1025
|
+
*/
|
|
1026
|
+
previewUrl: string;
|
|
1007
1027
|
/**
|
|
1008
1028
|
* Face order in the vertical preview atlas, from top to bottom. Defaults to
|
|
1009
|
-
* `l/f/r/b/u/d`.
|
|
1029
|
+
* `l/f/r/b/u/d`, matching krpano `preview.striporder` `LFRBUD`.
|
|
1010
1030
|
*/
|
|
1011
1031
|
previewFaceOrder?: readonly CubeFaceCode[];
|
|
1012
1032
|
/**
|
|
1013
|
-
*
|
|
1014
|
-
*
|
|
1015
|
-
*
|
|
1033
|
+
* Path relative to `baseUrl`. Defaults to
|
|
1034
|
+
* `tiles/%s/l%l/%v/l%l_%s_%h_%v.webp`. For krpano output, copy `<cube url>`
|
|
1035
|
+
* from the XML; krpano templates often use `%v_%h` instead of this default
|
|
1036
|
+
* `%h_%v`, so omitting `urlTemplate` requests the wrong files. Supports
|
|
1037
|
+
* krpano cube-tile `%s` and `%l` placeholders, horizontal `%h`/`%x`/`%u`/`%c`,
|
|
1038
|
+
* vertical `%v`/`%y`/`%w`/`%r`, and index padding such as `%0h` or `%00v`.
|
|
1016
1039
|
*/
|
|
1017
1040
|
urlTemplate?: string;
|
|
1018
1041
|
/** Returns a path relative to `baseUrl`; takes precedence over `urlTemplate`. */
|
|
@@ -1040,6 +1063,7 @@ type SphereScene = {
|
|
|
1040
1063
|
id: string;
|
|
1041
1064
|
type: "sphere";
|
|
1042
1065
|
src: string;
|
|
1066
|
+
previewUrl: string;
|
|
1043
1067
|
yawOffset?: number;
|
|
1044
1068
|
};
|
|
1045
1069
|
type TileScene = Omit<TileProps, "loadMode" | "visible" | "onReady" | "onPreviewError" | "onLoadProgress" | "onTileError" | "onLevelChange"> & {
|