Skip to content

Commit

Permalink
Release 4.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mistic100 committed Nov 9, 2021
2 parents 0e246bd + 83392ad commit 03f34a6
Show file tree
Hide file tree
Showing 141 changed files with 5,962 additions and 1,431 deletions.
9 changes: 8 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{
"ignorePatterns": [
"*.spec.js",
"DeviceOrientationControls.js"
],
"extends": "airbnb-base",
"parser": "babel-eslint",
"parser": "@babel/eslint-parser",
"env": {
"browser": true,
"es6": true
Expand All @@ -25,6 +29,9 @@
"prefer-template": "off",
"no-mixed-operators": "off",
"no-restricted-globals": "off",
"function-paren-newline": "off",
"function-call-argument-newline": "off",
"prefer-exponentiation-operator": "off",
"arrow-parens": [
"error",
"as-needed",
Expand Down
22 changes: 13 additions & 9 deletions dist/adapters/cubemap.d.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
import { AbstractAdapter, TextureData } from 'photo-sphere-viewer';
import { AbstractAdapter } from 'photo-sphere-viewer';

/**
* @summary Cubemap defined as an array of images
* @description images order is : left, front, right, back, top, bottom
*/
type CubemapArray = string[6];

/**
* @summary Object defining a cubemap
*/
type Cubemap = string[6] | {
top: string;
right: string;
bottom: string;
type Cubemap = {
left: string;
front: string;
right: string;
back: string;
top: string;
bottom: string;
};

/**
* @summary Adapter for cubemaps
*/
declare class CubemapAdapter extends AbstractAdapter {

loadTexture(panorama: Cubemap): Promise<TextureData>;
declare class CubemapAdapter extends AbstractAdapter<CubemapArray | Cubemap> {

}

export { Cubemap, CubemapAdapter };
export { Cubemap, CubemapAdapter, CubemapArray };
8 changes: 4 additions & 4 deletions dist/adapters/cubemap.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/adapters/cubemap.js.map

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions dist/adapters/equirectangular-tiles.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AbstractAdapter, Viewer, TextureData } from 'photo-sphere-viewer';
import { AbstractAdapter, Viewer } from 'photo-sphere-viewer';

/**
* @summary Configuration of a tiled panorama
Expand All @@ -19,12 +19,10 @@ type EquirectangularTilesAdapterOptions = {
/**
* @summary Adapter for tiled panoramas
*/
declare class EquirectangularTilesAdapter extends AbstractAdapter {
declare class EquirectangularTilesAdapter extends AbstractAdapter<EquirectangularTilesPanorama> {

constructor(psv: Viewer, options: EquirectangularTilesAdapterOptions);

loadTexture(panorama: EquirectangularTilesPanorama): Promise<TextureData>;

}

export { EquirectangularTilesAdapter, EquirectangularTilesAdapterOptions, EquirectangularTilesPanorama };
9 changes: 7 additions & 2 deletions dist/adapters/equirectangular-tiles.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/adapters/equirectangular-tiles.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/photo-sphere-viewer.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

88 changes: 65 additions & 23 deletions dist/photo-sphere-viewer.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { Texture, Mesh, Vector3 } from 'three';
import { Texture, Mesh, Vector3, Intersection } from 'three';
import { EventEmitter, Event } from 'uevent';

/**
* @summary Radius of the THREE.SphereGeometry, Half-length of the THREE.BoxGeometry
*/
declare const SPHERE_RADIUS = 10;

/**
* @summary Property name added to viewer element
*/
Expand Down Expand Up @@ -110,6 +115,7 @@ declare const KEY_CODES: {
Minus : '-',
};

declare const constants_d_SPHERE_RADIUS: typeof SPHERE_RADIUS;
declare const constants_d_VIEWER_DATA: typeof VIEWER_DATA;
declare const constants_d_ACTIONS: typeof ACTIONS;
declare const constants_d_EVENTS: typeof EVENTS;
Expand All @@ -118,6 +124,7 @@ declare const constants_d_EASINGS: typeof EASINGS;
declare const constants_d_KEY_CODES: typeof KEY_CODES;
declare namespace constants_d {
export {
constants_d_SPHERE_RADIUS as SPHERE_RADIUS,
constants_d_VIEWER_DATA as VIEWER_DATA,
constants_d_ACTIONS as ACTIONS,
constants_d_EVENTS as EVENTS,
Expand Down Expand Up @@ -421,6 +428,14 @@ declare function getXMPValue(data: string, attr: string): number | null;
*/
declare function parsePosition(value: string | Point): Point;

/**
* @summary Parse a CSS-like position into an array of position keywords among top, bottom, left, right and center
* @param {string | string[]} value
* @param {string} defaultValue
* @param {boolean} [allowCenter=true]
*/
declare function cleanPosition(value: string | string[], defaultValue: string, allowCenter?): string[];

/**
* @summary Parses an speed
* @param speed - The speed, in radians/degrees/revolutions per second/minute
Expand Down Expand Up @@ -475,6 +490,7 @@ declare const index_d_logWarn: typeof logWarn;
declare const index_d_isExtendedPosition: typeof isExtendedPosition;
declare const index_d_getXMPValue: typeof getXMPValue;
declare const index_d_parsePosition: typeof parsePosition;
declare const index_d_cleanPosition: typeof cleanPosition;
declare const index_d_parseSpeed: typeof parseSpeed;
declare const index_d_parseAngle: typeof parseAngle;
declare const index_d_createTexture: typeof createTexture;
Expand Down Expand Up @@ -512,6 +528,7 @@ declare namespace index_d {
index_d_isExtendedPosition as isExtendedPosition,
index_d_getXMPValue as getXMPValue,
index_d_parsePosition as parsePosition,
index_d_cleanPosition as cleanPosition,
index_d_parseSpeed as parseSpeed,
index_d_parseAngle as parseAngle,
index_d_createTexture as createTexture,
Expand All @@ -520,8 +537,9 @@ declare namespace index_d {

/**
* @summary Base adapters class
* @template T type of the panorama configuration object
*/
declare abstract class AbstractAdapter {
declare abstract class AbstractAdapter<T> {

/**
* @summary Unique identifier of the adapter
Expand All @@ -543,7 +561,7 @@ declare abstract class AbstractAdapter {
/**
* @summary Loads the panorama texture(s)
*/
loadTexture(panorama: any, newPanoData?: PanoData | PanoDataProvider): Promise<TextureData>;
loadTexture(panorama: T, newPanoData?: PanoData | PanoDataProvider): Promise<TextureData>;

/**
* @summary Creates the cube mesh
Expand All @@ -563,7 +581,7 @@ declare abstract class AbstractAdapter {

}

type AdapterConstructor<T extends AbstractAdapter> = new (psv: Viewer, options?: any) => T;
type AdapterConstructor<T extends AbstractAdapter<any>> = new (psv: Viewer, options?: any) => T;

type AnimationOptions = {
properties: { [K: string]: { start: number, end: number } };
Expand Down Expand Up @@ -663,7 +681,7 @@ declare abstract class AbstractButton extends AbstractComponent {
*/
static iconActive?: string;

constructor(navbar: Navbar, className?: string, collapsable?: boolean);
constructor(navbar: Navbar, className?: string, collapsable?: boolean, tabbable?: boolean);

/**
* @summary Checks if the button can be displayed
Expand Down Expand Up @@ -695,12 +713,17 @@ declare abstract class AbstractButton extends AbstractComponent {
*/
uncollapse();

/**
* Action when the button is clicked
*/
abstract onClick();

}

/**
* @summary Register a new button available for all viewers
*/
declare function registerButton(button: typeof AbstractButton);
declare function registerButton(button: typeof AbstractButton): void;

/**
* @summary Navigation bar class
Expand Down Expand Up @@ -873,7 +896,7 @@ declare class DataHelper {
/**
* @summary Converts spherical radians coordinates to a THREE.Vector3
*/
sphericalCoordsToVector3(position: Position): Vector3;
sphericalCoordsToVector3(position: Position, vector: Vector3): Vector3;

/**
* @summary Converts a THREE.Vector3 to spherical radians coordinates
Expand All @@ -895,6 +918,11 @@ declare class DataHelper {
*/
sphericalCoordsToViewerCoords(position: Position): Point;

/**
* @summary Returns the first intersection with the cursor and having specific data
*/
getIntersection(viewerPoint: Point, objectDataName: string): Intersection;

/**
* @summary Converts x/y to latitude/longitude if present and ensure boundaries
*/
Expand All @@ -912,6 +940,21 @@ declare class DataHelper {
*/
declare class TextureLoader {

/**
* @summary Cancels current HTTP requests
*/
abortLoading();

/**
* @summary Loads a Blob with FileLoader
*/
loadFile(url: string, onProgress?: (number) => void): Promise<Blob>;

/**
* @summary Loads an Image using FileLoader to have progress events
*/
loadImage(url: string, onProgress?: (number) => void): Promise<HTMLImageElement>;

/**
* @summary Preload a panorama file without displaying it
*/
Expand All @@ -937,7 +980,7 @@ declare class TooltipRenderer extends AbstractComponent {
*/
type ViewerOptions = {
container: HTMLElement | string;
panorama?: string;
panorama?: any;
adapter?: AdapterConstructor<any> | [AdapterConstructor<any>, any];
caption?: string;
loadingImg?: string;
Expand All @@ -949,10 +992,10 @@ type ViewerOptions = {
defaultZoomLvl?: number;
defaultLong?: number;
defaultLat?: number;
sphereCorrection?: { pan?: number, tilt?: number, roll?: number },
sphereCorrection?: { pan?: number, tilt?: number, roll?: number };
moveSpeed?: number;
zoomSpeed?: number;
autorotateDelay?: null,
autorotateDelay?: number,
autorotateSpeed?: string | number;
autorotateLat?: number;
moveInertia?: boolean;
Expand All @@ -966,10 +1009,10 @@ type ViewerOptions = {
requestHeaders?: Record<string, string> | ((url: string) => Record<string, string>);
canvasBackground?: string;
withCredentials?: boolean;
navbar?: string | Array<string | NavbarCustomButton>,
lang?: Record<string, string>,
keyboard?: Record<string, string>,
plugins?: Array<PluginConstructor<any> | [PluginConstructor<any>, any]>,
navbar?: string | Array<string | NavbarCustomButton>;
lang?: Record<string, string>;
keyboard?: Record<string, string>;
plugins?: Array<PluginConstructor<any> | [PluginConstructor<any>, any]>;
};

/**
Expand Down Expand Up @@ -1005,7 +1048,7 @@ declare class Viewer extends EventEmitter {
/**
* Internal properties
*/
prop: ViewerProps;
protected readonly prop: ViewerProps;

/**
* Top most parent
Expand Down Expand Up @@ -1053,7 +1096,7 @@ declare class Viewer extends EventEmitter {
/**
* @summary Returns the instance of a plugin if it exists
*/
getPlugin<T extends AbstractPlugin>(pluginId: string | PluginConstructor<T>): T;
getPlugin<T extends AbstractPlugin>(pluginId: string | PluginConstructor<T>): T | undefined;

/**
* @summary Returns the current position of the camera
Expand Down Expand Up @@ -1196,6 +1239,11 @@ declare class Viewer extends EventEmitter {
*/
stopKeyboardControl();

/**
* @summary Triggered when the panorama image has been loaded and the viewer is ready to perform the first render
*/
once(e: 'ready', cb: (e: Event) => void): this;

/**
* @summary Triggered when the automatic rotation is enabled/disabled
*/
Expand Down Expand Up @@ -1260,12 +1308,6 @@ declare class Viewer extends EventEmitter {
* @summary Triggered when the view longitude and/or latitude changes
*/
on(e: 'position-updated', cb: (e: Event, position: Position) => void): this;

/**
* @summary Triggered when the panorama image has been loaded and the viewer is ready to perform the first render
*/
once(e: 'ready', cb: (e: Event) => void): this;

/**
* @summary Triggered on each viewer render, **this event is triggered very often**
*/
Expand Down Expand Up @@ -1323,4 +1365,4 @@ declare class PSVError extends Error {
name: 'PSVError';
}

export { ACTIONS, AbstractAdapter, AbstractButton, AbstractPlugin, AdapterConstructor, AnimateOptions, Animation, AnimationOptions, CHANGE_EVENTS, constants_d as CONSTANTS, ClickData, CssSize, DEFAULTS, DataHelper, EASINGS, EVENTS, ExtendedPosition, KEY_CODES, Loader, Navbar, NavbarCustomButton, Notification, NotificationOptions, Overlay, OverlayOptions, PSVError, Panel, PanelOptions, PanoData, PanoDataProvider, PanoramaOptions, PluginConstructor, Point, Position, SYSTEM, Size, SphereCorrection, TextureData, TextureLoader, Tooltip, TooltipOptions, TooltipPosition, TooltipRenderer, VIEWER_DATA, Viewer, ViewerOptions, ViewerProps, registerButton, index_d as utils };
export { AbstractAdapter, AbstractButton, AbstractPlugin, AdapterConstructor, AnimateOptions, Animation, AnimationOptions, constants_d as CONSTANTS, ClickData, CssSize, DEFAULTS, DataHelper, ExtendedPosition, Loader, Navbar, NavbarCustomButton, Notification, NotificationOptions, Overlay, OverlayOptions, PSVError, Panel, PanelOptions, PanoData, PanoDataProvider, PanoramaOptions, PluginConstructor, Point, Position, SYSTEM, Size, SphereCorrection, TextureData, TextureLoader, Tooltip, TooltipOptions, TooltipPosition, TooltipRenderer, Viewer, ViewerOptions, ViewerProps, registerButton, index_d as utils };
Loading

0 comments on commit 03f34a6

Please sign in to comment.