diff --git a/MIGRATING.md b/MIGRATING.md index f98f85d8d..9ec8d64a3 100644 --- a/MIGRATING.md +++ b/MIGRATING.md @@ -1,4 +1,120 @@ -# Migrating from MapillaryJS 1 to 2 +# Migrating + +This document describes how to migrate between major versions of MapillaryJS. + +# MapillaryJS 2 to 3 + +## Components + +The `stats` and `loading` components have been removed. Configuring these components in the component options struct will no longer have any effect. + +## Node class + +The following property names have changed. + +|MapillaryJS 2|MapillaryJS 3| +|---|---| +|`cameraProjection`|`cameraProjectionType`| + +## Viewer class + +### Constructor parameters + +All parameters of the viewer constructor now goes into the viewer options object. + +MapillaryJS 3: +```js +var mly = new Mapillary.Viewer({ + apiClient: '', + container: '', + imageKey: '', + userToken: '', + // your other viewer options +}); +``` + +MapillaryJS 2: +```js +var mly = new Mapillary.Viewer( + '', + '', + '', + { + // your other viewer options + }, + '', +); +``` + +### Move close to + +The `Mapillary.Viewer.moveCloseTo` method has been removed, use the [Mapillary REST API](https://www.mapillary.com/developer/api-documentation/#search-images) for this functionality instead. + +### Auth token + +The name of the method for setting a user auth token has changed. + +MapillaryJS 3: +```ts +viewer.setUserToken(''); +``` + +MapillaryJS 3: +```ts +viewer.setAuthToken(''); +``` + +### URL options + +Most URL options now need to be set through the Falcor data provider. When setting the Falcor data provider explicitly, the client and user tokens also need to be set on the provider. + +MapillaryJS 3: +```js +var provider = new Mapillary.API.FalcorDataProvider({ + apiHost: '', + clientToken: '', + clusterReconstructionHost: '', + imageHost: '', + imageTileHost: '', + meshHost: '', + scheme: '', + userToken: '', +}); + +var mly = new Mapillary.Viewer({ + apiClient: provider, + container: '', + imageKey: '', + url: { + exploreHost: '', + scheme: '', + }, +}); +``` + +MapillaryJS 2: +```js +var mly = new Mapillary.Viewer( + '', + '', + '', + { + url: { + apiHost: '', + clusterReconstructionHost: '', + exploreHost: '', + imageHost: '', + imageTileHost: '', + meshHost: '', + scheme: '', + } + }, + '', +); +``` + + +# MapillaryJS 1 to 2 MapillaryJS 2 has a completely rewritten graph structure and IO handling. The graph was rewritten to, among other things, load nodes faster when using the `viewer.move*` methods. @@ -30,7 +146,7 @@ spatialEdges$: Observable The edge status is like so: -``` +```ts interface IEdgeStatus { cached: boolean; edges: IEdge[]; diff --git a/tsconfig.docs.json b/tsconfig.docs.json index d1eed6a74..3f0966c08 100644 --- a/tsconfig.docs.json +++ b/tsconfig.docs.json @@ -81,6 +81,7 @@ "./src/state/TransitionMode.ts", "./src/viewer/interfaces/IComponentOptions.ts", "./src/viewer/interfaces/IPointOfView.ts", + "./src/viewer/interfaces/IUrlOptions.ts", "./src/viewer/interfaces/IViewerEvent.ts", "./src/viewer/interfaces/IViewerMouseEvent.ts", "./src/viewer/interfaces/IViewerOptions.ts",