Skip to content

Commit

Permalink
Last public facing examples
Browse files Browse the repository at this point in the history
  • Loading branch information
karimnaaji committed Jul 15, 2021
1 parent 042cacb commit ff15905
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/ui/camera.js
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,8 @@ class Camera extends Evented {
* @memberof Map#
* @returns The map's current bearing.
* @see [Navigate the map with game-like controls](https://www.mapbox.com/mapbox-gl-js/example/game-controls/)
* @example
* const bearing = map.getBearing();
*/
getBearing(): number { return this.transform.bearing; }

Expand Down Expand Up @@ -374,6 +376,8 @@ class Camera extends Evented {
*
* @memberof Map#
* @returns The current padding around the map viewport.
* @example
* const padding = map.getPadding();
*/
getPadding(): PaddingOptions { return this.transform.padding; }

Expand Down Expand Up @@ -486,6 +490,8 @@ class Camera extends Evented {
*
* @memberof Map#
* @returns The map's current pitch, measured in degrees away from the plane of the screen.
* @example
* const pitch = map.getPitch();
*/
getPitch(): number { return this.transform.pitch; }

Expand Down Expand Up @@ -1481,6 +1487,8 @@ class Camera extends Evented {
*
* @memberof Map#
* @returns {Map} `this`
* @example
* map.stop();
*/
stop(): this {
return this._stop();
Expand Down
13 changes: 13 additions & 0 deletions src/ui/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ export class MapMouseEvent extends Event {
* * On `mousedown` events, the behavior of {@link BoxZoomHandler}
* * On `dblclick` events, the behavior of {@link DoubleClickZoomHandler}
*
* @example
* map.on('click', (e) => {
* e.preventDefault();
* });
*/
preventDefault() {
this._defaultPrevented = true;
Expand Down Expand Up @@ -244,6 +248,10 @@ export class MapTouchEvent extends Event {
* * On `touchstart` events, the behavior of {@link DragPanHandler}
* * On `touchstart` events, the behavior of {@link TouchZoomRotateHandler}
*
* @example
* map.on('touchstart', (e) => {
* e.preventDefault();
* });
*/
preventDefault() {
this._defaultPrevented = true;
Expand Down Expand Up @@ -308,6 +316,11 @@ export class MapWheelEvent extends Event {
* Prevents subsequent default processing of the event by the map.
*
* Calling this method will prevent the the behavior of {@link ScrollZoomHandler}.
* @example
* map.on('wheel', (e) => {
* // Prevent the default map scroll zoom behavior.
* e.preventDefault();
* });
*/
preventDefault() {
this._defaultPrevented = true;
Expand Down

0 comments on commit ff15905

Please sign in to comment.