@ericchen1990/pano-view 3.0.0 → 3.1.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 +24 -1
- package/README.zh-CN.md +22 -1
- package/dist/index.cjs +762 -577
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +28 -1
- package/dist/index.d.ts +28 -1
- package/dist/index.mjs +209 -24
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -411,10 +411,37 @@ type SetPanoViewerOptions = {
|
|
|
411
411
|
/** Apply the new view immediately instead of preserving current inertia. */
|
|
412
412
|
immediate?: boolean;
|
|
413
413
|
};
|
|
414
|
+
/** Built-in interpolation curves for imperative panorama navigation. */
|
|
415
|
+
type PanoViewEasing = "linear" | "easeInOutCubic";
|
|
416
|
+
/** Common options for timed imperative panorama navigation. */
|
|
417
|
+
type PanoViewNavigationOptions = {
|
|
418
|
+
/** Animation time in milliseconds. Defaults to 700. Pass 0 to apply immediately. */
|
|
419
|
+
duration?: number;
|
|
420
|
+
/** Interpolation curve. Defaults to "easeInOutCubic". */
|
|
421
|
+
easing?: PanoViewEasing;
|
|
422
|
+
/** Whether yaw crosses the ±180° seam through the shorter path. Defaults to true. */
|
|
423
|
+
shortestPath?: boolean;
|
|
424
|
+
};
|
|
425
|
+
/** Navigation options that may also change the field of view. */
|
|
426
|
+
type PanoViewLookToOptions = PanoViewNavigationOptions & {
|
|
427
|
+
/** Target vertical field of view in degrees. Omit to preserve the current FOV. */
|
|
428
|
+
fov?: number;
|
|
429
|
+
};
|
|
430
|
+
type PanoViewNavigationResult = {
|
|
431
|
+
status: "completed" | "cancelled" | "not-found";
|
|
432
|
+
};
|
|
414
433
|
type PanoViewerHandle = {
|
|
415
434
|
getView: () => PanoViewerState;
|
|
416
435
|
setView: (view: Partial<PanoViewerState>, options?: SetPanoViewerOptions) => void;
|
|
417
436
|
reset: () => void;
|
|
437
|
+
/** Animate to a yaw/pitch position, optionally changing FOV. */
|
|
438
|
+
lookTo: (position: HotspotPosition, options?: PanoViewLookToOptions) => Promise<PanoViewNavigationResult>;
|
|
439
|
+
/** Animate yaw and pitch while preserving the current FOV. */
|
|
440
|
+
moveTo: (position: HotspotPosition, options?: PanoViewNavigationOptions) => Promise<PanoViewNavigationResult>;
|
|
441
|
+
/** Animate FOV while preserving the current yaw and pitch. */
|
|
442
|
+
zoomTo: (fov: number, options?: Omit<PanoViewNavigationOptions, "shortestPath">) => Promise<PanoViewNavigationResult>;
|
|
443
|
+
/** Animate to the representative position of a mounted hotspot. */
|
|
444
|
+
lookToHotspot: (id: string, options?: PanoViewLookToOptions) => Promise<PanoViewNavigationResult>;
|
|
418
445
|
/** Runs the same first-interaction media activation used by PanoViewer. */
|
|
419
446
|
activateMedia: () => Promise<void>;
|
|
420
447
|
enterFullscreen: () => Promise<void>;
|
|
@@ -1614,4 +1641,4 @@ type PointHotspotDefinition = ImageHotspotDefinition | GraphicHotspotDefinition
|
|
|
1614
1641
|
/** A serializable, discriminated hotspot collection item. */
|
|
1615
1642
|
type HotspotDefinition = PointHotspotDefinition | PolygonHotspotDefinition | PolylineHotspotDefinition;
|
|
1616
1643
|
|
|
1617
|
-
export { type ArrowGraphic, AudioHotspot, type AudioHotspotDefinition, type AudioHotspotErrorEvent, type AudioHotspotProps, type AudioPlaybackState, AutoRotate, type AutoRotateProps, BackgroundAudio, type BackgroundAudioController, type BackgroundAudioErrorEvent, type BackgroundAudioProps, type BackgroundAudioSnapshot, type BackgroundAudioSource, type CircleGraphic, type CubeFaceCode, DEFAULT_HOTSPOT_TOOLTIP_APPEARANCE, DEFAULT_HOTSPOT_TOOLTIP_OFFSET, DEFAULT_PANO_CURSORS, DEFAULT_PANO_VIDEO_CAPTION_APPEARANCE, DEFAULT_PANO_VIDEO_CONTROLS_APPEARANCE, DEFAULT_PANO_VIDEO_PLAYBACK_RATES, DEFAULT_WEBVR_CHROME_APPEARANCE, DEFAULT_WEBVR_CURSOR_DWELL_MS, type DiamondGraphic, type GraphicDefinition, GraphicHotspot, type GraphicHotspotDefinition, type GraphicHotspotProps, Gyro, type GyroHandle, type GyroProps, type GyroTouchMode, type HotspotCommonProps, type HotspotDefinition, type HotspotDefinitionBase, type HotspotDragEvent, type HotspotInputSource, type HotspotInteractionEvent, type HotspotMode, type HotspotPointerEvents, type HotspotPosition, type HotspotScaleMode, type HotspotTooltipAppearance, type HotspotTooltipContent, type HotspotTooltipPlacement, type HotspotTooltipTrigger, IframeHotspot, type IframeHotspotDefinition, type IframeHotspotProps, type IframePointerPolicy, ImageHotspot, type ImageHotspotDefinition, type ImageHotspotProps, type KeyboardControlAction, type KeyboardControlKeys, KeyboardControls, type KeyboardControlsProps, MAX_HOTSPOT_PITCH, MIN_PANO_CONTEXT_MENU_BACKGROUND_OPACITY, type MouseControlButton, MouseControls, type MouseControlsOptions, type MouseControlsProps, PANO_FILTER_PRESETS, PanoContextMenu, type PanoContextMenuActionItem, type PanoContextMenuAppearance, type PanoContextMenuEntry, type PanoContextMenuItem, type PanoContextMenuPresetActions, type PanoContextMenuPresetId, type PanoContextMenuPresetRef, type PanoContextMenuPresets, type PanoContextMenuProps, type PanoContextMenuRenderProps, type PanoContextMenuSelectContext, type PanoContextMenuSeparatorItem, type PanoCursor, type PanoCursors, type PanoEventBus, type PanoEventListener, type PanoEventMap, type PanoEventType, PanoEvents, type PanoEventsProps, PanoFilter, type PanoFilterPreset, type PanoFilterProps, type PanoMediaActivationControls, type PanoMediaActivationOptions, type PanoResizeEvent, PanoVideo, type PanoVideoCaptionAppearance, type PanoVideoController, PanoVideoControls, type PanoVideoControlsAppearance, type PanoVideoControlsProps, type PanoVideoErrorEvent, type PanoVideoErrorSource, type PanoVideoPlaybackSnapshot, type PanoVideoProps, type PanoVideoSource, type PanoVideoTrack, type PanoVideoTrackKind, type PanoVideoVariant, PanoViewer, type PanoViewerHandle, type PanoViewerProps, type PanoViewerState, type PanoWheelEvent, type PanoramaControlsOptions, type PanoramaPointerEvent, type PointHotspotDefinition, type PointHotspotDefinitionBase, PolygonHotspot, type PolygonHotspotDefinition, type PolygonHotspotProps, type PolygonValidationCode, type PolygonValidationIssue, type PolygonVerticesChangeEvent, PolylineHotspot, type PolylineHotspotDefinition, type PolylineHotspotProps, type PolylineValidationIssue, type PolylineVerticesChangeEvent, type RectangleGraphic, type RingGraphic, type Scene, type SceneTransition, type SceneTransitionEndEvent, type SceneTransitionErrorEvent, type SceneTransitionPreset, Scenes, type ScenesController, type ScenesProps, type SequenceFrameDirection, type SequenceFrameEvent, SequenceHotspot, type SequenceHotspotDefinition, type SequenceHotspotErrorEvent, type SequenceHotspotProps, type SequenceLoadProgress, type SequencePlaybackState, type SetPanoViewerOptions, Sphere, type SphereProps, type SphereScene, type StarGraphic, type SvgGraphic, type SvgPathGraphic, TextHotspot, type TextHotspotAlign, type TextHotspotDefinition, type TextHotspotFontStyle, type TextHotspotProps, type TextHotspotStyle, type TextHotspotVerticalAlign, type TextHotspotWhiteSpace, Tile, type TileAddress, type TileLoadError, type TileLoadProgress, type TileMultiresConfig, type TileProps, type TileScene, TouchControls, type TouchControlsOptions, type TouchControlsProps, type TriangleGraphic, type UsePanoViewerResult, VideoHotspot, type VideoHotspotDefinition, type VideoHotspotErrorEvent, type VideoHotspotProps, type VideoPlaybackState, type ViewInteractionEvent, type ViewInteractionSource, WEBVR_PROFILES, WEBVR_PROFILE_IDS, WebVR, type WebVRChrome, type WebVRChromeAppearance, type WebVRHandle, type WebVRMode, type WebVRProfile, type WebVRProfileId, type WebVRProps, type WebVRSettings, clampPanoPitch, composePanoContextMenuItems, createDefaultPanoContextMenuItems, createPanoContextMenuPresets, cycleSceneId, normalizePanoPosition, normalizePanoYaw, panoPositionToVector3, resolvePanoContextMenuEntries, unwrapPolygonVertices, usePanoEvents, usePanoViewer, validatePolygonVertices, validatePolylineVertices, vector3ToPanoPosition };
|
|
1644
|
+
export { type ArrowGraphic, AudioHotspot, type AudioHotspotDefinition, type AudioHotspotErrorEvent, type AudioHotspotProps, type AudioPlaybackState, AutoRotate, type AutoRotateProps, BackgroundAudio, type BackgroundAudioController, type BackgroundAudioErrorEvent, type BackgroundAudioProps, type BackgroundAudioSnapshot, type BackgroundAudioSource, type CircleGraphic, type CubeFaceCode, DEFAULT_HOTSPOT_TOOLTIP_APPEARANCE, DEFAULT_HOTSPOT_TOOLTIP_OFFSET, DEFAULT_PANO_CURSORS, DEFAULT_PANO_VIDEO_CAPTION_APPEARANCE, DEFAULT_PANO_VIDEO_CONTROLS_APPEARANCE, DEFAULT_PANO_VIDEO_PLAYBACK_RATES, DEFAULT_WEBVR_CHROME_APPEARANCE, DEFAULT_WEBVR_CURSOR_DWELL_MS, type DiamondGraphic, type GraphicDefinition, GraphicHotspot, type GraphicHotspotDefinition, type GraphicHotspotProps, Gyro, type GyroHandle, type GyroProps, type GyroTouchMode, type HotspotCommonProps, type HotspotDefinition, type HotspotDefinitionBase, type HotspotDragEvent, type HotspotInputSource, type HotspotInteractionEvent, type HotspotMode, type HotspotPointerEvents, type HotspotPosition, type HotspotScaleMode, type HotspotTooltipAppearance, type HotspotTooltipContent, type HotspotTooltipPlacement, type HotspotTooltipTrigger, IframeHotspot, type IframeHotspotDefinition, type IframeHotspotProps, type IframePointerPolicy, ImageHotspot, type ImageHotspotDefinition, type ImageHotspotProps, type KeyboardControlAction, type KeyboardControlKeys, KeyboardControls, type KeyboardControlsProps, MAX_HOTSPOT_PITCH, MIN_PANO_CONTEXT_MENU_BACKGROUND_OPACITY, type MouseControlButton, MouseControls, type MouseControlsOptions, type MouseControlsProps, PANO_FILTER_PRESETS, PanoContextMenu, type PanoContextMenuActionItem, type PanoContextMenuAppearance, type PanoContextMenuEntry, type PanoContextMenuItem, type PanoContextMenuPresetActions, type PanoContextMenuPresetId, type PanoContextMenuPresetRef, type PanoContextMenuPresets, type PanoContextMenuProps, type PanoContextMenuRenderProps, type PanoContextMenuSelectContext, type PanoContextMenuSeparatorItem, type PanoCursor, type PanoCursors, type PanoEventBus, type PanoEventListener, type PanoEventMap, type PanoEventType, PanoEvents, type PanoEventsProps, PanoFilter, type PanoFilterPreset, type PanoFilterProps, type PanoMediaActivationControls, type PanoMediaActivationOptions, type PanoResizeEvent, PanoVideo, type PanoVideoCaptionAppearance, type PanoVideoController, PanoVideoControls, type PanoVideoControlsAppearance, type PanoVideoControlsProps, type PanoVideoErrorEvent, type PanoVideoErrorSource, type PanoVideoPlaybackSnapshot, type PanoVideoProps, type PanoVideoSource, type PanoVideoTrack, type PanoVideoTrackKind, type PanoVideoVariant, type PanoViewEasing, type PanoViewLookToOptions, type PanoViewNavigationOptions, type PanoViewNavigationResult, PanoViewer, type PanoViewerHandle, type PanoViewerProps, type PanoViewerState, type PanoWheelEvent, type PanoramaControlsOptions, type PanoramaPointerEvent, type PointHotspotDefinition, type PointHotspotDefinitionBase, PolygonHotspot, type PolygonHotspotDefinition, type PolygonHotspotProps, type PolygonValidationCode, type PolygonValidationIssue, type PolygonVerticesChangeEvent, PolylineHotspot, type PolylineHotspotDefinition, type PolylineHotspotProps, type PolylineValidationIssue, type PolylineVerticesChangeEvent, type RectangleGraphic, type RingGraphic, type Scene, type SceneTransition, type SceneTransitionEndEvent, type SceneTransitionErrorEvent, type SceneTransitionPreset, Scenes, type ScenesController, type ScenesProps, type SequenceFrameDirection, type SequenceFrameEvent, SequenceHotspot, type SequenceHotspotDefinition, type SequenceHotspotErrorEvent, type SequenceHotspotProps, type SequenceLoadProgress, type SequencePlaybackState, type SetPanoViewerOptions, Sphere, type SphereProps, type SphereScene, type StarGraphic, type SvgGraphic, type SvgPathGraphic, TextHotspot, type TextHotspotAlign, type TextHotspotDefinition, type TextHotspotFontStyle, type TextHotspotProps, type TextHotspotStyle, type TextHotspotVerticalAlign, type TextHotspotWhiteSpace, Tile, type TileAddress, type TileLoadError, type TileLoadProgress, type TileMultiresConfig, type TileProps, type TileScene, TouchControls, type TouchControlsOptions, type TouchControlsProps, type TriangleGraphic, type UsePanoViewerResult, VideoHotspot, type VideoHotspotDefinition, type VideoHotspotErrorEvent, type VideoHotspotProps, type VideoPlaybackState, type ViewInteractionEvent, type ViewInteractionSource, WEBVR_PROFILES, WEBVR_PROFILE_IDS, WebVR, type WebVRChrome, type WebVRChromeAppearance, type WebVRHandle, type WebVRMode, type WebVRProfile, type WebVRProfileId, type WebVRProps, type WebVRSettings, clampPanoPitch, composePanoContextMenuItems, createDefaultPanoContextMenuItems, createPanoContextMenuPresets, cycleSceneId, normalizePanoPosition, normalizePanoYaw, panoPositionToVector3, resolvePanoContextMenuEntries, unwrapPolygonVertices, usePanoEvents, usePanoViewer, validatePolygonVertices, validatePolylineVertices, vector3ToPanoPosition };
|
package/dist/index.d.ts
CHANGED
|
@@ -411,10 +411,37 @@ type SetPanoViewerOptions = {
|
|
|
411
411
|
/** Apply the new view immediately instead of preserving current inertia. */
|
|
412
412
|
immediate?: boolean;
|
|
413
413
|
};
|
|
414
|
+
/** Built-in interpolation curves for imperative panorama navigation. */
|
|
415
|
+
type PanoViewEasing = "linear" | "easeInOutCubic";
|
|
416
|
+
/** Common options for timed imperative panorama navigation. */
|
|
417
|
+
type PanoViewNavigationOptions = {
|
|
418
|
+
/** Animation time in milliseconds. Defaults to 700. Pass 0 to apply immediately. */
|
|
419
|
+
duration?: number;
|
|
420
|
+
/** Interpolation curve. Defaults to "easeInOutCubic". */
|
|
421
|
+
easing?: PanoViewEasing;
|
|
422
|
+
/** Whether yaw crosses the ±180° seam through the shorter path. Defaults to true. */
|
|
423
|
+
shortestPath?: boolean;
|
|
424
|
+
};
|
|
425
|
+
/** Navigation options that may also change the field of view. */
|
|
426
|
+
type PanoViewLookToOptions = PanoViewNavigationOptions & {
|
|
427
|
+
/** Target vertical field of view in degrees. Omit to preserve the current FOV. */
|
|
428
|
+
fov?: number;
|
|
429
|
+
};
|
|
430
|
+
type PanoViewNavigationResult = {
|
|
431
|
+
status: "completed" | "cancelled" | "not-found";
|
|
432
|
+
};
|
|
414
433
|
type PanoViewerHandle = {
|
|
415
434
|
getView: () => PanoViewerState;
|
|
416
435
|
setView: (view: Partial<PanoViewerState>, options?: SetPanoViewerOptions) => void;
|
|
417
436
|
reset: () => void;
|
|
437
|
+
/** Animate to a yaw/pitch position, optionally changing FOV. */
|
|
438
|
+
lookTo: (position: HotspotPosition, options?: PanoViewLookToOptions) => Promise<PanoViewNavigationResult>;
|
|
439
|
+
/** Animate yaw and pitch while preserving the current FOV. */
|
|
440
|
+
moveTo: (position: HotspotPosition, options?: PanoViewNavigationOptions) => Promise<PanoViewNavigationResult>;
|
|
441
|
+
/** Animate FOV while preserving the current yaw and pitch. */
|
|
442
|
+
zoomTo: (fov: number, options?: Omit<PanoViewNavigationOptions, "shortestPath">) => Promise<PanoViewNavigationResult>;
|
|
443
|
+
/** Animate to the representative position of a mounted hotspot. */
|
|
444
|
+
lookToHotspot: (id: string, options?: PanoViewLookToOptions) => Promise<PanoViewNavigationResult>;
|
|
418
445
|
/** Runs the same first-interaction media activation used by PanoViewer. */
|
|
419
446
|
activateMedia: () => Promise<void>;
|
|
420
447
|
enterFullscreen: () => Promise<void>;
|
|
@@ -1614,4 +1641,4 @@ type PointHotspotDefinition = ImageHotspotDefinition | GraphicHotspotDefinition
|
|
|
1614
1641
|
/** A serializable, discriminated hotspot collection item. */
|
|
1615
1642
|
type HotspotDefinition = PointHotspotDefinition | PolygonHotspotDefinition | PolylineHotspotDefinition;
|
|
1616
1643
|
|
|
1617
|
-
export { type ArrowGraphic, AudioHotspot, type AudioHotspotDefinition, type AudioHotspotErrorEvent, type AudioHotspotProps, type AudioPlaybackState, AutoRotate, type AutoRotateProps, BackgroundAudio, type BackgroundAudioController, type BackgroundAudioErrorEvent, type BackgroundAudioProps, type BackgroundAudioSnapshot, type BackgroundAudioSource, type CircleGraphic, type CubeFaceCode, DEFAULT_HOTSPOT_TOOLTIP_APPEARANCE, DEFAULT_HOTSPOT_TOOLTIP_OFFSET, DEFAULT_PANO_CURSORS, DEFAULT_PANO_VIDEO_CAPTION_APPEARANCE, DEFAULT_PANO_VIDEO_CONTROLS_APPEARANCE, DEFAULT_PANO_VIDEO_PLAYBACK_RATES, DEFAULT_WEBVR_CHROME_APPEARANCE, DEFAULT_WEBVR_CURSOR_DWELL_MS, type DiamondGraphic, type GraphicDefinition, GraphicHotspot, type GraphicHotspotDefinition, type GraphicHotspotProps, Gyro, type GyroHandle, type GyroProps, type GyroTouchMode, type HotspotCommonProps, type HotspotDefinition, type HotspotDefinitionBase, type HotspotDragEvent, type HotspotInputSource, type HotspotInteractionEvent, type HotspotMode, type HotspotPointerEvents, type HotspotPosition, type HotspotScaleMode, type HotspotTooltipAppearance, type HotspotTooltipContent, type HotspotTooltipPlacement, type HotspotTooltipTrigger, IframeHotspot, type IframeHotspotDefinition, type IframeHotspotProps, type IframePointerPolicy, ImageHotspot, type ImageHotspotDefinition, type ImageHotspotProps, type KeyboardControlAction, type KeyboardControlKeys, KeyboardControls, type KeyboardControlsProps, MAX_HOTSPOT_PITCH, MIN_PANO_CONTEXT_MENU_BACKGROUND_OPACITY, type MouseControlButton, MouseControls, type MouseControlsOptions, type MouseControlsProps, PANO_FILTER_PRESETS, PanoContextMenu, type PanoContextMenuActionItem, type PanoContextMenuAppearance, type PanoContextMenuEntry, type PanoContextMenuItem, type PanoContextMenuPresetActions, type PanoContextMenuPresetId, type PanoContextMenuPresetRef, type PanoContextMenuPresets, type PanoContextMenuProps, type PanoContextMenuRenderProps, type PanoContextMenuSelectContext, type PanoContextMenuSeparatorItem, type PanoCursor, type PanoCursors, type PanoEventBus, type PanoEventListener, type PanoEventMap, type PanoEventType, PanoEvents, type PanoEventsProps, PanoFilter, type PanoFilterPreset, type PanoFilterProps, type PanoMediaActivationControls, type PanoMediaActivationOptions, type PanoResizeEvent, PanoVideo, type PanoVideoCaptionAppearance, type PanoVideoController, PanoVideoControls, type PanoVideoControlsAppearance, type PanoVideoControlsProps, type PanoVideoErrorEvent, type PanoVideoErrorSource, type PanoVideoPlaybackSnapshot, type PanoVideoProps, type PanoVideoSource, type PanoVideoTrack, type PanoVideoTrackKind, type PanoVideoVariant, PanoViewer, type PanoViewerHandle, type PanoViewerProps, type PanoViewerState, type PanoWheelEvent, type PanoramaControlsOptions, type PanoramaPointerEvent, type PointHotspotDefinition, type PointHotspotDefinitionBase, PolygonHotspot, type PolygonHotspotDefinition, type PolygonHotspotProps, type PolygonValidationCode, type PolygonValidationIssue, type PolygonVerticesChangeEvent, PolylineHotspot, type PolylineHotspotDefinition, type PolylineHotspotProps, type PolylineValidationIssue, type PolylineVerticesChangeEvent, type RectangleGraphic, type RingGraphic, type Scene, type SceneTransition, type SceneTransitionEndEvent, type SceneTransitionErrorEvent, type SceneTransitionPreset, Scenes, type ScenesController, type ScenesProps, type SequenceFrameDirection, type SequenceFrameEvent, SequenceHotspot, type SequenceHotspotDefinition, type SequenceHotspotErrorEvent, type SequenceHotspotProps, type SequenceLoadProgress, type SequencePlaybackState, type SetPanoViewerOptions, Sphere, type SphereProps, type SphereScene, type StarGraphic, type SvgGraphic, type SvgPathGraphic, TextHotspot, type TextHotspotAlign, type TextHotspotDefinition, type TextHotspotFontStyle, type TextHotspotProps, type TextHotspotStyle, type TextHotspotVerticalAlign, type TextHotspotWhiteSpace, Tile, type TileAddress, type TileLoadError, type TileLoadProgress, type TileMultiresConfig, type TileProps, type TileScene, TouchControls, type TouchControlsOptions, type TouchControlsProps, type TriangleGraphic, type UsePanoViewerResult, VideoHotspot, type VideoHotspotDefinition, type VideoHotspotErrorEvent, type VideoHotspotProps, type VideoPlaybackState, type ViewInteractionEvent, type ViewInteractionSource, WEBVR_PROFILES, WEBVR_PROFILE_IDS, WebVR, type WebVRChrome, type WebVRChromeAppearance, type WebVRHandle, type WebVRMode, type WebVRProfile, type WebVRProfileId, type WebVRProps, type WebVRSettings, clampPanoPitch, composePanoContextMenuItems, createDefaultPanoContextMenuItems, createPanoContextMenuPresets, cycleSceneId, normalizePanoPosition, normalizePanoYaw, panoPositionToVector3, resolvePanoContextMenuEntries, unwrapPolygonVertices, usePanoEvents, usePanoViewer, validatePolygonVertices, validatePolylineVertices, vector3ToPanoPosition };
|
|
1644
|
+
export { type ArrowGraphic, AudioHotspot, type AudioHotspotDefinition, type AudioHotspotErrorEvent, type AudioHotspotProps, type AudioPlaybackState, AutoRotate, type AutoRotateProps, BackgroundAudio, type BackgroundAudioController, type BackgroundAudioErrorEvent, type BackgroundAudioProps, type BackgroundAudioSnapshot, type BackgroundAudioSource, type CircleGraphic, type CubeFaceCode, DEFAULT_HOTSPOT_TOOLTIP_APPEARANCE, DEFAULT_HOTSPOT_TOOLTIP_OFFSET, DEFAULT_PANO_CURSORS, DEFAULT_PANO_VIDEO_CAPTION_APPEARANCE, DEFAULT_PANO_VIDEO_CONTROLS_APPEARANCE, DEFAULT_PANO_VIDEO_PLAYBACK_RATES, DEFAULT_WEBVR_CHROME_APPEARANCE, DEFAULT_WEBVR_CURSOR_DWELL_MS, type DiamondGraphic, type GraphicDefinition, GraphicHotspot, type GraphicHotspotDefinition, type GraphicHotspotProps, Gyro, type GyroHandle, type GyroProps, type GyroTouchMode, type HotspotCommonProps, type HotspotDefinition, type HotspotDefinitionBase, type HotspotDragEvent, type HotspotInputSource, type HotspotInteractionEvent, type HotspotMode, type HotspotPointerEvents, type HotspotPosition, type HotspotScaleMode, type HotspotTooltipAppearance, type HotspotTooltipContent, type HotspotTooltipPlacement, type HotspotTooltipTrigger, IframeHotspot, type IframeHotspotDefinition, type IframeHotspotProps, type IframePointerPolicy, ImageHotspot, type ImageHotspotDefinition, type ImageHotspotProps, type KeyboardControlAction, type KeyboardControlKeys, KeyboardControls, type KeyboardControlsProps, MAX_HOTSPOT_PITCH, MIN_PANO_CONTEXT_MENU_BACKGROUND_OPACITY, type MouseControlButton, MouseControls, type MouseControlsOptions, type MouseControlsProps, PANO_FILTER_PRESETS, PanoContextMenu, type PanoContextMenuActionItem, type PanoContextMenuAppearance, type PanoContextMenuEntry, type PanoContextMenuItem, type PanoContextMenuPresetActions, type PanoContextMenuPresetId, type PanoContextMenuPresetRef, type PanoContextMenuPresets, type PanoContextMenuProps, type PanoContextMenuRenderProps, type PanoContextMenuSelectContext, type PanoContextMenuSeparatorItem, type PanoCursor, type PanoCursors, type PanoEventBus, type PanoEventListener, type PanoEventMap, type PanoEventType, PanoEvents, type PanoEventsProps, PanoFilter, type PanoFilterPreset, type PanoFilterProps, type PanoMediaActivationControls, type PanoMediaActivationOptions, type PanoResizeEvent, PanoVideo, type PanoVideoCaptionAppearance, type PanoVideoController, PanoVideoControls, type PanoVideoControlsAppearance, type PanoVideoControlsProps, type PanoVideoErrorEvent, type PanoVideoErrorSource, type PanoVideoPlaybackSnapshot, type PanoVideoProps, type PanoVideoSource, type PanoVideoTrack, type PanoVideoTrackKind, type PanoVideoVariant, type PanoViewEasing, type PanoViewLookToOptions, type PanoViewNavigationOptions, type PanoViewNavigationResult, PanoViewer, type PanoViewerHandle, type PanoViewerProps, type PanoViewerState, type PanoWheelEvent, type PanoramaControlsOptions, type PanoramaPointerEvent, type PointHotspotDefinition, type PointHotspotDefinitionBase, PolygonHotspot, type PolygonHotspotDefinition, type PolygonHotspotProps, type PolygonValidationCode, type PolygonValidationIssue, type PolygonVerticesChangeEvent, PolylineHotspot, type PolylineHotspotDefinition, type PolylineHotspotProps, type PolylineValidationIssue, type PolylineVerticesChangeEvent, type RectangleGraphic, type RingGraphic, type Scene, type SceneTransition, type SceneTransitionEndEvent, type SceneTransitionErrorEvent, type SceneTransitionPreset, Scenes, type ScenesController, type ScenesProps, type SequenceFrameDirection, type SequenceFrameEvent, SequenceHotspot, type SequenceHotspotDefinition, type SequenceHotspotErrorEvent, type SequenceHotspotProps, type SequenceLoadProgress, type SequencePlaybackState, type SetPanoViewerOptions, Sphere, type SphereProps, type SphereScene, type StarGraphic, type SvgGraphic, type SvgPathGraphic, TextHotspot, type TextHotspotAlign, type TextHotspotDefinition, type TextHotspotFontStyle, type TextHotspotProps, type TextHotspotStyle, type TextHotspotVerticalAlign, type TextHotspotWhiteSpace, Tile, type TileAddress, type TileLoadError, type TileLoadProgress, type TileMultiresConfig, type TileProps, type TileScene, TouchControls, type TouchControlsOptions, type TouchControlsProps, type TriangleGraphic, type UsePanoViewerResult, VideoHotspot, type VideoHotspotDefinition, type VideoHotspotErrorEvent, type VideoHotspotProps, type VideoPlaybackState, type ViewInteractionEvent, type ViewInteractionSource, WEBVR_PROFILES, WEBVR_PROFILE_IDS, WebVR, type WebVRChrome, type WebVRChromeAppearance, type WebVRHandle, type WebVRMode, type WebVRProfile, type WebVRProfileId, type WebVRProps, type WebVRSettings, clampPanoPitch, composePanoContextMenuItems, createDefaultPanoContextMenuItems, createPanoContextMenuPresets, cycleSceneId, normalizePanoPosition, normalizePanoYaw, panoPositionToVector3, resolvePanoContextMenuEntries, unwrapPolygonVertices, usePanoEvents, usePanoViewer, validatePolygonVertices, validatePolylineVertices, vector3ToPanoPosition };
|
package/dist/index.mjs
CHANGED
|
@@ -2452,6 +2452,7 @@ var DEFAULT_ROTATE_DAMPING = 14;
|
|
|
2452
2452
|
var DEFAULT_ZOOM_DAMPING = 16;
|
|
2453
2453
|
var DEFAULT_FRICTION_STOP = 0.01;
|
|
2454
2454
|
var VIEW_SETTLE_EPSILON = 1e-3;
|
|
2455
|
+
var DEFAULT_NAVIGATION_DURATION = 700;
|
|
2455
2456
|
var PanoramaViewContext = createContext3(null);
|
|
2456
2457
|
function clamp(value, min, max) {
|
|
2457
2458
|
return Math.max(min, Math.min(max, value));
|
|
@@ -2471,6 +2472,15 @@ function resolveDamping(value, fallback) {
|
|
|
2471
2472
|
function resolveFrictionStop(value) {
|
|
2472
2473
|
return Number.isFinite(value) && value >= 0 ? value : DEFAULT_FRICTION_STOP;
|
|
2473
2474
|
}
|
|
2475
|
+
function resolveNavigationDuration(value) {
|
|
2476
|
+
return Number.isFinite(value) && value >= 0 ? value : DEFAULT_NAVIGATION_DURATION;
|
|
2477
|
+
}
|
|
2478
|
+
function applyNavigationEasing(progress, easing) {
|
|
2479
|
+
if (easing === "linear") {
|
|
2480
|
+
return progress;
|
|
2481
|
+
}
|
|
2482
|
+
return progress < 0.5 ? 4 * progress * progress * progress : 1 - Math.pow(-2 * progress + 2, 3) / 2;
|
|
2483
|
+
}
|
|
2474
2484
|
function viewsEqual(a, b) {
|
|
2475
2485
|
return a.yaw === b.yaw && a.pitch === b.pitch && a.fov === b.fov;
|
|
2476
2486
|
}
|
|
@@ -2504,13 +2514,14 @@ var PanoramaViewRuntime = forwardRef(function PanoramaViewRuntime2({ initialView
|
|
|
2504
2514
|
const xrEulerRef = useRef(new Euler(0, 0, 0, "YXZ"));
|
|
2505
2515
|
const minFovRef = useRef(minFov);
|
|
2506
2516
|
const maxFovRef = useRef(maxFov);
|
|
2517
|
+
const activeNavigationRef = useRef(null);
|
|
2507
2518
|
optionsRef.current = options;
|
|
2508
2519
|
eventBusRef.current = eventBus;
|
|
2509
2520
|
xrSessionRef.current = xrSession;
|
|
2510
2521
|
minFovRef.current = minFov;
|
|
2511
2522
|
maxFovRef.current = maxFov;
|
|
2512
2523
|
const hasInertia = () => yawVelocityRef.current !== 0 || pitchVelocityRef.current !== 0 || zoomVelocityRef.current !== 0;
|
|
2513
|
-
const isUserInteracting = () => mouseActiveRef.current || touchActiveRef.current || keyboardActiveRef.current || gyroActiveRef.current || interactionLockCountRef.current > 0 || xrSessionRef.current != null || hasInertia();
|
|
2524
|
+
const isUserInteracting = () => mouseActiveRef.current || touchActiveRef.current || keyboardActiveRef.current || gyroActiveRef.current || interactionLockCountRef.current > 0 || xrSessionRef.current != null || activeNavigationRef.current != null || hasInertia();
|
|
2514
2525
|
const syncInteracting = () => {
|
|
2515
2526
|
interactingRef.current = mouseActiveRef.current || touchActiveRef.current;
|
|
2516
2527
|
};
|
|
@@ -2552,6 +2563,14 @@ var PanoramaViewRuntime = forwardRef(function PanoramaViewRuntime2({ initialView
|
|
|
2552
2563
|
zoomVelocityRef.current = 0;
|
|
2553
2564
|
lastVelocitySampleAtRef.current = null;
|
|
2554
2565
|
};
|
|
2566
|
+
const cancelNavigation = () => {
|
|
2567
|
+
const navigation = activeNavigationRef.current;
|
|
2568
|
+
if (!navigation) {
|
|
2569
|
+
return;
|
|
2570
|
+
}
|
|
2571
|
+
activeNavigationRef.current = null;
|
|
2572
|
+
navigation.resolve({ status: "cancelled" });
|
|
2573
|
+
};
|
|
2555
2574
|
const markDirty = () => {
|
|
2556
2575
|
dirtyRef.current = true;
|
|
2557
2576
|
settledRef.current = false;
|
|
@@ -2564,6 +2583,7 @@ var PanoramaViewRuntime = forwardRef(function PanoramaViewRuntime2({ initialView
|
|
|
2564
2583
|
}
|
|
2565
2584
|
};
|
|
2566
2585
|
const acquireInteractionLock = () => {
|
|
2586
|
+
cancelNavigation();
|
|
2567
2587
|
interactionLockCountRef.current += 1;
|
|
2568
2588
|
stopVelocity();
|
|
2569
2589
|
if (mouseActiveRef.current) {
|
|
@@ -2588,6 +2608,7 @@ var PanoramaViewRuntime = forwardRef(function PanoramaViewRuntime2({ initialView
|
|
|
2588
2608
|
};
|
|
2589
2609
|
};
|
|
2590
2610
|
const setView = (view, setOptions) => {
|
|
2611
|
+
cancelNavigation();
|
|
2591
2612
|
const nextView = hardConstrainView(view);
|
|
2592
2613
|
if (gyroActiveRef.current) {
|
|
2593
2614
|
gyroOffsetRef.current = {
|
|
@@ -2602,7 +2623,66 @@ var PanoramaViewRuntime = forwardRef(function PanoramaViewRuntime2({ initialView
|
|
|
2602
2623
|
}
|
|
2603
2624
|
markDirty();
|
|
2604
2625
|
};
|
|
2626
|
+
const startNavigation = (targetInput, options2) => {
|
|
2627
|
+
cancelNavigation();
|
|
2628
|
+
if (xrSessionRef.current != null || gyroActiveRef.current || interactionLockCountRef.current > 0) {
|
|
2629
|
+
return Promise.resolve({ status: "cancelled" });
|
|
2630
|
+
}
|
|
2631
|
+
const from = { ...viewRef.current };
|
|
2632
|
+
const safeTargetInput = {
|
|
2633
|
+
yaw: targetInput.yaw !== void 0 && Number.isFinite(targetInput.yaw) ? targetInput.yaw : from.yaw,
|
|
2634
|
+
pitch: targetInput.pitch !== void 0 && Number.isFinite(targetInput.pitch) ? targetInput.pitch : from.pitch,
|
|
2635
|
+
fov: targetInput.fov !== void 0 && Number.isFinite(targetInput.fov) ? targetInput.fov : from.fov
|
|
2636
|
+
};
|
|
2637
|
+
const target = hardConstrainView(safeTargetInput, from);
|
|
2638
|
+
const duration = resolveNavigationDuration(options2?.duration);
|
|
2639
|
+
const rawYawDelta = targetInput.yaw !== void 0 && Number.isFinite(targetInput.yaw) ? safeTargetInput.yaw - from.yaw : 0;
|
|
2640
|
+
const yawDelta = options2?.shortestPath === false ? rawYawDelta : shortestYawDelta(from.yaw, target.yaw);
|
|
2641
|
+
stopVelocity();
|
|
2642
|
+
targetViewRef.current = target;
|
|
2643
|
+
markDirty();
|
|
2644
|
+
if (duration === 0) {
|
|
2645
|
+
viewRef.current = target;
|
|
2646
|
+
return Promise.resolve({ status: "completed" });
|
|
2647
|
+
}
|
|
2648
|
+
return new Promise((resolve) => {
|
|
2649
|
+
activeNavigationRef.current = {
|
|
2650
|
+
from,
|
|
2651
|
+
target,
|
|
2652
|
+
yawDelta,
|
|
2653
|
+
startedAt: performance.now(),
|
|
2654
|
+
duration,
|
|
2655
|
+
easing: options2?.easing,
|
|
2656
|
+
resolve
|
|
2657
|
+
};
|
|
2658
|
+
});
|
|
2659
|
+
};
|
|
2660
|
+
const lookTo = (position, options2) => startNavigation(
|
|
2661
|
+
{
|
|
2662
|
+
yaw: position.yaw,
|
|
2663
|
+
pitch: position.pitch,
|
|
2664
|
+
fov: options2?.fov ?? viewRef.current.fov
|
|
2665
|
+
},
|
|
2666
|
+
options2
|
|
2667
|
+
);
|
|
2668
|
+
const moveTo = (position, options2) => startNavigation(
|
|
2669
|
+
{
|
|
2670
|
+
yaw: position.yaw,
|
|
2671
|
+
pitch: position.pitch,
|
|
2672
|
+
fov: viewRef.current.fov
|
|
2673
|
+
},
|
|
2674
|
+
options2
|
|
2675
|
+
);
|
|
2676
|
+
const zoomTo = (fov, options2) => startNavigation(
|
|
2677
|
+
{
|
|
2678
|
+
yaw: viewRef.current.yaw,
|
|
2679
|
+
pitch: viewRef.current.pitch,
|
|
2680
|
+
fov
|
|
2681
|
+
},
|
|
2682
|
+
options2
|
|
2683
|
+
);
|
|
2605
2684
|
const applyViewDelta = (delta, applyOptions) => {
|
|
2685
|
+
cancelNavigation();
|
|
2606
2686
|
if (interactionLockCountRef.current > 0 || xrSessionRef.current != null) {
|
|
2607
2687
|
return false;
|
|
2608
2688
|
}
|
|
@@ -2653,10 +2733,16 @@ var PanoramaViewRuntime = forwardRef(function PanoramaViewRuntime2({ initialView
|
|
|
2653
2733
|
getTargetView: () => ({ ...targetViewRef.current }),
|
|
2654
2734
|
setView,
|
|
2655
2735
|
reset: () => setView(initialViewRef.current),
|
|
2736
|
+
lookTo,
|
|
2737
|
+
moveTo,
|
|
2738
|
+
zoomTo,
|
|
2656
2739
|
applyViewDelta,
|
|
2657
2740
|
setKeyboardActive: (active) => {
|
|
2658
2741
|
const wasActive = keyboardActiveRef.current;
|
|
2659
2742
|
keyboardActiveRef.current = active;
|
|
2743
|
+
if (active) {
|
|
2744
|
+
cancelNavigation();
|
|
2745
|
+
}
|
|
2660
2746
|
if (active && !wasActive) {
|
|
2661
2747
|
eventBusRef.current.emit("viewinteractionstart", {
|
|
2662
2748
|
source: "keyboard"
|
|
@@ -2674,6 +2760,9 @@ var PanoramaViewRuntime = forwardRef(function PanoramaViewRuntime2({ initialView
|
|
|
2674
2760
|
} else {
|
|
2675
2761
|
touchActiveRef.current = active;
|
|
2676
2762
|
}
|
|
2763
|
+
if (active) {
|
|
2764
|
+
cancelNavigation();
|
|
2765
|
+
}
|
|
2677
2766
|
syncInteracting();
|
|
2678
2767
|
if (active && !wasActive) {
|
|
2679
2768
|
eventBusRef.current.emit("viewinteractionstart", { source });
|
|
@@ -2690,6 +2779,9 @@ var PanoramaViewRuntime = forwardRef(function PanoramaViewRuntime2({ initialView
|
|
|
2690
2779
|
isInteractionLocked: () => interactionLockCountRef.current > 0,
|
|
2691
2780
|
isUserInteracting,
|
|
2692
2781
|
setGyroActive: (active) => {
|
|
2782
|
+
if (active) {
|
|
2783
|
+
cancelNavigation();
|
|
2784
|
+
}
|
|
2693
2785
|
gyroActiveRef.current = active;
|
|
2694
2786
|
gyroOffsetRef.current = { yaw: 0, pitch: 0 };
|
|
2695
2787
|
stopVelocity();
|
|
@@ -2726,7 +2818,7 @@ var PanoramaViewRuntime = forwardRef(function PanoramaViewRuntime2({ initialView
|
|
|
2726
2818
|
acquireInteractionLock,
|
|
2727
2819
|
applyAutoRotation: (yawDelta) => {
|
|
2728
2820
|
const inertiaFinished = yawVelocityRef.current === 0 && pitchVelocityRef.current === 0 && zoomVelocityRef.current === 0;
|
|
2729
|
-
if (!Number.isFinite(yawDelta) || xrSessionRef.current != null || gyroActiveRef.current || interactionLockCountRef.current > 0 || interactingRef.current || keyboardActiveRef.current || !inertiaFinished) {
|
|
2821
|
+
if (!Number.isFinite(yawDelta) || xrSessionRef.current != null || activeNavigationRef.current != null || gyroActiveRef.current || interactionLockCountRef.current > 0 || interactingRef.current || keyboardActiveRef.current || !inertiaFinished) {
|
|
2730
2822
|
return false;
|
|
2731
2823
|
}
|
|
2732
2824
|
targetViewRef.current.yaw += yawDelta;
|
|
@@ -2736,6 +2828,12 @@ var PanoramaViewRuntime = forwardRef(function PanoramaViewRuntime2({ initialView
|
|
|
2736
2828
|
}),
|
|
2737
2829
|
[]
|
|
2738
2830
|
);
|
|
2831
|
+
useEffect(
|
|
2832
|
+
() => () => {
|
|
2833
|
+
cancelNavigation();
|
|
2834
|
+
},
|
|
2835
|
+
[]
|
|
2836
|
+
);
|
|
2739
2837
|
useEffect(() => {
|
|
2740
2838
|
initialViewRef.current = { ...initialView };
|
|
2741
2839
|
setView(initialView);
|
|
@@ -2745,6 +2843,7 @@ var PanoramaViewRuntime = forwardRef(function PanoramaViewRuntime2({ initialView
|
|
|
2745
2843
|
return;
|
|
2746
2844
|
}
|
|
2747
2845
|
if (xrSessionRef.current && gl.xr.isPresenting) {
|
|
2846
|
+
cancelNavigation();
|
|
2748
2847
|
const xrCamera = gl.xr.getCamera();
|
|
2749
2848
|
xrEulerRef.current.setFromQuaternion(xrCamera.quaternion, "YXZ");
|
|
2750
2849
|
const nextView2 = {
|
|
@@ -2765,6 +2864,48 @@ var PanoramaViewRuntime = forwardRef(function PanoramaViewRuntime2({ initialView
|
|
|
2765
2864
|
}
|
|
2766
2865
|
return;
|
|
2767
2866
|
}
|
|
2867
|
+
const navigation = activeNavigationRef.current;
|
|
2868
|
+
if (navigation) {
|
|
2869
|
+
const progress = Math.min(
|
|
2870
|
+
1,
|
|
2871
|
+
Math.max(0, (performance.now() - navigation.startedAt) / navigation.duration)
|
|
2872
|
+
);
|
|
2873
|
+
const easedProgress = applyNavigationEasing(progress, navigation.easing);
|
|
2874
|
+
const nextView2 = {
|
|
2875
|
+
yaw: normalizeYaw(navigation.from.yaw + navigation.yawDelta * easedProgress),
|
|
2876
|
+
pitch: navigation.from.pitch + (navigation.target.pitch - navigation.from.pitch) * easedProgress,
|
|
2877
|
+
fov: navigation.from.fov + (navigation.target.fov - navigation.from.fov) * easedProgress
|
|
2878
|
+
};
|
|
2879
|
+
const completed = progress === 1;
|
|
2880
|
+
viewRef.current = completed ? { ...navigation.target } : nextView2;
|
|
2881
|
+
eulerRef.current.set(
|
|
2882
|
+
MathUtils.degToRad(viewRef.current.pitch),
|
|
2883
|
+
MathUtils.degToRad(-viewRef.current.yaw),
|
|
2884
|
+
MathUtils.degToRad(cameraRollRef.current),
|
|
2885
|
+
"YXZ"
|
|
2886
|
+
);
|
|
2887
|
+
camera.quaternion.setFromEuler(eulerRef.current);
|
|
2888
|
+
camera.fov = viewRef.current.fov;
|
|
2889
|
+
camera.updateProjectionMatrix();
|
|
2890
|
+
camera.updateMatrixWorld();
|
|
2891
|
+
const emittedView = { ...viewRef.current };
|
|
2892
|
+
const lastEmitted2 = lastEmittedViewRef.current;
|
|
2893
|
+
if (!lastEmitted2 || !viewsEqual(lastEmitted2, emittedView)) {
|
|
2894
|
+
lastEmittedViewRef.current = emittedView;
|
|
2895
|
+
eventBusRef.current.emit("viewchange", emittedView);
|
|
2896
|
+
}
|
|
2897
|
+
if (completed) {
|
|
2898
|
+
activeNavigationRef.current = null;
|
|
2899
|
+
settledRef.current = true;
|
|
2900
|
+
eventBusRef.current.emit("viewsettled", emittedView);
|
|
2901
|
+
navigation.resolve({ status: "completed" });
|
|
2902
|
+
dirtyRef.current = false;
|
|
2903
|
+
} else {
|
|
2904
|
+
settledRef.current = false;
|
|
2905
|
+
dirtyRef.current = true;
|
|
2906
|
+
}
|
|
2907
|
+
return;
|
|
2908
|
+
}
|
|
2768
2909
|
const frictionStop = resolveFrictionStop(optionsRef.current.frictionStop);
|
|
2769
2910
|
const inertiaEnabled = optionsRef.current.inertia !== false;
|
|
2770
2911
|
if (!interactingRef.current && !gyroActiveRef.current && inertiaEnabled) {
|
|
@@ -3115,6 +3256,30 @@ function useHotspotAccessibilityLayer() {
|
|
|
3115
3256
|
return { controls, registry };
|
|
3116
3257
|
}
|
|
3117
3258
|
|
|
3259
|
+
// src/hotspot/target-registry.ts
|
|
3260
|
+
import { createContext as createContext6 } from "react";
|
|
3261
|
+
var HotspotTargetRegistryContext = createContext6(
|
|
3262
|
+
null
|
|
3263
|
+
);
|
|
3264
|
+
function createHotspotTargetRegistry() {
|
|
3265
|
+
const targets = /* @__PURE__ */ new Map();
|
|
3266
|
+
return {
|
|
3267
|
+
getPosition: (id) => {
|
|
3268
|
+
const target = targets.get(id);
|
|
3269
|
+
return target ? { ...target.position } : null;
|
|
3270
|
+
},
|
|
3271
|
+
register: (id, position) => {
|
|
3272
|
+
const token = Symbol(id);
|
|
3273
|
+
targets.set(id, { token, position: { ...position } });
|
|
3274
|
+
return () => {
|
|
3275
|
+
if (targets.get(id)?.token === token) {
|
|
3276
|
+
targets.delete(id);
|
|
3277
|
+
}
|
|
3278
|
+
};
|
|
3279
|
+
}
|
|
3280
|
+
};
|
|
3281
|
+
}
|
|
3282
|
+
|
|
3118
3283
|
// src/keyboard-controls.tsx
|
|
3119
3284
|
import { useFrame as useFrame3, useThree as useThree2 } from "@react-three/fiber";
|
|
3120
3285
|
import { useContext as useContext4, useEffect as useEffect4, useMemo as useMemo2, useRef as useRef4 } from "react";
|
|
@@ -3532,7 +3697,7 @@ function MouseControls({
|
|
|
3532
3697
|
}
|
|
3533
3698
|
|
|
3534
3699
|
// src/pano-filter/host.ts
|
|
3535
|
-
import { createContext as
|
|
3700
|
+
import { createContext as createContext7, useContext as useContext6, useSyncExternalStore } from "react";
|
|
3536
3701
|
|
|
3537
3702
|
// src/pano-filter/presets.ts
|
|
3538
3703
|
var PANO_FILTER_PRESETS = [
|
|
@@ -3573,7 +3738,7 @@ function isPanoFilterActive(snapshot) {
|
|
|
3573
3738
|
}
|
|
3574
3739
|
|
|
3575
3740
|
// src/pano-filter/host.ts
|
|
3576
|
-
var PanoFilterHostContext =
|
|
3741
|
+
var PanoFilterHostContext = createContext7(null);
|
|
3577
3742
|
function createPanoFilterHost() {
|
|
3578
3743
|
return {
|
|
3579
3744
|
snapshot: { ...DEFAULT_PANO_FILTER_SNAPSHOT },
|
|
@@ -3642,9 +3807,9 @@ function isProduction2() {
|
|
|
3642
3807
|
}
|
|
3643
3808
|
|
|
3644
3809
|
// src/media-activation.tsx
|
|
3645
|
-
import { createContext as
|
|
3810
|
+
import { createContext as createContext8, useContext as useContext7, useEffect as useEffect6, useRef as useRef6 } from "react";
|
|
3646
3811
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
3647
|
-
var PanoMediaActivationHostContext =
|
|
3812
|
+
var PanoMediaActivationHostContext = createContext8(null);
|
|
3648
3813
|
function createPanoMediaActivationHost() {
|
|
3649
3814
|
return { intents: /* @__PURE__ */ new Set(), listeners: /* @__PURE__ */ new Set(), revision: 0 };
|
|
3650
3815
|
}
|
|
@@ -3705,7 +3870,7 @@ function PanoMediaActivationOverlay({
|
|
|
3705
3870
|
|
|
3706
3871
|
// src/pano-context-menu.tsx
|
|
3707
3872
|
import {
|
|
3708
|
-
createContext as
|
|
3873
|
+
createContext as createContext9,
|
|
3709
3874
|
useCallback as useCallback2,
|
|
3710
3875
|
useContext as useContext8,
|
|
3711
3876
|
useEffect as useEffect7,
|
|
@@ -3719,7 +3884,7 @@ import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
|
3719
3884
|
var DEFAULT_ICON_SIZE = 16;
|
|
3720
3885
|
var MENU_EDGE_PADDING = 8;
|
|
3721
3886
|
var MIN_PANO_CONTEXT_MENU_BACKGROUND_OPACITY = 0.4;
|
|
3722
|
-
var PanoContextMenuOverlayContext =
|
|
3887
|
+
var PanoContextMenuOverlayContext = createContext9(null);
|
|
3723
3888
|
var DEFAULT_APPEARANCE = {
|
|
3724
3889
|
background: "#161616",
|
|
3725
3890
|
color: "#f4f4f4",
|
|
@@ -4397,12 +4562,12 @@ function composePanoContextMenuItems(props, presets) {
|
|
|
4397
4562
|
...resolvePanoContextMenuEntries(props.append ?? [], presets)
|
|
4398
4563
|
];
|
|
4399
4564
|
}
|
|
4400
|
-
var PanoContextMenuActionsContext =
|
|
4565
|
+
var PanoContextMenuActionsContext = createContext9(null);
|
|
4401
4566
|
|
|
4402
4567
|
// src/pano-cursor.tsx
|
|
4403
4568
|
import { useThree as useThree4 } from "@react-three/fiber";
|
|
4404
4569
|
import {
|
|
4405
|
-
createContext as
|
|
4570
|
+
createContext as createContext10,
|
|
4406
4571
|
useCallback as useCallback3,
|
|
4407
4572
|
useContext as useContext9,
|
|
4408
4573
|
useEffect as useEffect8,
|
|
@@ -4423,7 +4588,7 @@ var LAYER_PRIORITY = {
|
|
|
4423
4588
|
hotspotDragging: 3,
|
|
4424
4589
|
hidden: 4
|
|
4425
4590
|
};
|
|
4426
|
-
var PanoCursorContext =
|
|
4591
|
+
var PanoCursorContext = createContext10(null);
|
|
4427
4592
|
function usePanoCursor() {
|
|
4428
4593
|
return useContext9(PanoCursorContext);
|
|
4429
4594
|
}
|
|
@@ -4998,8 +5163,8 @@ function PanoramaEventSurface() {
|
|
|
4998
5163
|
}
|
|
4999
5164
|
|
|
5000
5165
|
// src/scenes-host.ts
|
|
5001
|
-
import { createContext as
|
|
5002
|
-
var ScenesHostContext =
|
|
5166
|
+
import { createContext as createContext11 } from "react";
|
|
5167
|
+
var ScenesHostContext = createContext11(null);
|
|
5003
5168
|
function createScenesHost() {
|
|
5004
5169
|
return {
|
|
5005
5170
|
controller: null,
|
|
@@ -5162,9 +5327,9 @@ function TouchControls({
|
|
|
5162
5327
|
}
|
|
5163
5328
|
|
|
5164
5329
|
// src/video/chrome-overlay.tsx
|
|
5165
|
-
import { createContext as
|
|
5330
|
+
import { createContext as createContext12, useCallback as useCallback4, useMemo as useMemo5, useState as useState3 } from "react";
|
|
5166
5331
|
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
5167
|
-
var PanoChromeOverlayContext =
|
|
5332
|
+
var PanoChromeOverlayContext = createContext12(null);
|
|
5168
5333
|
function usePanoChromeOverlay() {
|
|
5169
5334
|
const [overlayElement, setOverlayElement] = useState3(
|
|
5170
5335
|
null
|
|
@@ -5188,9 +5353,9 @@ function usePanoChromeOverlay() {
|
|
|
5188
5353
|
}
|
|
5189
5354
|
|
|
5190
5355
|
// src/video/host.ts
|
|
5191
|
-
import { createContext as
|
|
5192
|
-
var PanoVideoHostContext =
|
|
5193
|
-
var DefaultPanoVideoControlsContext =
|
|
5356
|
+
import { createContext as createContext13, useContext as useContext13 } from "react";
|
|
5357
|
+
var PanoVideoHostContext = createContext13(null);
|
|
5358
|
+
var DefaultPanoVideoControlsContext = createContext13(false);
|
|
5194
5359
|
function createPanoVideoHost() {
|
|
5195
5360
|
return {
|
|
5196
5361
|
controller: null,
|
|
@@ -6461,8 +6626,8 @@ function PanoVideoChromeBridge({
|
|
|
6461
6626
|
import { useSyncExternalStore as useSyncExternalStore5 } from "react";
|
|
6462
6627
|
|
|
6463
6628
|
// src/webvr/host.ts
|
|
6464
|
-
import { createContext as
|
|
6465
|
-
var WebVRRuntimeContext =
|
|
6629
|
+
import { createContext as createContext14 } from "react";
|
|
6630
|
+
var WebVRRuntimeContext = createContext14(null);
|
|
6466
6631
|
function createWebVRHost() {
|
|
6467
6632
|
return {
|
|
6468
6633
|
controller: null,
|
|
@@ -6939,6 +7104,7 @@ var PanoViewer = forwardRef2(
|
|
|
6939
7104
|
const controlsRef = useRef13(null);
|
|
6940
7105
|
const eventBus = useMemo7(() => createPanoEventBus(), []);
|
|
6941
7106
|
const { controls: hotspotAccessibilityControls, registry } = useHotspotAccessibilityLayer();
|
|
7107
|
+
const hotspotTargetRegistry = useMemo7(() => createHotspotTargetRegistry(), []);
|
|
6942
7108
|
const { api: contextMenuOverlayApi, overlay: contextMenuOverlay } = usePanoContextMenuOverlay();
|
|
6943
7109
|
const { api: chromeOverlayApi, setOverlayNode, overlayElement } = usePanoChromeOverlay();
|
|
6944
7110
|
const videoHost = useMemo7(() => createPanoVideoHost(), []);
|
|
@@ -7174,6 +7340,13 @@ var PanoViewer = forwardRef2(
|
|
|
7174
7340
|
reset: () => {
|
|
7175
7341
|
controlsRef.current?.reset();
|
|
7176
7342
|
},
|
|
7343
|
+
lookTo: (position, options) => controlsRef.current?.lookTo(position, options) ?? Promise.resolve({ status: "cancelled" }),
|
|
7344
|
+
moveTo: (position, options) => controlsRef.current?.moveTo(position, options) ?? Promise.resolve({ status: "cancelled" }),
|
|
7345
|
+
zoomTo: (fov, options) => controlsRef.current?.zoomTo(fov, options) ?? Promise.resolve({ status: "cancelled" }),
|
|
7346
|
+
lookToHotspot: (id, options) => {
|
|
7347
|
+
const position = hotspotTargetRegistry.getPosition(id);
|
|
7348
|
+
return position ? controlsRef.current?.lookTo(position, options) ?? Promise.resolve({ status: "cancelled" }) : Promise.resolve({ status: "not-found" });
|
|
7349
|
+
},
|
|
7177
7350
|
activateMedia,
|
|
7178
7351
|
// -- Fullscreen --
|
|
7179
7352
|
enterFullscreen,
|
|
@@ -7231,6 +7404,7 @@ var PanoViewer = forwardRef2(
|
|
|
7231
7404
|
enterFullscreen,
|
|
7232
7405
|
exitFullscreen,
|
|
7233
7406
|
scenesHost,
|
|
7407
|
+
hotspotTargetRegistry,
|
|
7234
7408
|
toggleFullscreen,
|
|
7235
7409
|
videoHost,
|
|
7236
7410
|
webVRHost
|
|
@@ -7282,7 +7456,7 @@ var PanoViewer = forwardRef2(
|
|
|
7282
7456
|
value: { host: webVRHost, xrStore, stereoView },
|
|
7283
7457
|
children: [
|
|
7284
7458
|
/* @__PURE__ */ jsx12(PanoramaXROrigin, {}),
|
|
7285
|
-
/* @__PURE__ */ jsx12(HotspotAccessibilityContext.Provider, { value: registry, children: /* @__PURE__ */ jsx12(PanoEventBusContext.Provider, { value: eventBus, children: /* @__PURE__ */ jsx12(PanoCursorTree, { cursors: resolvedCursors, children: /* @__PURE__ */ jsx12(PanoramaViewContext.Provider, { value: controlsRef, children: /* @__PURE__ */ jsx12(
|
|
7459
|
+
/* @__PURE__ */ jsx12(HotspotAccessibilityContext.Provider, { value: registry, children: /* @__PURE__ */ jsx12(HotspotTargetRegistryContext.Provider, { value: hotspotTargetRegistry, children: /* @__PURE__ */ jsx12(PanoEventBusContext.Provider, { value: eventBus, children: /* @__PURE__ */ jsx12(PanoCursorTree, { cursors: resolvedCursors, children: /* @__PURE__ */ jsx12(PanoramaViewContext.Provider, { value: controlsRef, children: /* @__PURE__ */ jsx12(
|
|
7286
7460
|
PanoContextMenuOverlayContext.Provider,
|
|
7287
7461
|
{
|
|
7288
7462
|
value: contextMenuOverlayApi,
|
|
@@ -7338,7 +7512,7 @@ var PanoViewer = forwardRef2(
|
|
|
7338
7512
|
}
|
|
7339
7513
|
) }) }) })
|
|
7340
7514
|
}
|
|
7341
|
-
) }) }) }) })
|
|
7515
|
+
) }) }) }) }) })
|
|
7342
7516
|
]
|
|
7343
7517
|
}
|
|
7344
7518
|
) })
|
|
@@ -9364,6 +9538,10 @@ function createPanoViewerHandle(ref) {
|
|
|
9364
9538
|
reset: () => {
|
|
9365
9539
|
ref.current?.reset();
|
|
9366
9540
|
},
|
|
9541
|
+
lookTo: (position, options) => ref.current?.lookTo(position, options) ?? Promise.resolve({ status: "cancelled" }),
|
|
9542
|
+
moveTo: (position, options) => ref.current?.moveTo(position, options) ?? Promise.resolve({ status: "cancelled" }),
|
|
9543
|
+
zoomTo: (fov, options) => ref.current?.zoomTo(fov, options) ?? Promise.resolve({ status: "cancelled" }),
|
|
9544
|
+
lookToHotspot: (id, options) => ref.current?.lookToHotspot(id, options) ?? Promise.resolve({ status: "not-found" }),
|
|
9367
9545
|
activateMedia: () => ref.current?.activateMedia() ?? Promise.resolve(),
|
|
9368
9546
|
enterFullscreen: () => ref.current?.enterFullscreen() ?? Promise.resolve(),
|
|
9369
9547
|
exitFullscreen: () => ref.current?.exitFullscreen() ?? Promise.resolve(),
|
|
@@ -11210,7 +11388,7 @@ function TransitionOverlay(props) {
|
|
|
11210
11388
|
// src/tile/texture-manager-context.tsx
|
|
11211
11389
|
import { useThree as useThree17 } from "@react-three/fiber";
|
|
11212
11390
|
import {
|
|
11213
|
-
createContext as
|
|
11391
|
+
createContext as createContext15,
|
|
11214
11392
|
useContext as useContext22,
|
|
11215
11393
|
useEffect as useEffect25,
|
|
11216
11394
|
useMemo as useMemo18
|
|
@@ -11444,7 +11622,7 @@ var TileTextureManager = class {
|
|
|
11444
11622
|
|
|
11445
11623
|
// src/tile/texture-manager-context.tsx
|
|
11446
11624
|
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
11447
|
-
var TileTextureManagerContext =
|
|
11625
|
+
var TileTextureManagerContext = createContext15(
|
|
11448
11626
|
null
|
|
11449
11627
|
);
|
|
11450
11628
|
function TileTextureManagerProvider({
|
|
@@ -13193,6 +13371,7 @@ function HotspotAnchor({
|
|
|
13193
13371
|
onDragEnd
|
|
13194
13372
|
}) {
|
|
13195
13373
|
const controlsRef = useContext25(PanoramaViewContext);
|
|
13374
|
+
const hotspotTargetRegistry = useContext25(HotspotTargetRegistryContext);
|
|
13196
13375
|
const eventBus = useContext25(PanoEventBusContext);
|
|
13197
13376
|
const cursorApi = usePanoCursor();
|
|
13198
13377
|
const { camera, size } = useThree20();
|
|
@@ -13208,6 +13387,12 @@ function HotspotAnchor({
|
|
|
13208
13387
|
[tooltip]
|
|
13209
13388
|
);
|
|
13210
13389
|
const normalizedPosition = normalizePanoPosition(position);
|
|
13390
|
+
useEffect29(() => {
|
|
13391
|
+
if (!hotspotTargetRegistry) {
|
|
13392
|
+
return;
|
|
13393
|
+
}
|
|
13394
|
+
return hotspotTargetRegistry.register(id, normalizedPosition);
|
|
13395
|
+
}, [hotspotTargetRegistry, id, normalizedPosition.pitch, normalizedPosition.yaw]);
|
|
13211
13396
|
const rendering = internalOrientation && internalPlacement ? { orientation: internalOrientation, placement: internalPlacement } : HOTSPOT_MODE_RENDERING[mode];
|
|
13212
13397
|
const { orientation: orientation2, placement } = rendering;
|
|
13213
13398
|
const resolvedScale = resolveScale(scale);
|