mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-04 09:10:09 +00:00
Added optional `maxWidth` option to `PopupOptions` introduced in https://github.com/mapbox/mapbox-gl-js/releases/tag/v0.54.0
This commit is contained in:
committed by
Jesse Trinity
parent
f5a50ceae9
commit
693c9b31ef
8
types/mapbox-gl/index.d.ts
vendored
8
types/mapbox-gl/index.d.ts
vendored
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Mapbox GL JS v0.53.0
|
||||
// Type definitions for Mapbox GL JS v0.54.0
|
||||
// Project: https://github.com/mapbox/mapbox-gl-js
|
||||
// Definitions by: Dominik Bruderer <https://github.com/dobrud>
|
||||
// Patrick Reames <https://github.com/patrickr>
|
||||
@@ -658,6 +658,10 @@ declare namespace mapboxgl {
|
||||
setHTML(html: string): this;
|
||||
|
||||
setDOMContent(htmlNode: Node): this;
|
||||
|
||||
getMaxWidth(): string;
|
||||
|
||||
setMaxWidth(maxWidth: string): this;
|
||||
}
|
||||
|
||||
export interface PopupOptions {
|
||||
@@ -670,6 +674,8 @@ declare namespace mapboxgl {
|
||||
offset?: number | PointLike | { [key: string]: PointLike; };
|
||||
|
||||
className?: string;
|
||||
|
||||
maxWidth?: string;
|
||||
}
|
||||
|
||||
export interface Style {
|
||||
|
||||
@@ -289,10 +289,24 @@ map.removeFeatureState(featureIdentifier);
|
||||
/**
|
||||
* Popup
|
||||
*/
|
||||
var popup = new mapboxgl.Popup({closeOnClick: false, closeButton: true, anchor: 'top-right', offset: {'top': [0,0], 'bottom': [25,-50]}, className: 'custom-class' })
|
||||
const popupOptions = {
|
||||
closeOnClick: false,
|
||||
closeButton: true,
|
||||
anchor: 'top-right' as mapboxgl.Anchor,
|
||||
offset: {
|
||||
'top': [0,0] as [number, number],
|
||||
'bottom': [25,-50] as [number, number]
|
||||
},
|
||||
className: 'custom-class',
|
||||
maxWidth: '400px'
|
||||
};
|
||||
expectType<mapboxgl.PopupOptions>(popupOptions);
|
||||
const popup = new mapboxgl.Popup(popupOptions)
|
||||
.setLngLat([-50, 50])
|
||||
.setHTML('<h1>Hello World!</h1>')
|
||||
.setMaxWidth('none')
|
||||
.addTo(map);
|
||||
popup.getMaxWidth();
|
||||
|
||||
/**
|
||||
* Add an image
|
||||
|
||||
Reference in New Issue
Block a user