|
| 1 | +## <Mapir.Camera /> |
| 2 | +### |
| 3 | + |
| 4 | +### props |
| 5 | +| Prop | Type | Default | Required | Description | |
| 6 | +| ---- | :--: | :-----: | :------: | :----------: | |
| 7 | +| animationDuration | `number` | `2000` | `false` | FIX ME NO DESCRIPTION | |
| 8 | +| animationMode | `enum` | `'easeTo'` | `false` | FIX ME NO DESCRIPTION | |
| 9 | +| defaultSettings | `shape` | `none` | `false` | FIX ME NO DESCRIPTION | |
| 10 | +| centerCoordinate | `array` | `none` | `false` | Center coordinate on map [lng, lat] | |
| 11 | +| heading | `number` | `none` | `false` | Heading on map | |
| 12 | +| pitch | `number` | `none` | `false` | Pitch on map | |
| 13 | +| bounds | `shape` | `none` | `false` | FIX ME NO DESCRIPTION | |
| 14 | +| ne | `array` | `none` | `true` | northEastCoordinates - North east coordinate of bound | |
| 15 | +| sw | `array` | `none` | `true` | southWestCoordinates - North east coordinate of bound | |
| 16 | +| paddingLeft | `number` | `none` | `false` | Left camera padding for bounds | |
| 17 | +| paddingRight | `number` | `none` | `false` | Right camera padding for bounds | |
| 18 | +| paddingTop | `number` | `none` | `false` | Top camera padding for bounds | |
| 19 | +| paddingBottom | `number` | `none` | `false` | Bottom camera padding for bounds | |
| 20 | +| zoomLevel | `number` | `none` | `false` | Zoom level of the map | |
| 21 | +| centerCoordinate | `array` | `none` | `false` | Center coordinate on map [lng, lat] | |
| 22 | +| heading | `number` | `none` | `false` | Heading on map | |
| 23 | +| pitch | `number` | `none` | `false` | Pitch on map | |
| 24 | +| bounds | `shape` | `none` | `false` | FIX ME NO DESCRIPTION | |
| 25 | +| ne | `array` | `none` | `true` | northEastCoordinates - North east coordinate of bound | |
| 26 | +| sw | `array` | `none` | `true` | southWestCoordinates - North east coordinate of bound | |
| 27 | +| paddingLeft | `number` | `none` | `false` | Left camera padding for bounds | |
| 28 | +| paddingRight | `number` | `none` | `false` | Right camera padding for bounds | |
| 29 | +| paddingTop | `number` | `none` | `false` | Top camera padding for bounds | |
| 30 | +| paddingBottom | `number` | `none` | `false` | Bottom camera padding for bounds | |
| 31 | +| zoomLevel | `number` | `none` | `false` | Zoom level of the map | |
| 32 | +| minZoomLevel | `number` | `none` | `false` | FIX ME NO DESCRIPTION | |
| 33 | +| maxZoomLevel | `number` | `none` | `false` | FIX ME NO DESCRIPTION | |
| 34 | +| followUserLocation | `bool` | `none` | `false` | FIX ME NO DESCRIPTION | |
| 35 | +| followUserMode | `enum` | `none` | `false` | FIX ME NO DESCRIPTION | |
| 36 | +| followZoomLevel | `number` | `none` | `false` | FIX ME NO DESCRIPTION | |
| 37 | +| followPitch | `number` | `none` | `false` | FIX ME NO DESCRIPTION | |
| 38 | +| followHeading | `number` | `none` | `false` | FIX ME NO DESCRIPTION | |
| 39 | +| triggerKey | `any` | `none` | `false` | FIX ME NO DESCRIPTION | |
| 40 | +| alignment | `array` | `none` | `false` | FIX ME NO DESCRIPTION | |
| 41 | +| isUserInteraction | `FIX ME UNKNOWN TYPE` | `false` | `false` | FIX ME NO DESCRIPTION | |
| 42 | + |
| 43 | +### methods |
| 44 | +#### fitBounds(northEastCoordinates, southWestCoordinates[, padding][, animationDuration]) |
| 45 | + |
| 46 | +Map camera transitions to fit provided bounds |
| 47 | + |
| 48 | +##### arguments |
| 49 | +| Name | Type | Required | Description | |
| 50 | +| ---- | :--: | :------: | :----------: | |
| 51 | +| `northEastCoordinates` | `Array` | `Yes` | North east coordinate of bound | |
| 52 | +| `southWestCoordinates` | `Array` | `Yes` | South west coordinate of bound | |
| 53 | +| `padding` | `Number` | `No` | Camera padding for bound | |
| 54 | +| `animationDuration` | `Number` | `No` | Duration of camera animation | |
| 55 | + |
| 56 | + |
| 57 | + |
| 58 | +```javascript |
| 59 | +this.camera.fitBounds([lng, lat], [lng, lat]) |
| 60 | +this.camera.fitBounds([lng, lat], [lng, lat], 20, 1000) // padding for all sides |
| 61 | +this.camera.fitBounds([lng, lat], [lng, lat], [verticalPadding, horizontalPadding], 1000) |
| 62 | +this.camera.fitBounds([lng, lat], [lng, lat], [top, right, bottom, left], 1000) |
| 63 | +``` |
| 64 | + |
| 65 | + |
| 66 | +#### flyTo(coordinates[, animationDuration]) |
| 67 | + |
| 68 | +Map camera will fly to new coordinate |
| 69 | + |
| 70 | +##### arguments |
| 71 | +| Name | Type | Required | Description | |
| 72 | +| ---- | :--: | :------: | :----------: | |
| 73 | +| `coordinates` | `Array` | `Yes` | Coordinates that map camera will jump too | |
| 74 | +| `animationDuration` | `Number` | `No` | Duration of camera animation | |
| 75 | + |
| 76 | + |
| 77 | + |
| 78 | +```javascript |
| 79 | +this.camera.flyTo([lng, lat]) |
| 80 | +this.camera.flyTo([lng, lat], 12000) |
| 81 | +``` |
| 82 | + |
| 83 | + |
| 84 | +#### moveTo(coordinates[, animationDuration]) |
| 85 | + |
| 86 | +Map camera will move to new coordinate at the same zoom level |
| 87 | + |
| 88 | +##### arguments |
| 89 | +| Name | Type | Required | Description | |
| 90 | +| ---- | :--: | :------: | :----------: | |
| 91 | +| `coordinates` | `Array` | `Yes` | Coordinates that map camera will move too | |
| 92 | +| `animationDuration` | `Number` | `No` | Duration of camera animation | |
| 93 | + |
| 94 | + |
| 95 | + |
| 96 | +```javascript |
| 97 | +this.camera.moveTo([lng, lat], 200) // eases camera to new location based on duration |
| 98 | +this.camera.moveTo([lng, lat]) // snaps camera to new location without any easing |
| 99 | +``` |
| 100 | + |
| 101 | + |
| 102 | +#### zoomTo(zoomLevel[, animationDuration]) |
| 103 | + |
| 104 | +Map camera will zoom to specified level |
| 105 | + |
| 106 | +##### arguments |
| 107 | +| Name | Type | Required | Description | |
| 108 | +| ---- | :--: | :------: | :----------: | |
| 109 | +| `zoomLevel` | `Number` | `Yes` | Zoom level that the map camera will animate too | |
| 110 | +| `animationDuration` | `Number` | `No` | Duration of camera animation | |
| 111 | + |
| 112 | + |
| 113 | + |
| 114 | +```javascript |
| 115 | +this.camera.zoomTo(16) |
| 116 | +this.camera.zoomTo(16, 100) |
| 117 | +``` |
| 118 | + |
| 119 | + |
| 120 | +#### setCamera(config) |
| 121 | + |
| 122 | +Map camera will perform updates based on provided config. Advanced use only! |
| 123 | + |
| 124 | +##### arguments |
| 125 | +| Name | Type | Required | Description | |
| 126 | +| ---- | :--: | :------: | :----------: | |
| 127 | +| `config` | `Object` | `Yes` | Camera configuration | |
| 128 | + |
| 129 | + |
| 130 | + |
| 131 | +```javascript |
| 132 | +this.camera.setCamera({ |
| 133 | + centerCoordinate: [lng, lat], |
| 134 | + zoomLevel: 16, |
| 135 | + animationDuration: 2000, |
| 136 | +}) |
| 137 | + |
| 138 | +this.camera.setCamera({ |
| 139 | + stops: [ |
| 140 | + { pitch: 45, animationDuration: 200 }, |
| 141 | + { heading: 180, animationDuration: 300 }, |
| 142 | + ] |
| 143 | +}) |
| 144 | +``` |
| 145 | + |
| 146 | + |
| 147 | + |
0 commit comments