You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/ui/map.js
+96-2Lines changed: 96 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -80,6 +80,8 @@ type MapOptions = {
80
80
scrollZoom?: boolean,
81
81
minZoom?: ?number,
82
82
maxZoom?: ?number,
83
+
minPitch?: ?number,
84
+
maxPitch?: ?number,
83
85
boxZoom?: boolean,
84
86
dragRotate?: boolean,
85
87
dragPan?: DragPanOptions,
@@ -99,6 +101,11 @@ type MapOptions = {
99
101
100
102
constdefaultMinZoom=0;
101
103
constdefaultMaxZoom=22;
104
+
105
+
// the default values, but also the valid range
106
+
constdefaultMinPitch=0;
107
+
constdefaultMaxPitch=60;
108
+
102
109
constdefaultOptions={
103
110
center: [0,0],
104
111
zoom: 0,
@@ -108,6 +115,9 @@ const defaultOptions = {
108
115
minZoom: defaultMinZoom,
109
116
maxZoom: defaultMaxZoom,
110
117
118
+
minPitch: defaultMinPitch,
119
+
maxPitch: defaultMaxPitch,
120
+
111
121
interactive: true,
112
122
scrollZoom: true,
113
123
boxZoom: true,
@@ -150,6 +160,8 @@ const defaultOptions = {
150
160
* @param {HTMLElement|string} options.container The HTML element in which Mapbox GL JS will render the map, or the element's string `id`. The specified element must have no children.
151
161
* @param {number} [options.minZoom=0] The minimum zoom level of the map (0-24).
152
162
* @param {number} [options.maxZoom=22] The maximum zoom level of the map (0-24).
163
+
* @param {number} [options.minPitch=0] The minimum pitch of the map (0-60).
164
+
* @param {number} [options.maxPitch=60] The maximum pitch of the map (0-60).
153
165
* @param {Object|string} [options.style] The map's Mapbox style. This must be an a JSON object conforming to
154
166
* the schema described in the [Mapbox Style Specification](https://mapbox.com/mapbox-gl-style-spec/), or a URL to
}elsethrownewError(`maxPitch must be greater than the current minPitch`);
739
+
}
740
+
741
+
/**
742
+
* Returns the map's maximum allowable pitch.
743
+
*
744
+
* @returns {number} maxPitch
745
+
*/
746
+
getMaxPitch(){returnthis.transform.maxPitch;}
747
+
654
748
/**
655
749
* Returns the state of `renderWorldCopies`. If `true`, multiple copies of the world will be rendered side by side beyond -180 and 180 degrees longitude. If set to `false`:
656
750
* - When the map is zoomed out far enough that a single representation of the world does not fill the map's entire
0 commit comments