@ericchen1990/pano-view 3.4.2 → 3.6.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 +615 -73
- package/README.zh-CN.md +583 -71
- package/dist/data.cjs +1080 -0
- package/dist/data.cjs.map +1 -0
- package/dist/data.d.mts +581 -0
- package/dist/data.d.ts +581 -0
- package/dist/data.mjs +1057 -0
- package/dist/data.mjs.map +1 -0
- package/dist/index.cjs +9120 -8431
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +904 -625
- package/dist/index.d.ts +904 -625
- package/dist/index.mjs +9273 -8578
- package/dist/index.mjs.map +1 -1
- package/dist/ui/styles.css +70 -0
- package/dist/ui.cjs +195 -0
- package/dist/ui.cjs.map +1 -0
- package/dist/ui.d.mts +63 -0
- package/dist/ui.d.ts +63 -0
- package/dist/ui.mjs +152 -0
- package/dist/ui.mjs.map +1 -0
- package/docs/dialogs.md +606 -0
- package/docs/dialogs.zh-CN.md +606 -0
- package/package.json +20 -5
package/dist/data.d.mts
ADDED
|
@@ -0,0 +1,581 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
|
|
3
|
+
type PanoDataErrorCode = "INVALID_OPTIONS" | "FETCH_FAILED" | "HTTP_ERROR" | "INVALID_JSON" | "INVALID_CONFIG" | "UNSUPPORTED_SCHEMA_VERSION" | "UNSUPPORTED_PROJECTION" | "INVALID_PROJECT" | "INVALID_REFERENCE" | "ABORTED";
|
|
4
|
+
declare class PanoDataError extends Error {
|
|
5
|
+
readonly code: PanoDataErrorCode;
|
|
6
|
+
readonly status?: number;
|
|
7
|
+
readonly sceneId?: string;
|
|
8
|
+
readonly field?: string;
|
|
9
|
+
readonly cause?: unknown;
|
|
10
|
+
constructor(code: PanoDataErrorCode, message: string, details?: {
|
|
11
|
+
status?: number;
|
|
12
|
+
sceneId?: string;
|
|
13
|
+
field?: string;
|
|
14
|
+
cause?: unknown;
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** The portable rendering contract shared by the converter and browser viewer. */
|
|
19
|
+
type ViewerCubeFace = "f" | "r" | "b" | "l" | "u" | "d";
|
|
20
|
+
type CubemapViewerConfig = {
|
|
21
|
+
type: "tile";
|
|
22
|
+
multires: {
|
|
23
|
+
tileSize: number;
|
|
24
|
+
levels: number[];
|
|
25
|
+
};
|
|
26
|
+
urlTemplate: string;
|
|
27
|
+
previewUrl: string;
|
|
28
|
+
previewFaceOrder: ViewerCubeFace[];
|
|
29
|
+
};
|
|
30
|
+
type SphereViewerConfig = {
|
|
31
|
+
type: "sphereTile";
|
|
32
|
+
multires: {
|
|
33
|
+
tileSize: number;
|
|
34
|
+
levels: {
|
|
35
|
+
width: number;
|
|
36
|
+
height: number;
|
|
37
|
+
}[];
|
|
38
|
+
};
|
|
39
|
+
urlTemplate: string;
|
|
40
|
+
previewUrl: string;
|
|
41
|
+
indexBase: 0 | 1;
|
|
42
|
+
};
|
|
43
|
+
type ViewerConfig = CubemapViewerConfig | SphereViewerConfig;
|
|
44
|
+
type ViewerDocument = ViewerConfig & {
|
|
45
|
+
schemaVersion: 1;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/** Camera-center limits in degrees. A yaw min greater than max crosses ±180°. */
|
|
49
|
+
type PanoViewLimits = {
|
|
50
|
+
yaw?: {
|
|
51
|
+
min: number;
|
|
52
|
+
max: number;
|
|
53
|
+
};
|
|
54
|
+
pitch?: {
|
|
55
|
+
min: number;
|
|
56
|
+
max: number;
|
|
57
|
+
};
|
|
58
|
+
fov?: {
|
|
59
|
+
min: number;
|
|
60
|
+
max: number;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
type CubeFaceCode = "f" | "r" | "b" | "l" | "u" | "d";
|
|
65
|
+
type TileAddress = {
|
|
66
|
+
face: CubeFaceCode;
|
|
67
|
+
level: number;
|
|
68
|
+
row: number;
|
|
69
|
+
col: number;
|
|
70
|
+
faceSize: number;
|
|
71
|
+
tileSize: number;
|
|
72
|
+
width: number;
|
|
73
|
+
height: number;
|
|
74
|
+
};
|
|
75
|
+
type TileMultiresConfig = {
|
|
76
|
+
tileSize: number;
|
|
77
|
+
/** Ascending face sizes. The first value maps to l1. */
|
|
78
|
+
levels: number[];
|
|
79
|
+
};
|
|
80
|
+
type TileLoadProgress = {
|
|
81
|
+
requested: number;
|
|
82
|
+
loaded: number;
|
|
83
|
+
failed: number;
|
|
84
|
+
active: number;
|
|
85
|
+
queued: number;
|
|
86
|
+
};
|
|
87
|
+
type TileLoadError = {
|
|
88
|
+
address: TileAddress;
|
|
89
|
+
url: string;
|
|
90
|
+
error: unknown;
|
|
91
|
+
};
|
|
92
|
+
type TileProps = {
|
|
93
|
+
baseUrl: string;
|
|
94
|
+
/**
|
|
95
|
+
* Tile size followed by ascending cube-face sizes (`TILESIZE,LEVELSIZE1,...`).
|
|
96
|
+
* For krpano output, copy `image.cube.multires` from the XML.
|
|
97
|
+
*/
|
|
98
|
+
multires: string | TileMultiresConfig;
|
|
99
|
+
/**
|
|
100
|
+
* Preview atlas path. Relative paths resolve against `baseUrl`; root-absolute
|
|
101
|
+
* and `http(s)` / `blob:` / `data:` URLs are used as-is. For krpano output,
|
|
102
|
+
* copy `<preview url>` (often `preview.jpg` at the scene root). This package's
|
|
103
|
+
* common cube atlas path is `previews/cube-vertical.webp`.
|
|
104
|
+
*/
|
|
105
|
+
previewUrl: string;
|
|
106
|
+
/**
|
|
107
|
+
* Face order in the vertical preview atlas, from top to bottom. Defaults to
|
|
108
|
+
* `l/f/r/b/u/d`, matching krpano `preview.striporder` `LFRBUD`.
|
|
109
|
+
*/
|
|
110
|
+
previewFaceOrder?: readonly CubeFaceCode[];
|
|
111
|
+
/**
|
|
112
|
+
* Path relative to `baseUrl`. Defaults to
|
|
113
|
+
* `tiles/%s/l%l/%v/l%l_%s_%h_%v.webp`. For krpano output, copy `<cube url>`
|
|
114
|
+
* from the XML; krpano templates often use `%v_%h` instead of this default
|
|
115
|
+
* `%h_%v`, so omitting `urlTemplate` requests the wrong files. Supports
|
|
116
|
+
* krpano cube-tile `%s` and `%l` placeholders, horizontal `%h`/`%x`/`%u`/`%c`,
|
|
117
|
+
* vertical `%v`/`%y`/`%w`/`%r`, and index padding such as `%0h` or `%00v`.
|
|
118
|
+
*/
|
|
119
|
+
urlTemplate?: string;
|
|
120
|
+
/** Returns a relative path or absolute URL; takes precedence over `urlTemplate`. */
|
|
121
|
+
resolveTileUrl?: (address: TileAddress) => string;
|
|
122
|
+
maxTextureMemoryMb?: number;
|
|
123
|
+
maxConcurrentLoads?: number;
|
|
124
|
+
retryCount?: number;
|
|
125
|
+
/**
|
|
126
|
+
* `preview` loads only the preview atlas; `base` also preloads the visible
|
|
127
|
+
* lowest-resolution tiles before full-resolution loading begins.
|
|
128
|
+
*/
|
|
129
|
+
loadMode?: "full" | "preview" | "base";
|
|
130
|
+
/** Keeps the source mounted for preloading without drawing it. */
|
|
131
|
+
visible?: boolean;
|
|
132
|
+
/** Called when the preview atlas is ready for display. */
|
|
133
|
+
onReady?: () => void;
|
|
134
|
+
/** Called when the preview atlas cannot be loaded. */
|
|
135
|
+
onPreviewError?: (error: unknown) => void;
|
|
136
|
+
onLoadProgress?: (progress: TileLoadProgress) => void;
|
|
137
|
+
onTileError?: (event: TileLoadError) => void;
|
|
138
|
+
onLevelChange?: (level: number) => void;
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
type SphereTileLevel = {
|
|
142
|
+
width: number;
|
|
143
|
+
height: number;
|
|
144
|
+
};
|
|
145
|
+
type SphereTileMultiresConfig = {
|
|
146
|
+
tileSize: number;
|
|
147
|
+
/** Ascending image dimensions. The first item maps to level 0. */
|
|
148
|
+
levels: SphereTileLevel[];
|
|
149
|
+
};
|
|
150
|
+
type SphereTileAddress = {
|
|
151
|
+
/** Zero-based logical level, column and row; URL indices add indexBase. */
|
|
152
|
+
level: number;
|
|
153
|
+
col: number;
|
|
154
|
+
row: number;
|
|
155
|
+
imageWidth: number;
|
|
156
|
+
imageHeight: number;
|
|
157
|
+
tileSize: number;
|
|
158
|
+
/** Actual tile dimensions, including partial edge tiles. */
|
|
159
|
+
width: number;
|
|
160
|
+
height: number;
|
|
161
|
+
};
|
|
162
|
+
type SphereTileLoadError = {
|
|
163
|
+
address: SphereTileAddress;
|
|
164
|
+
url: string;
|
|
165
|
+
error: unknown;
|
|
166
|
+
};
|
|
167
|
+
type SphereTileProps = {
|
|
168
|
+
baseUrl: string;
|
|
169
|
+
/** `512,500x250,1000x500,2000x1000` or explicit ascending dimensions. */
|
|
170
|
+
multires: string | SphereTileMultiresConfig;
|
|
171
|
+
/** A 2:1 equirectangular preview, resolved relative to baseUrl. */
|
|
172
|
+
previewUrl: string;
|
|
173
|
+
/** Defaults to `tiles/%l/%h_%v.webp`. No tile overlap. */
|
|
174
|
+
urlTemplate?: string;
|
|
175
|
+
/** URL indices start at 1 for krpano (default), or 0 for raw Sharp Deep Zoom. */
|
|
176
|
+
indexBase?: 0 | 1;
|
|
177
|
+
/** Takes precedence over urlTemplate and indexBase. Receives zero-based addresses. */
|
|
178
|
+
resolveTileUrl?: (address: SphereTileAddress) => string;
|
|
179
|
+
/** Horizontal source rotation in degrees. Defaults to 0. */
|
|
180
|
+
yawOffset?: number;
|
|
181
|
+
/** Tile cache budget in MiB. Defaults to 128. Preview memory is separate. */
|
|
182
|
+
maxTextureMemoryMb?: number;
|
|
183
|
+
/** Defaults to 4. */
|
|
184
|
+
maxConcurrentLoads?: number;
|
|
185
|
+
/** Retries after the initial attempt. Defaults to 1. */
|
|
186
|
+
retryCount?: number;
|
|
187
|
+
loadMode?: "full" | "preview" | "base";
|
|
188
|
+
visible?: boolean;
|
|
189
|
+
/** First paintable preview or tile is ready, even if the preview failed. */
|
|
190
|
+
onReady?: () => void;
|
|
191
|
+
onPreviewError?: (error: unknown) => void;
|
|
192
|
+
onLoadProgress?: (progress: TileLoadProgress) => void;
|
|
193
|
+
onTileError?: (event: SphereTileLoadError) => void;
|
|
194
|
+
/** Zero-based selected level. */
|
|
195
|
+
onLevelChange?: (level: number) => void;
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
type SceneViewOptions = {
|
|
199
|
+
viewLimits?: PanoViewLimits;
|
|
200
|
+
};
|
|
201
|
+
type TileScene = Omit<TileProps, "loadMode" | "visible" | "onReady" | "onPreviewError" | "onLoadProgress" | "onTileError" | "onLevelChange"> & SceneViewOptions & {
|
|
202
|
+
id: string;
|
|
203
|
+
type: "tile";
|
|
204
|
+
};
|
|
205
|
+
type SphereTileScene = Omit<SphereTileProps, "loadMode" | "visible" | "onReady" | "onPreviewError" | "onLoadProgress" | "onTileError" | "onLevelChange"> & SceneViewOptions & {
|
|
206
|
+
id: string;
|
|
207
|
+
type: "sphereTile";
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
type AssetUrlContext = {
|
|
211
|
+
defaultUrl: string;
|
|
212
|
+
kind: "tile" | "preview" | "hotspot";
|
|
213
|
+
sceneId: string;
|
|
214
|
+
hotspotId?: string;
|
|
215
|
+
};
|
|
216
|
+
type AssetUrlResolver = (path: string, context: AssetUrlContext) => string;
|
|
217
|
+
type JsonRequestOptions = {
|
|
218
|
+
requestInit?: Pick<RequestInit, "headers" | "credentials" | "signal">;
|
|
219
|
+
};
|
|
220
|
+
type SceneFromViewerConfigOptions = {
|
|
221
|
+
id: string;
|
|
222
|
+
baseUrl: string;
|
|
223
|
+
resolveAssetUrl?: AssetUrlResolver;
|
|
224
|
+
};
|
|
225
|
+
type LoadSceneFromJsonOptions = Omit<SceneFromViewerConfigOptions, "baseUrl"> & JsonRequestOptions & {
|
|
226
|
+
baseUrl?: string;
|
|
227
|
+
};
|
|
228
|
+
declare function sceneFromViewerConfig(value: unknown, options: SceneFromViewerConfigOptions): TileScene | SphereTileScene;
|
|
229
|
+
declare function loadSceneFromJson(url: string, options: LoadSceneFromJsonOptions): Promise<TileScene | SphereTileScene>;
|
|
230
|
+
|
|
231
|
+
type ProjectPopupBlock = {
|
|
232
|
+
id: string;
|
|
233
|
+
} & ({
|
|
234
|
+
type: "text";
|
|
235
|
+
text: string;
|
|
236
|
+
} | {
|
|
237
|
+
type: "image";
|
|
238
|
+
src: string;
|
|
239
|
+
alt?: string;
|
|
240
|
+
} | {
|
|
241
|
+
type: "video";
|
|
242
|
+
src: string;
|
|
243
|
+
poster?: string;
|
|
244
|
+
} | {
|
|
245
|
+
type: "audio";
|
|
246
|
+
src: string;
|
|
247
|
+
});
|
|
248
|
+
type ProjectPopupDefinition = {
|
|
249
|
+
id: string;
|
|
250
|
+
title: string;
|
|
251
|
+
blocks: ProjectPopupBlock[];
|
|
252
|
+
};
|
|
253
|
+
type PopupAssetUrlContext = {
|
|
254
|
+
defaultUrl: string;
|
|
255
|
+
popupId: string;
|
|
256
|
+
blockId: string;
|
|
257
|
+
field: "src" | "poster";
|
|
258
|
+
};
|
|
259
|
+
type PopupAssetUrlResolver = (path: string, context: PopupAssetUrlContext) => string;
|
|
260
|
+
declare function resolveProjectPopupAssets(popup: ProjectPopupDefinition, baseUrl: string, resolver?: PopupAssetUrlResolver): ProjectPopupDefinition;
|
|
261
|
+
|
|
262
|
+
type HotspotPosition = {
|
|
263
|
+
/** Horizontal panorama angle in degrees. Positive values look right. */
|
|
264
|
+
yaw: number;
|
|
265
|
+
/** Vertical panorama angle in degrees. Positive values look up. */
|
|
266
|
+
pitch: number;
|
|
267
|
+
};
|
|
268
|
+
/**
|
|
269
|
+
* A safe point-hotspot rendering mode.
|
|
270
|
+
*
|
|
271
|
+
* `surface` attaches the visual to the panorama shell. `billboard` floats it
|
|
272
|
+
* in front of the shell and keeps it facing the camera.
|
|
273
|
+
*/
|
|
274
|
+
type HotspotMode = "surface" | "billboard";
|
|
275
|
+
/** Whether a hotspot grows with panorama zoom or preserves its screen size. */
|
|
276
|
+
type HotspotScaleMode = "fov" | "fixed";
|
|
277
|
+
/** When a hotspot tooltip is shown. Defaults to `"always"`. */
|
|
278
|
+
type HotspotTooltipTrigger = "always" | "hover" | "click";
|
|
279
|
+
/**
|
|
280
|
+
* Pointer hit-testing for a hotspot. `"none"` ignores mouse, touch, and pen
|
|
281
|
+
* so events pass through to the panorama. Defaults to `"auto"`.
|
|
282
|
+
*/
|
|
283
|
+
type HotspotPointerEvents = "auto" | "none";
|
|
284
|
+
/** Where the tooltip sits relative to the hotspot. Defaults to `"top"`. */
|
|
285
|
+
type HotspotTooltipPlacement = "top" | "bottom" | "left" | "right";
|
|
286
|
+
/** Plain-text and/or image content for a hotspot tooltip. */
|
|
287
|
+
type HotspotTooltipContent = {
|
|
288
|
+
text?: string;
|
|
289
|
+
image?: string;
|
|
290
|
+
imageAlt?: string;
|
|
291
|
+
};
|
|
292
|
+
/** Visual styling for a hotspot tooltip bubble. */
|
|
293
|
+
type HotspotTooltipAppearance = {
|
|
294
|
+
background?: string;
|
|
295
|
+
color?: string;
|
|
296
|
+
border?: string;
|
|
297
|
+
borderRadius?: number | string;
|
|
298
|
+
shadow?: string;
|
|
299
|
+
padding?: number | string;
|
|
300
|
+
fontSize?: number | string;
|
|
301
|
+
fontFamily?: CSSProperties["fontFamily"];
|
|
302
|
+
/** Unitless line-height, or a CSS length. */
|
|
303
|
+
lineHeight?: CSSProperties["lineHeight"];
|
|
304
|
+
/** Numbers are CSS pixels. */
|
|
305
|
+
letterSpacing?: CSSProperties["letterSpacing"];
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
type PanoViewerState = {
|
|
309
|
+
/** Horizontal look angle in degrees. Positive values look right. */
|
|
310
|
+
yaw: number;
|
|
311
|
+
/** Vertical look angle in degrees. Positive values look up. */
|
|
312
|
+
pitch: number;
|
|
313
|
+
/** Vertical perspective field of view in degrees. */
|
|
314
|
+
fov: number;
|
|
315
|
+
};
|
|
316
|
+
|
|
317
|
+
type GraphicPaint = {
|
|
318
|
+
fill?: string;
|
|
319
|
+
stroke?: string;
|
|
320
|
+
strokeWidth?: number;
|
|
321
|
+
};
|
|
322
|
+
type CircleGraphic = GraphicPaint & {
|
|
323
|
+
kind: "circle";
|
|
324
|
+
};
|
|
325
|
+
type TriangleGraphic = GraphicPaint & {
|
|
326
|
+
kind: "triangle";
|
|
327
|
+
};
|
|
328
|
+
type DiamondGraphic = GraphicPaint & {
|
|
329
|
+
kind: "diamond";
|
|
330
|
+
};
|
|
331
|
+
type StarGraphic = GraphicPaint & {
|
|
332
|
+
kind: "star";
|
|
333
|
+
};
|
|
334
|
+
type ArrowGraphic = GraphicPaint & {
|
|
335
|
+
kind: "arrow";
|
|
336
|
+
};
|
|
337
|
+
type RectangleGraphic = GraphicPaint & {
|
|
338
|
+
kind: "rectangle";
|
|
339
|
+
/** Relative radius from 0 (square corners) to 0.5 (maximum rounded corners). */
|
|
340
|
+
cornerRadius?: number;
|
|
341
|
+
};
|
|
342
|
+
type RingGraphic = GraphicPaint & {
|
|
343
|
+
kind: "ring";
|
|
344
|
+
innerRadius?: number;
|
|
345
|
+
};
|
|
346
|
+
type SvgGraphic = {
|
|
347
|
+
kind: "svg";
|
|
348
|
+
src: string;
|
|
349
|
+
};
|
|
350
|
+
type SvgPathGraphic = GraphicPaint & {
|
|
351
|
+
kind: "path";
|
|
352
|
+
path: string;
|
|
353
|
+
viewBox: [x: number, y: number, width: number, height: number];
|
|
354
|
+
};
|
|
355
|
+
type GraphicDefinition = CircleGraphic | TriangleGraphic | DiamondGraphic | StarGraphic | ArrowGraphic | RectangleGraphic | RingGraphic | SvgGraphic | SvgPathGraphic;
|
|
356
|
+
|
|
357
|
+
type IframePointerPolicy = "hotspot" | "content";
|
|
358
|
+
|
|
359
|
+
type TextHotspotAlign = "left" | "center" | "right";
|
|
360
|
+
type TextHotspotVerticalAlign = "top" | "middle" | "bottom";
|
|
361
|
+
type TextHotspotWhiteSpace = "normal" | "nowrap";
|
|
362
|
+
type TextHotspotFontStyle = "normal" | "italic";
|
|
363
|
+
/** Serializable typography and panel paint for a text hotspot. */
|
|
364
|
+
type TextHotspotStyle = {
|
|
365
|
+
fontFamily?: string;
|
|
366
|
+
/** Canvas pixels. Defaults to 96. */
|
|
367
|
+
fontSize?: number;
|
|
368
|
+
/** CSS font-weight. Defaults to 600. */
|
|
369
|
+
fontWeight?: number | string;
|
|
370
|
+
/** CSS font-style. Defaults to `"normal"`. */
|
|
371
|
+
fontStyle?: TextHotspotFontStyle;
|
|
372
|
+
color?: string;
|
|
373
|
+
/** CSS color. An empty string skips the panel fill. */
|
|
374
|
+
background?: string;
|
|
375
|
+
backgroundOpacity?: number;
|
|
376
|
+
/** Fraction of the texture's shorter side. */
|
|
377
|
+
padding?: number;
|
|
378
|
+
align?: TextHotspotAlign;
|
|
379
|
+
verticalAlign?: TextHotspotVerticalAlign;
|
|
380
|
+
lineHeight?: number;
|
|
381
|
+
whiteSpace?: TextHotspotWhiteSpace;
|
|
382
|
+
/** Fraction of the texture's shorter side, from 0 to 0.5. */
|
|
383
|
+
borderRadius?: number;
|
|
384
|
+
stroke?: string;
|
|
385
|
+
strokeWidth?: number;
|
|
386
|
+
};
|
|
387
|
+
|
|
388
|
+
/** Shared serializable fields for every saved hotspot definition. */
|
|
389
|
+
type HotspotDefinitionBase = {
|
|
390
|
+
id: string;
|
|
391
|
+
/** Human-readable label; use it as the source for the rendered ariaLabel. */
|
|
392
|
+
label?: string;
|
|
393
|
+
visible?: boolean;
|
|
394
|
+
interactive?: boolean;
|
|
395
|
+
/** Pointer hit-testing. `"none"` ignores mouse, touch, and pen. */
|
|
396
|
+
pointerEvents?: HotspotPointerEvents;
|
|
397
|
+
/** Canvas cursor while this hotspot is hovered. */
|
|
398
|
+
cursor?: CSSProperties["cursor"];
|
|
399
|
+
renderOrder?: number;
|
|
400
|
+
tooltip?: string | HotspotTooltipContent;
|
|
401
|
+
tooltipTrigger?: HotspotTooltipTrigger;
|
|
402
|
+
tooltipPlacement?: HotspotTooltipPlacement;
|
|
403
|
+
tooltipOffset?: number;
|
|
404
|
+
tooltipAppearance?: HotspotTooltipAppearance;
|
|
405
|
+
};
|
|
406
|
+
/** Shared serializable fields for a hotspot anchored at one yaw/pitch point. */
|
|
407
|
+
type PointHotspotDefinitionBase = HotspotDefinitionBase & {
|
|
408
|
+
position: HotspotPosition;
|
|
409
|
+
width?: number;
|
|
410
|
+
height?: number;
|
|
411
|
+
scale?: number;
|
|
412
|
+
mode?: HotspotMode;
|
|
413
|
+
distance?: number;
|
|
414
|
+
scaleMode?: HotspotScaleMode;
|
|
415
|
+
referenceFov?: number;
|
|
416
|
+
rotation?: number;
|
|
417
|
+
opacity?: number;
|
|
418
|
+
};
|
|
419
|
+
type ImageHotspotDefinition = PointHotspotDefinitionBase & {
|
|
420
|
+
type: "image";
|
|
421
|
+
src: string;
|
|
422
|
+
};
|
|
423
|
+
type GraphicHotspotDefinition = PointHotspotDefinitionBase & {
|
|
424
|
+
type: "graphic";
|
|
425
|
+
graphic: GraphicDefinition;
|
|
426
|
+
};
|
|
427
|
+
type SequenceHotspotDefinition = PointHotspotDefinitionBase & {
|
|
428
|
+
type: "sequence";
|
|
429
|
+
src: string;
|
|
430
|
+
frameCount: number;
|
|
431
|
+
frameDirection?: "horizontal" | "vertical";
|
|
432
|
+
playing?: boolean;
|
|
433
|
+
fps?: number;
|
|
434
|
+
loop?: boolean;
|
|
435
|
+
};
|
|
436
|
+
type VideoHotspotDefinition = PointHotspotDefinitionBase & {
|
|
437
|
+
type: "video";
|
|
438
|
+
src: string;
|
|
439
|
+
poster?: string;
|
|
440
|
+
playing?: boolean;
|
|
441
|
+
loop?: boolean;
|
|
442
|
+
muted?: boolean;
|
|
443
|
+
volume?: number;
|
|
444
|
+
playsInline?: boolean;
|
|
445
|
+
preload?: "none" | "metadata" | "auto";
|
|
446
|
+
crossOrigin?: "" | "anonymous" | "use-credentials";
|
|
447
|
+
};
|
|
448
|
+
type AudioHotspotDefinition = PointHotspotDefinitionBase & {
|
|
449
|
+
type: "audio";
|
|
450
|
+
src: string | string[];
|
|
451
|
+
format?: string | string[];
|
|
452
|
+
playing?: boolean;
|
|
453
|
+
loop?: boolean;
|
|
454
|
+
muted?: boolean;
|
|
455
|
+
volume?: number;
|
|
456
|
+
pauseWhenHidden?: boolean;
|
|
457
|
+
range?: number;
|
|
458
|
+
icon?: string;
|
|
459
|
+
playingIcon?: string;
|
|
460
|
+
marker?: boolean;
|
|
461
|
+
crossOrigin?: "" | "anonymous" | "use-credentials";
|
|
462
|
+
};
|
|
463
|
+
type TextHotspotDefinition = PointHotspotDefinitionBase & TextHotspotStyle & {
|
|
464
|
+
type: "text";
|
|
465
|
+
text: string;
|
|
466
|
+
};
|
|
467
|
+
type IframeHotspotDefinition = PointHotspotDefinitionBase & {
|
|
468
|
+
type: "iframe";
|
|
469
|
+
src: string;
|
|
470
|
+
title?: string;
|
|
471
|
+
sandbox?: string;
|
|
472
|
+
allow?: string;
|
|
473
|
+
referrerPolicy?: string;
|
|
474
|
+
loading?: "eager" | "lazy";
|
|
475
|
+
pointerPolicy?: IframePointerPolicy;
|
|
476
|
+
background?: string;
|
|
477
|
+
};
|
|
478
|
+
type PolygonHotspotDefinition = HotspotDefinitionBase & {
|
|
479
|
+
type: "polygon";
|
|
480
|
+
vertices: HotspotPosition[];
|
|
481
|
+
fill?: string;
|
|
482
|
+
fillOpacity?: number;
|
|
483
|
+
stroke?: string;
|
|
484
|
+
strokeWidth?: number;
|
|
485
|
+
strokeOpacity?: number;
|
|
486
|
+
strokeDashSize?: number;
|
|
487
|
+
strokeGapSize?: number;
|
|
488
|
+
};
|
|
489
|
+
/** An open path. This extends the original point and polygon hotspot categories. */
|
|
490
|
+
type PolylineHotspotDefinition = HotspotDefinitionBase & {
|
|
491
|
+
type: "polyline";
|
|
492
|
+
vertices: HotspotPosition[];
|
|
493
|
+
stroke?: string;
|
|
494
|
+
strokeWidth?: number;
|
|
495
|
+
strokeOpacity?: number;
|
|
496
|
+
strokeDashSize?: number;
|
|
497
|
+
strokeGapSize?: number;
|
|
498
|
+
};
|
|
499
|
+
type PointHotspotDefinition = ImageHotspotDefinition | GraphicHotspotDefinition | SequenceHotspotDefinition | VideoHotspotDefinition | AudioHotspotDefinition | TextHotspotDefinition | IframeHotspotDefinition;
|
|
500
|
+
/** A serializable, discriminated hotspot collection item. */
|
|
501
|
+
type HotspotDefinition = PointHotspotDefinition | PolygonHotspotDefinition | PolylineHotspotDefinition;
|
|
502
|
+
|
|
503
|
+
type JsonValue = null | boolean | number | string | JsonValue[] | JsonObject;
|
|
504
|
+
type JsonObject = {
|
|
505
|
+
[key: string]: JsonValue;
|
|
506
|
+
};
|
|
507
|
+
declare const projectHotspotTriggers: readonly ["click", "pointerenter", "pointerleave"];
|
|
508
|
+
type ProjectHotspotTrigger = typeof projectHotspotTriggers[number];
|
|
509
|
+
type ProjectCustomHotspotAction = {
|
|
510
|
+
type: "custom";
|
|
511
|
+
actionId: string;
|
|
512
|
+
params?: JsonObject;
|
|
513
|
+
};
|
|
514
|
+
declare function hotspotAction(hotspot: ProjectHotspotDefinition, trigger: ProjectHotspotTrigger): ProjectHotspotAction | undefined;
|
|
515
|
+
declare function setHotspotAction(hotspot: ProjectHotspotDefinition, trigger: ProjectHotspotTrigger, action?: ProjectHotspotAction): ProjectHotspotDefinition;
|
|
516
|
+
type ProjectHotspotAction = ProjectCustomHotspotAction | {
|
|
517
|
+
type: "scene";
|
|
518
|
+
sceneId: string;
|
|
519
|
+
} | {
|
|
520
|
+
type: "view";
|
|
521
|
+
view: PanoViewerState;
|
|
522
|
+
duration?: number;
|
|
523
|
+
} | {
|
|
524
|
+
type: "popup";
|
|
525
|
+
popupId: string;
|
|
526
|
+
};
|
|
527
|
+
type ProjectHotspotDefinition = HotspotDefinition & {
|
|
528
|
+
/** Legacy click fallback. events.click takes precedence. */
|
|
529
|
+
action?: ProjectHotspotAction;
|
|
530
|
+
events?: Partial<Record<ProjectHotspotTrigger, ProjectHotspotAction>>;
|
|
531
|
+
};
|
|
532
|
+
declare function resolveHotspotAssets(hotspot: ProjectHotspotDefinition, baseUrl: string, sceneId: string, resolver?: AssetUrlResolver): ProjectHotspotDefinition;
|
|
533
|
+
|
|
534
|
+
type PanoProjectSceneDefinition = {
|
|
535
|
+
id: string;
|
|
536
|
+
title?: string;
|
|
537
|
+
source: ({
|
|
538
|
+
viewerUrl: string;
|
|
539
|
+
viewerConfig?: never;
|
|
540
|
+
} | {
|
|
541
|
+
viewerConfig: ViewerConfig;
|
|
542
|
+
viewerUrl?: never;
|
|
543
|
+
}) & {
|
|
544
|
+
baseUrl?: string;
|
|
545
|
+
};
|
|
546
|
+
initialView?: Partial<PanoViewerState>;
|
|
547
|
+
viewLimits?: PanoViewLimits;
|
|
548
|
+
hotspots?: ProjectHotspotDefinition[];
|
|
549
|
+
};
|
|
550
|
+
type PanoProjectDefinition = {
|
|
551
|
+
schemaVersion: 1;
|
|
552
|
+
title?: string;
|
|
553
|
+
initialSceneId?: string;
|
|
554
|
+
scenes: PanoProjectSceneDefinition[];
|
|
555
|
+
popups?: ProjectPopupDefinition[];
|
|
556
|
+
};
|
|
557
|
+
type LoadedProjectScene = {
|
|
558
|
+
scene: TileScene | SphereTileScene;
|
|
559
|
+
title?: string;
|
|
560
|
+
initialView?: PanoViewerState;
|
|
561
|
+
hotspots: ProjectHotspotDefinition[];
|
|
562
|
+
};
|
|
563
|
+
type LoadedPanoProject = {
|
|
564
|
+
title?: string;
|
|
565
|
+
initialSceneId: string;
|
|
566
|
+
scenes: LoadedProjectScene[];
|
|
567
|
+
popups?: ProjectPopupDefinition[];
|
|
568
|
+
};
|
|
569
|
+
type LoadPanoProjectOptions = JsonRequestOptions & {
|
|
570
|
+
/** Directory used for project-relative references. Required for object input. */
|
|
571
|
+
baseUrl?: string;
|
|
572
|
+
resolveAssetUrl?: AssetUrlResolver;
|
|
573
|
+
resolvePopupAssetUrl?: PopupAssetUrlResolver;
|
|
574
|
+
};
|
|
575
|
+
/** Drafts permit empty scenes and unfinished popup titles/media; loading and export always validate strictly. */
|
|
576
|
+
declare function parsePanoProject(value: unknown, options?: {
|
|
577
|
+
draft?: boolean;
|
|
578
|
+
}): PanoProjectDefinition;
|
|
579
|
+
declare function loadPanoProject(source: string | PanoProjectDefinition, options?: LoadPanoProjectOptions): Promise<LoadedPanoProject>;
|
|
580
|
+
|
|
581
|
+
export { type AssetUrlContext, type AssetUrlResolver, type CubemapViewerConfig, type JsonObject, type JsonRequestOptions, type JsonValue, type LoadPanoProjectOptions, type LoadSceneFromJsonOptions, type LoadedPanoProject, type LoadedProjectScene, PanoDataError, type PanoDataErrorCode, type PanoProjectDefinition, type PanoProjectSceneDefinition, type PanoViewLimits, type PopupAssetUrlContext, type PopupAssetUrlResolver, type ProjectCustomHotspotAction, type ProjectHotspotAction, type ProjectHotspotDefinition, type ProjectHotspotTrigger, type ProjectPopupBlock, type ProjectPopupDefinition, type SceneFromViewerConfigOptions, type SphereViewerConfig, type ViewerConfig, type ViewerDocument, hotspotAction, loadPanoProject, loadSceneFromJson, parsePanoProject, projectHotspotTriggers, resolveHotspotAssets as resolveProjectHotspotAssets, resolveProjectPopupAssets, sceneFromViewerConfig, setHotspotAction };
|