@antv/l7-layers 2.10.15 → 2.11.1

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.
Files changed (37) hide show
  1. package/es/Geometry/models/index.d.ts +1 -1
  2. package/es/canvas/models/index.d.ts +1 -1
  3. package/es/core/BaseModel.d.ts +3 -3
  4. package/es/core/shape/Path.d.ts +2 -2
  5. package/es/earth/index.d.ts +1 -1
  6. package/es/heatmap/models/index.d.ts +1 -1
  7. package/es/image/models/index.d.ts +1 -1
  8. package/es/line/models/index.d.ts +1 -1
  9. package/es/mask/models/index.d.ts +1 -1
  10. package/es/point/models/fillmage.js +1 -1
  11. package/es/point/models/image.js +8 -4
  12. package/es/point/models/index.d.ts +1 -1
  13. package/es/polygon/models/index.d.ts +1 -1
  14. package/es/raster/models/index.d.ts +1 -1
  15. package/es/tile/interface.d.ts +2 -2
  16. package/es/tile/tileFactory/ImageTile.js +1 -1
  17. package/es/tile/tileFactory/MaskTile.js +1 -1
  18. package/es/tile/tileFactory/RasterRGBTile.js +1 -1
  19. package/es/tile/tileFactory/RasterTerrainRGBTile.js +1 -1
  20. package/es/tile/tileFactory/RasterTile.js +1 -1
  21. package/es/tile/tileFactory/Tile.d.ts +67 -0
  22. package/es/tile/tileFactory/Tile.js +11 -0
  23. package/es/tile/tileFactory/VectorTile.js +10 -11
  24. package/es/tile/tileFactory/index.d.ts +1 -1
  25. package/es/utils/grid-index.d.ts +1 -1
  26. package/es/utils/symbol-layout.d.ts +1 -1
  27. package/es/wind/models/index.d.ts +1 -1
  28. package/lib/point/models/fillmage.js +1 -1
  29. package/lib/point/models/image.js +8 -4
  30. package/lib/tile/tileFactory/ImageTile.js +1 -1
  31. package/lib/tile/tileFactory/MaskTile.js +1 -1
  32. package/lib/tile/tileFactory/RasterRGBTile.js +1 -1
  33. package/lib/tile/tileFactory/RasterTerrainRGBTile.js +1 -1
  34. package/lib/tile/tileFactory/RasterTile.js +1 -1
  35. package/lib/tile/tileFactory/Tile.js +13 -0
  36. package/lib/tile/tileFactory/VectorTile.js +9 -10
  37. package/package.json +6 -6
@@ -1,4 +1,4 @@
1
- export declare type GeometryModelType = 'plane' | 'sprite' | 'billboard';
1
+ export type GeometryModelType = 'plane' | 'sprite' | 'billboard';
2
2
  declare const GeometryModels: {
3
3
  [key in GeometryModelType]: any;
4
4
  };
@@ -1,4 +1,4 @@
1
- export declare type CanvasModelType = 'canvas';
1
+ export type CanvasModelType = 'canvas';
2
2
  declare const CanvasModels: {
3
3
  [key in CanvasModelType]: any;
4
4
  };
@@ -1,7 +1,7 @@
1
1
  import { IAnimateOption, IAttribute, IBlendOptions, ICameraService, IElements, IEncodeFeature, IFontService, IGlobalConfigService, IIconService, ILayer, ILayerModel, ILayerService, IMapService, IModel, IModelUniform, IPickingService, IRendererService, IShaderModuleService, IStyleAttributeService, ITexture2D, ITexture2DInitializationOptions, Triangulation } from '@antv/l7-core';
2
- export declare type styleSingle = number | string | [string, (single: any) => number] | [string, [number, number]];
3
- export declare type styleOffset = string | [number, number] | [string, (single: any) => number];
4
- export declare type styleColor = string | [string, (single: any) => string] | [string, [string, string]];
2
+ export type styleSingle = number | string | [string, (single: any) => number] | [string, [number, number]];
3
+ export type styleOffset = string | [number, number] | [string, (single: any) => number];
4
+ export type styleColor = string | [string, (single: any) => string] | [string, [string, string]];
5
5
  export interface IDataTextureFrame {
6
6
  data: number[];
7
7
  width: number;
@@ -1,5 +1,5 @@
1
- export declare type IPosition = [number, number, number] | [number, number];
2
- export declare type IPath = IPosition[];
1
+ export type IPosition = [number, number, number] | [number, number];
2
+ export type IPath = IPosition[];
3
3
  export declare enum ShapeType3D {
4
4
  CYLINDER = "cylinder",
5
5
  SQUARECOLUMN = "squareColumn",
@@ -4,7 +4,7 @@ interface IEarthLayerStyleOptions {
4
4
  opacity: number;
5
5
  setEarthTime(time: number): void;
6
6
  }
7
- export declare type EarthModelType = 'base' | 'atomSphere' | 'bloomSphere';
7
+ export type EarthModelType = 'base' | 'atomSphere' | 'bloomSphere';
8
8
  export default class EarthLayer extends BaseLayer<IEarthLayerStyleOptions> {
9
9
  type: string;
10
10
  defaultSourceConfig: {
@@ -1,4 +1,4 @@
1
- export declare type HeatMapModelType = 'heatmap' | 'heatmap3d' | 'hexagon' | 'grid' | 'grid3d';
1
+ export type HeatMapModelType = 'heatmap' | 'heatmap3d' | 'hexagon' | 'grid' | 'grid3d';
2
2
  declare const HeatMapModels: {
3
3
  [key in HeatMapModelType]: any;
4
4
  };
@@ -1,4 +1,4 @@
1
- export declare type ImageModelType = 'image';
1
+ export type ImageModelType = 'image';
2
2
  declare const ImageModels: {
3
3
  [key in ImageModelType]: any;
4
4
  };
@@ -1,4 +1,4 @@
1
- export declare type LineModelType = 'arc' | 'arc3d' | 'greatcircle' | 'wall' | 'simple' | 'line' | 'halfLine' | 'linearline' | 'tileLine' | 'earthArc3d';
1
+ export type LineModelType = 'arc' | 'arc3d' | 'greatcircle' | 'wall' | 'simple' | 'line' | 'halfLine' | 'linearline' | 'tileLine' | 'earthArc3d';
2
2
  declare const LineModels: {
3
3
  [key in LineModelType]: any;
4
4
  };
@@ -1,4 +1,4 @@
1
- export declare type MaskModelType = 'fill';
1
+ export type MaskModelType = 'fill';
2
2
  declare const MaskModels: {
3
3
  [key in MaskModelType]: any;
4
4
  };
@@ -179,8 +179,8 @@ var FillImageModel = /*#__PURE__*/function (_BaseModel) {
179
179
  while (1) {
180
180
  switch (_context.prev = _context.next) {
181
181
  case 0:
182
- this.updateTexture();
183
182
  this.iconService.on('imageUpdate', this.updateTexture);
183
+ this.updateTexture();
184
184
  _ref2 = this.layer.getLayerConfig(), _ref2$unit = _ref2.unit, unit = _ref2$unit === void 0 ? 'l7size' : _ref2$unit;
185
185
  version = this.mapService.version;
186
186
 
@@ -50,10 +50,13 @@ var ImageModel = /*#__PURE__*/function (_BaseModel) {
50
50
  min: 'linear mipmap nearest',
51
51
  mipmap: true
52
52
  }); // 更新完纹理后在更新的图层的时候需要更新所有的图层
53
+ // this.layer.layerModelNeedUpdate = true;
53
54
 
54
55
 
55
- _this.layerService.throttleRenderLayers();
56
-
56
+ setTimeout(function () {
57
+ // 延迟渲染
58
+ _this.layerService.throttleRenderLayers();
59
+ });
57
60
  return;
58
61
  }
59
62
 
@@ -142,9 +145,10 @@ var ImageModel = /*#__PURE__*/function (_BaseModel) {
142
145
  while (1) {
143
146
  switch (_context.prev = _context.next) {
144
147
  case 0:
145
- this.registerBuiltinAttributes();
148
+ this.iconService.off('imageUpdate', this.updateTexture);
149
+ this.iconService.on('imageUpdate', this.updateTexture); // this.registerBuiltinAttributes();
150
+
146
151
  this.updateTexture();
147
- this.iconService.on('imageUpdate', this.updateTexture);
148
152
  _context.next = 5;
149
153
  return this.buildModels();
150
154
 
@@ -1,4 +1,4 @@
1
- export declare type PointType = 'fillImage' | 'fill' | 'radar' | 'image' | 'normal' | 'simplePoint' | 'extrude' | 'text' | 'tile' | 'tileText' | 'earthFill' | 'earthExtrude';
1
+ export type PointType = 'fillImage' | 'fill' | 'radar' | 'image' | 'normal' | 'simplePoint' | 'extrude' | 'text' | 'tile' | 'tileText' | 'earthFill' | 'earthExtrude';
2
2
  declare const PointModels: {
3
3
  [key in PointType]: any;
4
4
  };
@@ -1,4 +1,4 @@
1
- export declare type PolygonModelType = 'fill' | 'extrude' | 'line' | 'point_fill' | 'point_image' | 'point_normal' | 'point_extrude' | 'text' | 'water' | 'ocean' | 'tile';
1
+ export type PolygonModelType = 'fill' | 'extrude' | 'line' | 'point_fill' | 'point_image' | 'point_normal' | 'point_extrude' | 'text' | 'water' | 'ocean' | 'tile';
2
2
  declare const PolygonModels: {
3
3
  [key in PolygonModelType]: any;
4
4
  };
@@ -1,4 +1,4 @@
1
- export declare type RasterModelType = 'raster' | 'raster3d' | 'rasterRgb' | 'rasterTerrainRgb';
1
+ export type RasterModelType = 'raster' | 'raster3d' | 'rasterRgb' | 'rasterTerrainRgb';
2
2
  declare const RasterModels: {
3
3
  [key in RasterModelType]: any;
4
4
  };
@@ -1,7 +1,7 @@
1
1
  import { ILayer, IMapService, IRendererService, ISource, ISubLayerInitOptions } from '@antv/l7-core';
2
2
  import { SourceTile } from '@antv/l7-utils';
3
- export declare type Timeout = any;
4
- export declare type CacheEvent = 'click' | 'mousemove' | 'mouseup' | 'mousedown' | 'contextmenu';
3
+ export type Timeout = any;
4
+ export type CacheEvent = 'click' | 'mousemove' | 'mouseup' | 'mousedown' | 'contextmenu';
5
5
  export interface ITileFactoryOptions {
6
6
  parent: ILayer;
7
7
  mapService: IMapService;
@@ -35,7 +35,7 @@ var ImageTile = /*#__PURE__*/function (_Tile) {
35
35
  switch (_context.prev = _context.next) {
36
36
  case 0:
37
37
  attributes = this.parent.getLayerAttributeConfig();
38
- layerOptions = this.parent.getLayerConfig();
38
+ layerOptions = this.getLayerOptions();
39
39
  sourceOptions = this.getSourceOption();
40
40
  layer = new ImageLayer(_objectSpread({}, layerOptions)).source(sourceOptions.data, sourceOptions.options); // 初始化数据映射
41
41
 
@@ -35,7 +35,7 @@ var MaskTile = /*#__PURE__*/function (_Tile) {
35
35
  switch (_context.prev = _context.next) {
36
36
  case 0:
37
37
  attributes = this.parent.getLayerAttributeConfig();
38
- layerOptions = this.parent.getLayerConfig();
38
+ layerOptions = this.getLayerOptions();
39
39
  sourceOptions = this.getSourceOption();
40
40
  layer = new MaskLayer(_objectSpread({}, layerOptions)).source(sourceOptions.data, sourceOptions.options); // 初始化数据映射
41
41
 
@@ -38,7 +38,7 @@ var RasterTile = /*#__PURE__*/function (_Tile) {
38
38
  switch (_context.prev = _context.next) {
39
39
  case 0:
40
40
  attributes = this.parent.getLayerAttributeConfig();
41
- layerOptions = this.parent.getLayerConfig();
41
+ layerOptions = this.getLayerOptions();
42
42
  sourceOptions = this.getSourceOption();
43
43
  layer = new RasterLayer(_objectSpread({}, layerOptions)).source(sourceOptions.data, sourceOptions.options); // 初始化数据映射
44
44
 
@@ -35,7 +35,7 @@ var RasterTerrainRGBTile = /*#__PURE__*/function (_Tile) {
35
35
  switch (_context.prev = _context.next) {
36
36
  case 0:
37
37
  attributes = this.parent.getLayerAttributeConfig();
38
- layerOptions = this.parent.getLayerConfig();
38
+ layerOptions = this.getLayerOptions();
39
39
  sourceOptions = this.getSourceOption();
40
40
  layer = new RasterLayer(_objectSpread({}, layerOptions)).source(sourceOptions.data, sourceOptions.options); // 初始化数据映射
41
41
 
@@ -41,7 +41,7 @@ var RasterTile = /*#__PURE__*/function (_Tile) {
41
41
  switch (_context.prev = _context.next) {
42
42
  case 0:
43
43
  attributes = this.parent.getLayerAttributeConfig();
44
- layerOptions = this.parent.getLayerConfig();
44
+ layerOptions = this.getLayerOptions();
45
45
  sourceOptions = this.getSourceOption();
46
46
  this.colorTexture = this.parent.textureService.getColorTexture(layerOptions.rampColors);
47
47
  layer = new RasterLayer(_objectSpread(_objectSpread({}, layerOptions), {}, {
@@ -15,6 +15,73 @@ export default abstract class Tile implements ITile {
15
15
  styleUpdate(...arg: any): void;
16
16
  abstract initTileLayer(): Promise<void>;
17
17
  lnglatInBounds(lnglat: ILngLat): boolean;
18
+ protected getLayerOptions(): {
19
+ autoFit: boolean;
20
+ mask: boolean | undefined;
21
+ maskInside?: boolean | undefined;
22
+ maskfence?: any;
23
+ maskColor?: string | undefined;
24
+ maskOpacity?: number | undefined;
25
+ sourceLayer?: string | undefined;
26
+ colors?: string[] | undefined;
27
+ size?: number | undefined;
28
+ shape?: string | undefined;
29
+ shape2d?: string[] | undefined;
30
+ shape3d?: string[] | undefined;
31
+ scales?: {
32
+ [key: string]: import("@antv/l7-core").IScale;
33
+ } | undefined;
34
+ minZoom?: number | undefined;
35
+ maxZoom?: number | undefined;
36
+ visible?: boolean | undefined;
37
+ zIndex?: number | undefined;
38
+ pickingBuffer?: number | undefined;
39
+ enablePropagation?: boolean | undefined;
40
+ fitBoundsOptions?: unknown;
41
+ name?: string | undefined;
42
+ blend?: "max" | "normal" | "none" | "min" | "additive" | "subtractive" | undefined;
43
+ depth?: boolean | undefined;
44
+ pickedFeatureID?: number | undefined;
45
+ enableMultiPassRenderer?: boolean | undefined;
46
+ passes?: ((string | [string, {
47
+ [key: string]: unknown;
48
+ }])[] & import("@antv/l7-core").IPass<unknown>[]) | undefined;
49
+ layerType?: string | undefined;
50
+ cursorEnabled?: boolean | undefined;
51
+ cursor?: string | undefined;
52
+ forward?: boolean | undefined;
53
+ usage?: string | undefined;
54
+ enablePicking?: boolean | undefined;
55
+ enableHighlight?: boolean | undefined;
56
+ enableSelect?: boolean | undefined;
57
+ highlightColor?: string | number[] | undefined;
58
+ selectColor?: string | number[] | undefined;
59
+ active?: boolean | undefined;
60
+ activeColor?: string | number[] | undefined;
61
+ activeMix?: number | undefined;
62
+ selectMix?: number | undefined;
63
+ enableTAA?: boolean | undefined;
64
+ jitterScale?: number | undefined;
65
+ enableLighting?: boolean | undefined;
66
+ animateOption?: Partial<import("@antv/l7-core").IAnimateOption> | undefined;
67
+ globalOptions?: any;
68
+ iconfont?: boolean | undefined;
69
+ workerEnabled?: boolean | undefined;
70
+ onHover?: ((pickedFeature: import("@antv/l7-core").IPickedFeature) => void) | undefined;
71
+ onClick?: ((pickedFeature: import("@antv/l7-core").IPickedFeature) => void) | undefined;
72
+ id?: string | HTMLDivElement | undefined;
73
+ canvas?: HTMLCanvasElement | undefined;
74
+ gl?: any;
75
+ hasBaseMap?: boolean | undefined;
76
+ map?: import("@antv/l7-core").IMapWrapper | undefined;
77
+ logoPosition?: import("@antv/l7-core").PositionName | undefined;
78
+ logoVisible?: boolean | undefined;
79
+ animate?: boolean | undefined;
80
+ pickBufferScale?: number | undefined;
81
+ stencil?: boolean | undefined;
82
+ antialias?: boolean | undefined;
83
+ preserveDrawingBuffer?: boolean | undefined;
84
+ };
18
85
  protected addMask(layer: ILayer, mask: ILayer): Promise<void>;
19
86
  protected addLayer(layer: ILayer): Promise<void>;
20
87
  updateVisible(value: boolean): void;
@@ -1,10 +1,12 @@
1
1
  import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
2
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
3
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
4
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
4
5
  import _createClass from "@babel/runtime/helpers/esm/createClass";
5
6
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
6
7
  import _regeneratorRuntime from "@babel/runtime/regenerator";
7
8
  import { createLayerContainer } from '@antv/l7-core';
9
+ import { isNeedMask } from "./util";
8
10
 
9
11
  var Tile = /*#__PURE__*/function () {
10
12
  function Tile(sourceTile, parent) {
@@ -46,6 +48,15 @@ var Tile = /*#__PURE__*/function () {
46
48
  lat = lnglat.lat;
47
49
  return lng >= minLng && lng <= maxLng && lat >= minLat && lat <= maxLat;
48
50
  }
51
+ }, {
52
+ key: "getLayerOptions",
53
+ value: function getLayerOptions() {
54
+ var options = this.parent.getLayerConfig();
55
+ return _objectSpread(_objectSpread({}, options), {}, {
56
+ autoFit: false,
57
+ mask: isNeedMask(this.parent.type) || options.mask
58
+ });
59
+ }
49
60
  }, {
50
61
  key: "addMask",
51
62
  value: function () {
@@ -12,7 +12,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
12
12
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
13
13
 
14
14
  import Tile from "./Tile";
15
- import { getTileLayer, isNeedMask } from "./util";
15
+ import { getTileLayer } from "./util";
16
16
  import MaskLayer from "../../mask";
17
17
 
18
18
  var VectorTile = /*#__PURE__*/function (_Tile) {
@@ -36,20 +36,19 @@ var VectorTile = /*#__PURE__*/function (_Tile) {
36
36
  switch (_context.prev = _context.next) {
37
37
  case 0:
38
38
  attributes = this.parent.getLayerAttributeConfig();
39
- layerOptions = this.parent.getLayerConfig();
40
- layerOptions.mask = isNeedMask(this.parent.type) || layerOptions.mask;
39
+ layerOptions = this.getLayerOptions();
41
40
  vectorLayer = getTileLayer(this.parent.type);
42
41
  sourceOptions = this.getSourceOption();
43
42
 
44
43
  if (sourceOptions) {
45
- _context.next = 8;
44
+ _context.next = 7;
46
45
  break;
47
46
  }
48
47
 
49
48
  this.isLoaded = true;
50
49
  return _context.abrupt("return");
51
50
 
52
- case 8:
51
+ case 7:
53
52
  layer = new vectorLayer(_objectSpread({}, layerOptions)).source(sourceOptions.data, sourceOptions.options); // 初始化数据映射
54
53
 
55
54
  Object.keys(attributes).forEach(function (type) {
@@ -61,22 +60,22 @@ var VectorTile = /*#__PURE__*/function (_Tile) {
61
60
  });
62
61
 
63
62
  if (!layerOptions.mask) {
64
- _context.next = 13;
63
+ _context.next = 12;
65
64
  break;
66
65
  }
67
66
 
68
- _context.next = 13;
67
+ _context.next = 12;
69
68
  return this.addTileMask(layer);
70
69
 
71
- case 13:
72
- _context.next = 15;
70
+ case 12:
71
+ _context.next = 14;
73
72
  return this.addLayer(layer);
74
73
 
75
- case 15:
74
+ case 14:
76
75
  this.setLayerMinMaxZoom(layer);
77
76
  this.isLoaded = true;
78
77
 
79
- case 17:
78
+ case 16:
80
79
  case "end":
81
80
  return _context.stop();
82
81
  }
@@ -6,7 +6,7 @@ import RasterTile from './RasterTile';
6
6
  import RasterRGBTile from './RasterRGBTile';
7
7
  import RasterTerrainRGBTile from './RasterTerrainRGBTile';
8
8
  import MaskLayer from './MaskTile';
9
- export declare type TileType = 'VectorTile' | 'DebugTile' | 'PolygonLayer' | 'PointLayer' | 'LineLayer' | 'RasterLayer' | 'image' | 'MaskLayer' | 'TileDebugLayer';
9
+ export type TileType = 'VectorTile' | 'DebugTile' | 'PolygonLayer' | 'PointLayer' | 'LineLayer' | 'RasterLayer' | 'image' | 'MaskLayer' | 'TileDebugLayer';
10
10
  export declare function getTileFactory(layer: ILayer): typeof VectorTile | typeof DebugTile | typeof ImageTile | typeof RasterTile | typeof RasterRGBTile | typeof RasterTerrainRGBTile | typeof MaskLayer;
11
11
  export * from '../interface';
12
12
  export * from './Tile';
@@ -1,4 +1,4 @@
1
- declare type CallBack = (...args: any[]) => any;
1
+ type CallBack = (...args: any[]) => any;
2
2
  /**
3
3
  * 网格索引,相比 @mapbox/grid-index,在简单计算碰撞检测结果时效率更高
4
4
  * @see https://zhuanlan.zhihu.com/p/74373214
@@ -2,7 +2,7 @@ interface IPoint {
2
2
  x: number;
3
3
  y: number;
4
4
  }
5
- export declare type anchorType = 'right' | 'top-right' | 'left' | 'bottom-right' | 'left' | 'top-left' | 'bottom-left' | 'bottom' | 'bottom-right' | 'bottom-left' | 'top' | 'top-right' | 'top-left' | 'center';
5
+ export type anchorType = 'right' | 'top-right' | 'left' | 'bottom-right' | 'left' | 'top-left' | 'bottom-left' | 'bottom' | 'bottom-right' | 'bottom-left' | 'top' | 'top-right' | 'top-left' | 'center';
6
6
  export interface IGlyphQuad {
7
7
  tr: IPoint;
8
8
  tl: IPoint;
@@ -1,4 +1,4 @@
1
- export declare type WindModelType = 'wind';
1
+ export type WindModelType = 'wind';
2
2
  declare const WindModels: {
3
3
  [key in WindModelType]: any;
4
4
  };
@@ -198,8 +198,8 @@ var FillImageModel = /*#__PURE__*/function (_BaseModel) {
198
198
  while (1) {
199
199
  switch (_context.prev = _context.next) {
200
200
  case 0:
201
- this.updateTexture();
202
201
  this.iconService.on('imageUpdate', this.updateTexture);
202
+ this.updateTexture();
203
203
  _ref2 = this.layer.getLayerConfig(), _ref2$unit = _ref2.unit, unit = _ref2$unit === void 0 ? 'l7size' : _ref2$unit;
204
204
  version = this.mapService.version;
205
205
 
@@ -70,10 +70,13 @@ var ImageModel = /*#__PURE__*/function (_BaseModel) {
70
70
  min: 'linear mipmap nearest',
71
71
  mipmap: true
72
72
  }); // 更新完纹理后在更新的图层的时候需要更新所有的图层
73
+ // this.layer.layerModelNeedUpdate = true;
73
74
 
74
75
 
75
- _this.layerService.throttleRenderLayers();
76
-
76
+ setTimeout(function () {
77
+ // 延迟渲染
78
+ _this.layerService.throttleRenderLayers();
79
+ });
77
80
  return;
78
81
  }
79
82
 
@@ -161,9 +164,10 @@ var ImageModel = /*#__PURE__*/function (_BaseModel) {
161
164
  while (1) {
162
165
  switch (_context.prev = _context.next) {
163
166
  case 0:
164
- this.registerBuiltinAttributes();
167
+ this.iconService.off('imageUpdate', this.updateTexture);
168
+ this.iconService.on('imageUpdate', this.updateTexture); // this.registerBuiltinAttributes();
169
+
165
170
  this.updateTexture();
166
- this.iconService.on('imageUpdate', this.updateTexture);
167
171
  _context.next = 5;
168
172
  return this.buildModels();
169
173
 
@@ -51,7 +51,7 @@ var ImageTile = /*#__PURE__*/function (_Tile) {
51
51
  switch (_context.prev = _context.next) {
52
52
  case 0:
53
53
  attributes = this.parent.getLayerAttributeConfig();
54
- layerOptions = this.parent.getLayerConfig();
54
+ layerOptions = this.getLayerOptions();
55
55
  sourceOptions = this.getSourceOption();
56
56
  layer = new _image.default((0, _objectSpread2.default)({}, layerOptions)).source(sourceOptions.data, sourceOptions.options); // 初始化数据映射
57
57
 
@@ -51,7 +51,7 @@ var MaskTile = /*#__PURE__*/function (_Tile) {
51
51
  switch (_context.prev = _context.next) {
52
52
  case 0:
53
53
  attributes = this.parent.getLayerAttributeConfig();
54
- layerOptions = this.parent.getLayerConfig();
54
+ layerOptions = this.getLayerOptions();
55
55
  sourceOptions = this.getSourceOption();
56
56
  layer = new _mask.default((0, _objectSpread2.default)({}, layerOptions)).source(sourceOptions.data, sourceOptions.options); // 初始化数据映射
57
57
 
@@ -55,7 +55,7 @@ var RasterTile = /*#__PURE__*/function (_Tile) {
55
55
  switch (_context.prev = _context.next) {
56
56
  case 0:
57
57
  attributes = this.parent.getLayerAttributeConfig();
58
- layerOptions = this.parent.getLayerConfig();
58
+ layerOptions = this.getLayerOptions();
59
59
  sourceOptions = this.getSourceOption();
60
60
  layer = new _raster.default((0, _objectSpread2.default)({}, layerOptions)).source(sourceOptions.data, sourceOptions.options); // 初始化数据映射
61
61
 
@@ -51,7 +51,7 @@ var RasterTerrainRGBTile = /*#__PURE__*/function (_Tile) {
51
51
  switch (_context.prev = _context.next) {
52
52
  case 0:
53
53
  attributes = this.parent.getLayerAttributeConfig();
54
- layerOptions = this.parent.getLayerConfig();
54
+ layerOptions = this.getLayerOptions();
55
55
  sourceOptions = this.getSourceOption();
56
56
  layer = new _raster.default((0, _objectSpread2.default)({}, layerOptions)).source(sourceOptions.data, sourceOptions.options); // 初始化数据映射
57
57
 
@@ -60,7 +60,7 @@ var RasterTile = /*#__PURE__*/function (_Tile) {
60
60
  switch (_context.prev = _context.next) {
61
61
  case 0:
62
62
  attributes = this.parent.getLayerAttributeConfig();
63
- layerOptions = this.parent.getLayerConfig();
63
+ layerOptions = this.getLayerOptions();
64
64
  sourceOptions = this.getSourceOption();
65
65
  this.colorTexture = this.parent.textureService.getColorTexture(layerOptions.rampColors);
66
66
  layer = new _raster.default((0, _objectSpread2.default)((0, _objectSpread2.default)({}, layerOptions), {}, {
@@ -11,6 +11,8 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"))
11
11
 
12
12
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
13
13
 
14
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
15
+
14
16
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
15
17
 
16
18
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
@@ -21,6 +23,8 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
21
23
 
22
24
  var _l7Core = require("@antv/l7-core");
23
25
 
26
+ var _util = require("./util");
27
+
24
28
  var Tile = /*#__PURE__*/function () {
25
29
  function Tile(sourceTile, parent) {
26
30
  (0, _classCallCheck2.default)(this, Tile);
@@ -57,6 +61,15 @@ var Tile = /*#__PURE__*/function () {
57
61
  lat = lnglat.lat;
58
62
  return lng >= minLng && lng <= maxLng && lat >= minLat && lat <= maxLat;
59
63
  }
64
+ }, {
65
+ key: "getLayerOptions",
66
+ value: function getLayerOptions() {
67
+ var options = this.parent.getLayerConfig();
68
+ return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, options), {}, {
69
+ autoFit: false,
70
+ mask: (0, _util.isNeedMask)(this.parent.type) || options.mask
71
+ });
72
+ }
60
73
  }, {
61
74
  key: "addMask",
62
75
  value: function () {
@@ -53,20 +53,19 @@ var VectorTile = /*#__PURE__*/function (_Tile) {
53
53
  switch (_context.prev = _context.next) {
54
54
  case 0:
55
55
  attributes = this.parent.getLayerAttributeConfig();
56
- layerOptions = this.parent.getLayerConfig();
57
- layerOptions.mask = (0, _util.isNeedMask)(this.parent.type) || layerOptions.mask;
56
+ layerOptions = this.getLayerOptions();
58
57
  vectorLayer = (0, _util.getTileLayer)(this.parent.type);
59
58
  sourceOptions = this.getSourceOption();
60
59
 
61
60
  if (sourceOptions) {
62
- _context.next = 8;
61
+ _context.next = 7;
63
62
  break;
64
63
  }
65
64
 
66
65
  this.isLoaded = true;
67
66
  return _context.abrupt("return");
68
67
 
69
- case 8:
68
+ case 7:
70
69
  layer = new vectorLayer((0, _objectSpread2.default)({}, layerOptions)).source(sourceOptions.data, sourceOptions.options); // 初始化数据映射
71
70
 
72
71
  Object.keys(attributes).forEach(function (type) {
@@ -78,22 +77,22 @@ var VectorTile = /*#__PURE__*/function (_Tile) {
78
77
  });
79
78
 
80
79
  if (!layerOptions.mask) {
81
- _context.next = 13;
80
+ _context.next = 12;
82
81
  break;
83
82
  }
84
83
 
85
- _context.next = 13;
84
+ _context.next = 12;
86
85
  return this.addTileMask(layer);
87
86
 
88
- case 13:
89
- _context.next = 15;
87
+ case 12:
88
+ _context.next = 14;
90
89
  return this.addLayer(layer);
91
90
 
92
- case 15:
91
+ case 14:
93
92
  this.setLayerMinMaxZoom(layer);
94
93
  this.isLoaded = true;
95
94
 
96
- case 17:
95
+ case 16:
97
96
  case "end":
98
97
  return _context.stop();
99
98
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antv/l7-layers",
3
- "version": "2.10.15",
3
+ "version": "2.11.1",
4
4
  "description": "L7's collection of built-in layers",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -27,10 +27,10 @@
27
27
  "license": "ISC",
28
28
  "dependencies": {
29
29
  "@antv/async-hook": "^2.2.9",
30
- "@antv/l7-core": "2.10.15",
31
- "@antv/l7-maps": "2.10.15",
32
- "@antv/l7-source": "2.10.15",
33
- "@antv/l7-utils": "2.10.15",
30
+ "@antv/l7-core": "2.11.1",
31
+ "@antv/l7-maps": "2.11.1",
32
+ "@antv/l7-source": "2.11.1",
33
+ "@antv/l7-utils": "2.11.1",
34
34
  "@babel/runtime": "^7.7.7",
35
35
  "@mapbox/martini": "^0.2.0",
36
36
  "@turf/clone": "^6.5.0",
@@ -61,7 +61,7 @@
61
61
  "@types/gl-matrix": "^2.4.5",
62
62
  "@types/lodash": "^4.14.138"
63
63
  },
64
- "gitHead": "b567d8c716b042eeb7ab8e05d7e5e0f666469f98",
64
+ "gitHead": "e86da32e1999fdc36668de531d16ab14bce56279",
65
65
  "publishConfig": {
66
66
  "access": "public"
67
67
  }