zh-mapbox 0.1.85 → 0.1.88

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -31,6 +31,8 @@ RegisterMapBoxModel(THREE,GLTFLoader)
31
31
 
32
32
  注册常用方法后 map.on('layerdata') 可监听图层的添加与删除
33
33
 
34
+ 增加对pmtile文件的加载 source默认'pmtile' symbol图层不能使用 如果使用请修改mapbox源码
35
+
34
36
  ### Map
35
37
 
36
38
  | 方法名 | 参数 | 描述 |
@@ -98,6 +100,7 @@ RegisterMapBoxModel(THREE,GLTFLoader)
98
100
  | **loadModels**(models)-(0.1.76-v3) | models:{key:string} | 添加模型 |
99
101
  | **isPaintProperty**(id,property)-(0.1.79) | | 是否属于paint |
100
102
  | **loadIconset**(url,options,callback)-(v3) | | 加载pbf图标 |
103
+ | **loadImagesSprite**(urls) | {key:value} | 生成精灵图添加 |
101
104
 
102
105
  ### Map.Style
103
106
 
@@ -478,6 +481,12 @@ layerConfig:[
478
481
  | **isValidLngLat** | | 是否是有效经纬度 |
479
482
  | **isValidCoordinates** | | 是否为有效经纬度数组 |
480
483
  | **metersToPixels** | | 计算像素宽度 |
484
+ | **fetchWithAbort** | | fetch请求 |
485
+ | **fetchJsonWithAbort** | | fetch请求 返回json |
486
+ | **fetchTextWithAbort** | | fetch请求 返回text |
487
+ | **fetchBlobWithAbort** | | fetch请求 返回blob |
488
+ | **setFetchConfig** | | 设置fetch公共参数 |
489
+ | **getFetchConfig** | | 获取fetch公共参数 |
481
490
 
482
491
 
483
492
 
package/dist/index.d.ts CHANGED
@@ -319,6 +319,69 @@ export function invertMask(geojson: any, maskArray: any[]): any | null;
319
319
  */
320
320
  export function judgePointInPolygon(point: [number, number] | { lng: number, lat: number }, geojson: any): boolean;
321
321
 
322
+ /**
323
+ * Fetch请求配置选项
324
+ */
325
+ export interface FetchOptions extends RequestInit {
326
+ /** 超时时间(毫秒),0表示不设置超时 */
327
+ timeout?: number;
328
+ }
329
+
330
+ /**
331
+ * AbortablePromise对象 - 基础版本
332
+ */
333
+ export interface AbortablePromise<T = any> {
334
+ /** Promise对象 */
335
+ promise: Promise<T>;
336
+ /** 取消请求的函数 */
337
+ abort: () => void;
338
+ }
339
+
340
+ /**
341
+ * 设置全局fetch配置
342
+ * @param config - 全局配置对象
343
+ */
344
+ export function setFetchConfig(config: FetchOptions): void;
345
+
346
+ /**
347
+ * 获取全局fetch配置
348
+ * @returns 全局配置对象
349
+ */
350
+ export function getFetchConfig(): FetchOptions;
351
+
352
+ /**
353
+ * 封装带取消功能的fetch请求
354
+ * @param url - 请求URL
355
+ * @param options - fetch配置项,会与全局配置合并
356
+ * @returns 包含promise和abort方法的对象
357
+ */
358
+ export function fetchWithAbort(url: string, options?: FetchOptions): AbortablePromise<Response>;
359
+
360
+ /**
361
+ * 封装带取消功能的fetch请求,返回JSON数据
362
+ * @param url - 请求URL
363
+ * @param options - fetch配置项,会与全局配置合并
364
+ * @returns 包含promise和abort方法的对象,promise解析为JSON数据
365
+ */
366
+ export function fetchJsonWithAbort(url: string, options?: FetchOptions): AbortablePromise<any>;
367
+
368
+ /**
369
+ * 封装带取消功能的fetch请求,返回文本数据
370
+ * @param url - 请求URL
371
+ * @param options - fetch配置项,会与全局配置合并
372
+ * @returns 包含promise和abort方法的对象,promise解析为文本数据
373
+ */
374
+ export function fetchTextWithAbort(url: string, options?: FetchOptions): AbortablePromise<string>;
375
+
376
+ /**
377
+ * 封装带取消功能的fetch请求,返回Blob数据
378
+ * @param url - 请求URL
379
+ * @param options - fetch配置项,会与全局配置合并
380
+ * @returns 包含promise和abort方法的对象,promise解析为Blob数据
381
+ */
382
+ export function fetchBlobWithAbort(url: string, options?: FetchOptions): AbortablePromise<Blob>;
383
+
384
+
322
385
  /**
323
386
  * 地图类类型枚举
324
387
  */
@@ -876,6 +939,12 @@ declare module 'mapbox-gl' {
876
939
  */
877
940
  lazyLoadAddImages(urls: object): void;
878
941
 
942
+ /**
943
+ * 生成雪碧图加载
944
+ * @param urls
945
+ */
946
+ loadImagesSprite(urls: object): Promise<any>;
947
+
879
948
  /**
880
949
  * 地图框选工具
881
950
  * @param {object} [options]