Skip to content

Commit

Permalink
feat: add customAttribution
Browse files Browse the repository at this point in the history
  • Loading branch information
mklopets committed Aug 23, 2018
1 parent e5a997d commit 51592ee
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
6 changes: 5 additions & 1 deletion types/mapbox-gl/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,10 @@ declare namespace mapboxgl {
/** ID of the container element */
container?: string | Element;

/** String or strings to show in an AttributionControl.
* Only applicable if options.attributionControl is `true`. */
customAttribution?: string | string[];

/** If true, enable the "drag to pan" interaction (see DragPanHandler). */
dragPan?: boolean;

Expand Down Expand Up @@ -441,7 +445,7 @@ declare namespace mapboxgl {
* Attribution
*/
export class AttributionControl extends Control {
constructor(options?: { compact?: boolean });
constructor(options?: { compact?: boolean, customAttribution?: string | string[] });
}

/**
Expand Down
13 changes: 12 additions & 1 deletion types/mapbox-gl/mapbox-gl-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ let map = new mapboxgl.Map({
minZoom: 1,
maxZoom: 2,
interactive: true,
attributionControl: false,
attributionControl: true,
customAttribution: '© YourCo',
bearingSnap: 7,
scrollZoom: true,
maxBounds: [[-100,-90],[100,90]],
Expand Down Expand Up @@ -387,6 +388,16 @@ let marker = new mapboxgl.Marker(undefined, {offset: [10, 0]})
.addTo(map);

marker.remove();

/*
* LngLatBounds
*/
let bool:boolean
let bounds = new mapboxgl.LngLatBounds()
bool = bounds.isEmpty()

/*
* AttributionControl
*/
let attributionControl = new mapboxgl.AttributionControl({ compact: false, customAttribution: '© YourCo' });
attributionControl.on('click', () => {});

0 comments on commit 51592ee

Please sign in to comment.