v4.x
v4.x
Migration Guide#
MapillaryJS This page describes how to migrate from MapillaryJS v3.x
to MapillaryJS v4.x
.
#
General- Github differential - v3.1.0...v4.0.0
- Properties named
key
inv3.x
have been renamed toid
throughout the library inv4.x
#
Distribution#
Renamed Filesv3.x | v4.x |
---|---|
mapillary.min.js | mapillary.js |
mapillary.js | mapillary.unminified.js |
mapillary.min.css | mapillary.css |
#
ModuleAll namespacing has been removed and the global UMD name has been changed.
#
Global UMD Namev3.x | v4.x |
---|---|
Mapillary | mapillary |
#
Importv3.x
#
import * as Mapillary from 'mapillary-js';
const viewer = new Mapillary.Viewer({...});const marker = new Mapillary.MarkerComponent.SimpleMarker({...});const popup = new Mapillary.PopupComponent.Popup({...});
v4.x
#
import { Popup, SimpleMarker, Viewer } from 'mapillary-js';
const viewer = new Viewer({...});const marker = new SimpleMarker({...});const popup = new Popup({...});
#
Destructv3.x
#
const viewer = new Mapillary.Viewer({...});const marker = new Mapillary.MarkerComponent.SimpleMarker({...});const popup = new Mapillary.PopupComponent.Popup({...});
v4.x
#
const { Popup, SimpleMarker, Viewer } = mapillary;
const viewer = new Viewer({...});const marker = new SimpleMarker({...});const popup = new Popup({...});
#
StylesAll style classes have been renamed.
#
Viewer#
Methods#
Renamedv3.x | v4.x | Description |
---|---|---|
setUserToken | setAccessToken | Now accepts a client access token or a user access token |
#
Options#
AddedtrackResize
- Breaking change: the viewer now tracks browser window resizing by default. Set this option to false if you want to handle viewer resizing with custom logic.dataProvider
- Override the default data provider.
#
Removedv3.x | v4.x |
---|---|
baseImageSize | No replacement |
basePanoramaSize | No replacement |
baseImageSize | No replacement |
maxImageSize | No replacement |
apiClient | Use dataProvider and/or accessToken instead |
#
Renamedv3.x | v4.x |
---|---|
imageKey | imageId |
userToken | accessToken |
#
Component Options#
Removedv3.x | v4.x |
---|---|
background | No replacement |
debug | No replacement |
route | No replacement |
#
Renamedv3.x | v4.x |
---|---|
imagePlane | image |
mouse | pointer |
spatialData | spatial |
#
Replacedv3.x | v4.x |
---|---|
image | Moved to fallback options |
navigation | Moved to fallback options |
#
EventsEvent names are not provided as static properties on the Viewer class.
v3.x | v4.x |
---|---|
viewer.on(Mapillary.Viewer.click, ...); | viewer.on('click', ...); |
#
ContractsAll emitted events are now an object with the following properties populated:
type
- Event typetarget
- Instance that emitted the event
Additional properties are provided per event type.
#
Renamed Event Typesv3.x | v4.x |
---|---|
bearingchanged | bearing |
fovchanged | fov |
loading | dataloading |
navigablechanged | navigable |
nodechanged | image |
positionchanged | position |
povchanged | pov |
removed | remove |
sequenceedgeschanged | sequenceedges |
spatialedgeschanged | spatialedges |
#
ImageThe Node
class has been renamed to Image
.
#
Properties#
Removedv3.x | v4.x |
---|---|
cameraUuid | No replacement |
fullPano | Use cameraType instead |
gpano | Use cameraType instead |
pano | Use cameraType instead |
mergeVersion | No replacement |
projectKey | No replacement |
#
Renamedv3.x | v4.x |
---|---|
alt | computedAltitude |
ca | compassAngle |
cameraProjectionType | cameraType |
clusterKey | clusterId |
computedCA | computedCompassAngle |
computedLatLon | computedLngLat |
key | id |
latLon | lngLat |
mergeCC | mergeId |
organizationKey | ownerId |
orientation | exifOrientation |
originalAlt | originalAltitude |
originalCA | originalCompassAngle |
originalLatLon | originalLngLat |
sequenceKey | sequenceId |
userKey | creatorId |
userName | creatorName |
#
Replacedv3.x | v4.x |
---|---|
focal, ck1, ck2 | cameraParameters |
#
Typesv3.x | v4.x |
---|---|
ILatLon : { lat: number, lon: number } | LngLat : { lat: number, lng: number } |
ILatLonAlt : { alt: number, lat: number, lon: number } | LngLatAlt : { alt: number, lat: number, lng: number } |
AbortMapillaryError | CancelMapillaryError |
#
Enums#
Renamedv3.x | v4.x |
---|---|
EdgeDirection | NavigationDirection |
#
Component#
Components#
Removedv3.x | v4.x |
---|---|
background | No replacement |
debug | No replacement |
route | Use the custom render API or custom HTML elements instead |
#
Renamedv3.x | v4.x |
---|---|
imageplane | image |
spatialdata | spatial |
image | imagefallback |
navigation | navigationfallback |
#
Eventsv3.x | v4.x |
---|---|
MarkerComponent.dragend | markerdragend |
MarkerComponent.dragstart | markerdragstart |
MarkerComponent.changed | markerposition |
MarkerComponent.hoveredkeychanged | hover |
SequenceComponent.hoveredkeychanged | hover |
SequenceComponent.playingchanged | playing |
TagComponenent.geometrycreated | geometrycreate |
TagComponenent.creategeometryend | tagcreateend |
TagComponenent.creategeometrystart | tagcreatestart |
TagComponenent.modechanged | tagmode |
TagComponenent.tagschanged | tags |
Tag.click | click |
Tag.geometrychanged | geometry |
Tag.changed | tag |
#
Interaction#
Removedv3.x | v4.x |
---|---|
MouseComponent#doubleClickZoom | No replacement |
#
APIThe complete API functionality, including ents, contracts, and providers, has been replaced. See the v4 API reference and examples for info about the new functionality.