@ericchen1990/pano-view 3.8.0 → 3.10.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/dist/data.d.mts CHANGED
@@ -531,6 +531,17 @@ type ProjectHotspotDefinition = HotspotDefinition & {
531
531
  };
532
532
  declare function resolveHotspotAssets(hotspot: ProjectHotspotDefinition, baseUrl: string, sceneId: string, resolver?: AssetUrlResolver): ProjectHotspotDefinition;
533
533
 
534
+ /**
535
+ * Shared drag inertia and edge bounce for map pan and scene-menu scrolling.
536
+ * Axis motion is pure; hosts own pointer capture and rAF loops.
537
+ */
538
+ type PanoDragMotion = {
539
+ /** Continue sliding after release from pointer velocity. Defaults to true. */
540
+ inertia?: boolean;
541
+ /** Rubber-band past edges while dragging; spring back on release. Defaults to true. */
542
+ bounce?: boolean;
543
+ };
544
+
534
545
  type PanoMapCorner = "top-left" | "top-right" | "bottom-left" | "bottom-right";
535
546
  type PanoMapGradientStop = {
536
547
  offset: number;
@@ -622,6 +633,11 @@ type PanoMapDefinition = {
622
633
  * Only applies when `interaction` is `"zoom"`. Defaults to 8.
623
634
  */
624
635
  maxScale?: number;
636
+ /**
637
+ * Pan inertia and edge bounce when `interaction` is `"zoom"`.
638
+ * Omit for both on; set `false` or flag fields to disable.
639
+ */
640
+ dragMotion?: PanoDragMotion | false;
625
641
  spots: PanoMapSpotDefinition[];
626
642
  sector?: PanoMapSectorDefinition;
627
643
  };
@@ -680,4 +696,4 @@ declare function parsePanoProject(value: unknown, options?: {
680
696
  }): PanoProjectDefinition;
681
697
  declare function loadPanoProject(source: string | PanoProjectDefinition, options?: LoadPanoProjectOptions): Promise<LoadedPanoProject>;
682
698
 
683
- 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 PanoMapControlsDefinition, type PanoMapCorner, type PanoMapDefinition, type PanoMapDialogPresentation, type PanoMapDockedPresentation, type PanoMapGradientStop, type PanoMapPresentation, type PanoMapSectorDefinition, type PanoMapSectorGradient, type PanoMapSpotDefinition, 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, parsePanoMap, parsePanoProject, projectHotspotTriggers, resolvePanoMapAssets, resolveHotspotAssets as resolveProjectHotspotAssets, resolveProjectPopupAssets, sceneFromViewerConfig, setHotspotAction };
699
+ 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 PanoDragMotion, type PanoMapControlsDefinition, type PanoMapCorner, type PanoMapDefinition, type PanoMapDialogPresentation, type PanoMapDockedPresentation, type PanoMapGradientStop, type PanoMapPresentation, type PanoMapSectorDefinition, type PanoMapSectorGradient, type PanoMapSpotDefinition, 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, parsePanoMap, parsePanoProject, projectHotspotTriggers, resolvePanoMapAssets, resolveHotspotAssets as resolveProjectHotspotAssets, resolveProjectPopupAssets, sceneFromViewerConfig, setHotspotAction };
package/dist/data.d.ts CHANGED
@@ -531,6 +531,17 @@ type ProjectHotspotDefinition = HotspotDefinition & {
531
531
  };
532
532
  declare function resolveHotspotAssets(hotspot: ProjectHotspotDefinition, baseUrl: string, sceneId: string, resolver?: AssetUrlResolver): ProjectHotspotDefinition;
533
533
 
534
+ /**
535
+ * Shared drag inertia and edge bounce for map pan and scene-menu scrolling.
536
+ * Axis motion is pure; hosts own pointer capture and rAF loops.
537
+ */
538
+ type PanoDragMotion = {
539
+ /** Continue sliding after release from pointer velocity. Defaults to true. */
540
+ inertia?: boolean;
541
+ /** Rubber-band past edges while dragging; spring back on release. Defaults to true. */
542
+ bounce?: boolean;
543
+ };
544
+
534
545
  type PanoMapCorner = "top-left" | "top-right" | "bottom-left" | "bottom-right";
535
546
  type PanoMapGradientStop = {
536
547
  offset: number;
@@ -622,6 +633,11 @@ type PanoMapDefinition = {
622
633
  * Only applies when `interaction` is `"zoom"`. Defaults to 8.
623
634
  */
624
635
  maxScale?: number;
636
+ /**
637
+ * Pan inertia and edge bounce when `interaction` is `"zoom"`.
638
+ * Omit for both on; set `false` or flag fields to disable.
639
+ */
640
+ dragMotion?: PanoDragMotion | false;
625
641
  spots: PanoMapSpotDefinition[];
626
642
  sector?: PanoMapSectorDefinition;
627
643
  };
@@ -680,4 +696,4 @@ declare function parsePanoProject(value: unknown, options?: {
680
696
  }): PanoProjectDefinition;
681
697
  declare function loadPanoProject(source: string | PanoProjectDefinition, options?: LoadPanoProjectOptions): Promise<LoadedPanoProject>;
682
698
 
683
- 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 PanoMapControlsDefinition, type PanoMapCorner, type PanoMapDefinition, type PanoMapDialogPresentation, type PanoMapDockedPresentation, type PanoMapGradientStop, type PanoMapPresentation, type PanoMapSectorDefinition, type PanoMapSectorGradient, type PanoMapSpotDefinition, 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, parsePanoMap, parsePanoProject, projectHotspotTriggers, resolvePanoMapAssets, resolveHotspotAssets as resolveProjectHotspotAssets, resolveProjectPopupAssets, sceneFromViewerConfig, setHotspotAction };
699
+ 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 PanoDragMotion, type PanoMapControlsDefinition, type PanoMapCorner, type PanoMapDefinition, type PanoMapDialogPresentation, type PanoMapDockedPresentation, type PanoMapGradientStop, type PanoMapPresentation, type PanoMapSectorDefinition, type PanoMapSectorGradient, type PanoMapSpotDefinition, 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, parsePanoMap, parsePanoProject, projectHotspotTriggers, resolvePanoMapAssets, resolveHotspotAssets as resolveProjectHotspotAssets, resolveProjectPopupAssets, sceneFromViewerConfig, setHotspotAction };
package/dist/data.mjs CHANGED
@@ -914,6 +914,23 @@ function parsePresentation(value, field) {
914
914
  ...offsetY === void 0 ? {} : { offsetY }
915
915
  };
916
916
  }
917
+ function parseOptionalBoolean(value, field) {
918
+ if (value === void 0) return void 0;
919
+ if (value === true) return true;
920
+ if (value === false) return false;
921
+ throw new Error(`${field}: expected a boolean`);
922
+ }
923
+ function parseDragMotion(value, field) {
924
+ if (value === false) return false;
925
+ if (!isRecord(value)) throw new Error(`${field}: expected an object or false`);
926
+ const inertia = parseOptionalBoolean(value.inertia, `${field}.inertia`);
927
+ const bounce = parseOptionalBoolean(value.bounce, `${field}.bounce`);
928
+ const motion = {
929
+ ...inertia === void 0 ? {} : { inertia },
930
+ ...bounce === void 0 ? {} : { bounce }
931
+ };
932
+ return motion;
933
+ }
917
934
  function parseControls(value, field) {
918
935
  if (!isRecord(value)) throw new Error(`${field}: expected an object`);
919
936
  const collapse = value.collapse === void 0 ? void 0 : value.collapse === true ? true : value.collapse === false ? false : (() => {
@@ -962,6 +979,7 @@ function parsePanoMap(value, sceneIds, options = {}) {
962
979
  const controls = value.controls === void 0 ? void 0 : parseControls(value.controls, "map.controls");
963
980
  const iconSize = optionalNumber(value, "iconSize", { exclusiveMin: 0 });
964
981
  const maxScale = optionalNumber(value, "maxScale", { min: 1 });
982
+ const dragMotion = value.dragMotion === void 0 ? void 0 : parseDragMotion(value.dragMotion, "map.dragMotion");
965
983
  if (!Array.isArray(value.spots)) throw new Error("map.spots: expected an array");
966
984
  const spotIds = /* @__PURE__ */ new Set();
967
985
  const spots = value.spots.map((spot, index) => {
@@ -979,6 +997,7 @@ function parsePanoMap(value, sceneIds, options = {}) {
979
997
  ...controls === void 0 ? {} : { controls },
980
998
  ...iconSize === void 0 ? {} : { iconSize },
981
999
  ...maxScale === void 0 ? {} : { maxScale },
1000
+ ...dragMotion === void 0 ? {} : { dragMotion },
982
1001
  spots,
983
1002
  ...sector === void 0 ? {} : { sector }
984
1003
  };