@antv/l7-layers 2.19.0 → 2.19.2

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.
@@ -299,7 +299,8 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
299
299
  // @ts-ignore
300
300
  attributeValues,
301
301
  // @ts-ignore
302
- _this3.getLayerConfig()[attributeName]))
302
+ attributeField ? undefined : _this3.getLayerConfig()[attributeName] // 设置了字段不需要设置默认值
303
+ ))
303
304
  },
304
305
  // @ts-ignore
305
306
  updateOptions);
@@ -1475,7 +1476,7 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
1475
1476
  key: "splitValuesAndCallbackInAttribute",
1476
1477
  value: function splitValuesAndCallbackInAttribute(valuesOrCallback, defaultValues) {
1477
1478
  return {
1478
- values: isFunction(valuesOrCallback) ? undefined : valuesOrCallback || defaultValues,
1479
+ values: isFunction(valuesOrCallback) ? undefined : valuesOrCallback,
1479
1480
  callback: isFunction(valuesOrCallback) ? valuesOrCallback : undefined
1480
1481
  };
1481
1482
  }
@@ -252,6 +252,9 @@ var FeatureScalePlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/functi
252
252
  // text 为内置变 如果是文本则为cat
253
253
  type = ScaleTypes.CAT;
254
254
  }
255
+ if (values === undefined) {
256
+ type = ScaleTypes.IDENTITY;
257
+ }
255
258
  var cfg = this.createScaleConfig(type, field, scaleOption, data);
256
259
  styleScale.scale = this.createDefaultScale(cfg);
257
260
  styleScale.option = cfg;
@@ -22,7 +22,9 @@ var PolygonLayer = /*#__PURE__*/function (_BaseLayer) {
22
22
  }
23
23
  _this = _super.call.apply(_super, [this].concat(args));
24
24
  _defineProperty(_assertThisInitialized(_this), "type", 'PolygonLayer');
25
- _defineProperty(_assertThisInitialized(_this), "enableShaderEncodeStyles", ['opacity', 'extrusionBase']);
25
+ _defineProperty(_assertThisInitialized(_this), "enableShaderEncodeStyles", ['opacity', 'extrusionBase',
26
+ // shape 为文本时
27
+ 'rotation', 'offsets', 'stroke']);
26
28
  return _this;
27
29
  }
28
30
  _createClass(PolygonLayer, [{
@@ -14,7 +14,7 @@ import { PolygonExtrudeTriangulation } from "../../core/triangulation";
14
14
  /* babel-plugin-inline-import '../shaders/extrusion/polygon_extrusion_frag.glsl' */
15
15
  var polygonExtrudeFrag = "\nuniform float u_opacity: 1.0;\nvarying vec4 v_Color;\nvarying vec2 v_texture_data;\n\n\n#pragma include \"picking\"\n\nvoid main() {\n\n gl_FragColor = v_Color;\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
16
16
  /* babel-plugin-inline-import '../shaders/extrusion/polygon_extrusion_vert.glsl' */
17
- var polygonExtrudeVert = "precision highp float;\n\n#define ambientRatio 0.5\n#define diffuseRatio 0.3\n#define specularRatio 0.2\n\nattribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Normal;\nattribute float a_Size;\nuniform mat4 u_ModelMatrix;\n\n\n\n\nvarying vec4 v_Color;\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\nvoid main() {\n \n vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size + (1.0 - a_Position.z) * extrusionBase * 1.5, 1.0);\n float lightWeight = calc_lighting(pos);\n vec4 project_pos = project_position(pos);\n // project_pos.z += extrusionBase * 2.0;\n v_Color = a_Color;\n v_Color = vec4(v_Color.rgb * lightWeight, v_Color.w * opacity);\n\n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xyz, 1.0));\n\n setPickingColor(a_PickingColor);\n}\n";
17
+ var polygonExtrudeVert = "precision highp float;\n\n#define ambientRatio 0.5\n#define diffuseRatio 0.3\n#define specularRatio 0.2\n\nattribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Normal;\nattribute float a_Size;\nuniform mat4 u_ModelMatrix;\n\n\n\n\nvarying vec4 v_Color;\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\nvoid main() {\n \n vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size + (1.0 - a_Position.z) * extrusionBase, 1.0);\n float lightWeight = calc_lighting(pos);\n vec4 project_pos = project_position(pos);\n v_Color = a_Color;\n v_Color = vec4(v_Color.rgb * lightWeight, v_Color.w * opacity);\n\n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xyz, 1.0));\n\n setPickingColor(a_PickingColor);\n}\n";
18
18
  var ExtrusionModel = /*#__PURE__*/function (_BaseModel) {
19
19
  _inherits(ExtrusionModel, _BaseModel);
20
20
  var _super = _createSuper(ExtrusionModel);
@@ -21,10 +21,9 @@ varying vec4 v_Color;
21
21
 
22
22
  void main() {
23
23
 
24
- vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size + (1.0 - a_Position.z) * extrusionBase * 1.5, 1.0);
24
+ vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size + (1.0 - a_Position.z) * extrusionBase, 1.0);
25
25
  float lightWeight = calc_lighting(pos);
26
26
  vec4 project_pos = project_position(pos);
27
- // project_pos.z += extrusionBase * 2.0;
28
27
  v_Color = a_Color;
29
28
  v_Color = vec4(v_Color.rgb * lightWeight, v_Color.w * opacity);
30
29
 
@@ -305,7 +305,8 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
305
305
  // @ts-ignore
306
306
  attributeValues,
307
307
  // @ts-ignore
308
- _this3.getLayerConfig()[attributeName]))
308
+ attributeField ? undefined : _this3.getLayerConfig()[attributeName] // 设置了字段不需要设置默认值
309
+ ))
309
310
  },
310
311
  // @ts-ignore
311
312
  updateOptions);
@@ -1481,7 +1482,7 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
1481
1482
  key: "splitValuesAndCallbackInAttribute",
1482
1483
  value: function splitValuesAndCallbackInAttribute(valuesOrCallback, defaultValues) {
1483
1484
  return {
1484
- values: isFunction(valuesOrCallback) ? undefined : valuesOrCallback || defaultValues,
1485
+ values: isFunction(valuesOrCallback) ? undefined : valuesOrCallback,
1485
1486
  callback: isFunction(valuesOrCallback) ? valuesOrCallback : undefined
1486
1487
  };
1487
1488
  }
@@ -262,6 +262,9 @@ var FeatureScalePlugin = (_dec = (0, _inversify.injectable)(), _dec(_class = /*#
262
262
  // text 为内置变 如果是文本则为cat
263
263
  type = _l7Core.ScaleTypes.CAT;
264
264
  }
265
+ if (values === undefined) {
266
+ type = _l7Core.ScaleTypes.IDENTITY;
267
+ }
265
268
  var cfg = this.createScaleConfig(type, field, scaleOption, data);
266
269
  styleScale.scale = this.createDefaultScale(cfg);
267
270
  styleScale.option = cfg;
@@ -29,7 +29,9 @@ var PolygonLayer = /*#__PURE__*/function (_BaseLayer) {
29
29
  }
30
30
  _this = _super.call.apply(_super, [this].concat(args));
31
31
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "type", 'PolygonLayer');
32
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "enableShaderEncodeStyles", ['opacity', 'extrusionBase']);
32
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "enableShaderEncodeStyles", ['opacity', 'extrusionBase',
33
+ // shape 为文本时
34
+ 'rotation', 'offsets', 'stroke']);
33
35
  return _this;
34
36
  }
35
37
  (0, _createClass2.default)(PolygonLayer, [{
@@ -21,7 +21,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
21
21
  /* babel-plugin-inline-import '../shaders/extrusion/polygon_extrusion_frag.glsl' */
22
22
  var polygonExtrudeFrag = "\nuniform float u_opacity: 1.0;\nvarying vec4 v_Color;\nvarying vec2 v_texture_data;\n\n\n#pragma include \"picking\"\n\nvoid main() {\n\n gl_FragColor = v_Color;\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
23
23
  /* babel-plugin-inline-import '../shaders/extrusion/polygon_extrusion_vert.glsl' */
24
- var polygonExtrudeVert = "precision highp float;\n\n#define ambientRatio 0.5\n#define diffuseRatio 0.3\n#define specularRatio 0.2\n\nattribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Normal;\nattribute float a_Size;\nuniform mat4 u_ModelMatrix;\n\n\n\n\nvarying vec4 v_Color;\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\nvoid main() {\n \n vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size + (1.0 - a_Position.z) * extrusionBase * 1.5, 1.0);\n float lightWeight = calc_lighting(pos);\n vec4 project_pos = project_position(pos);\n // project_pos.z += extrusionBase * 2.0;\n v_Color = a_Color;\n v_Color = vec4(v_Color.rgb * lightWeight, v_Color.w * opacity);\n\n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xyz, 1.0));\n\n setPickingColor(a_PickingColor);\n}\n";
24
+ var polygonExtrudeVert = "precision highp float;\n\n#define ambientRatio 0.5\n#define diffuseRatio 0.3\n#define specularRatio 0.2\n\nattribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Normal;\nattribute float a_Size;\nuniform mat4 u_ModelMatrix;\n\n\n\n\nvarying vec4 v_Color;\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\nvoid main() {\n \n vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size + (1.0 - a_Position.z) * extrusionBase, 1.0);\n float lightWeight = calc_lighting(pos);\n vec4 project_pos = project_position(pos);\n v_Color = a_Color;\n v_Color = vec4(v_Color.rgb * lightWeight, v_Color.w * opacity);\n\n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xyz, 1.0));\n\n setPickingColor(a_PickingColor);\n}\n";
25
25
  var ExtrusionModel = /*#__PURE__*/function (_BaseModel) {
26
26
  (0, _inherits2.default)(ExtrusionModel, _BaseModel);
27
27
  var _super = _createSuper(ExtrusionModel);
@@ -21,10 +21,9 @@ varying vec4 v_Color;
21
21
 
22
22
  void main() {
23
23
 
24
- vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size + (1.0 - a_Position.z) * extrusionBase * 1.5, 1.0);
24
+ vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size + (1.0 - a_Position.z) * extrusionBase, 1.0);
25
25
  float lightWeight = calc_lighting(pos);
26
26
  vec4 project_pos = project_position(pos);
27
- // project_pos.z += extrusionBase * 2.0;
28
27
  v_Color = a_Color;
29
28
  v_Color = vec4(v_Color.rgb * lightWeight, v_Color.w * opacity);
30
29
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antv/l7-layers",
3
- "version": "2.19.0",
3
+ "version": "2.19.2",
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.19.0",
31
- "@antv/l7-maps": "2.19.0",
32
- "@antv/l7-source": "2.19.0",
33
- "@antv/l7-utils": "2.19.0",
30
+ "@antv/l7-core": "2.19.2",
31
+ "@antv/l7-maps": "2.19.2",
32
+ "@antv/l7-source": "2.19.2",
33
+ "@antv/l7-utils": "2.19.2",
34
34
  "@babel/runtime": "^7.7.7",
35
35
  "@mapbox/martini": "^0.2.0",
36
36
  "@turf/clone": "^6.5.0",
@@ -52,7 +52,7 @@
52
52
  "reflect-metadata": "^0.1.13"
53
53
  },
54
54
  "devDependencies": {
55
- "@antv/l7-test-utils": "2.19.0",
55
+ "@antv/l7-test-utils": "2.19.2",
56
56
  "@types/d3-array": "^2.0.0",
57
57
  "@types/d3-color": "^1.2.2",
58
58
  "@types/d3-interpolate": "1.1.6",
@@ -61,7 +61,7 @@
61
61
  "@types/gl-matrix": "^2.4.5",
62
62
  "@types/lodash": "^4.14.138"
63
63
  },
64
- "gitHead": "7f08eaafe2a25e986ba52c625acf5511f1184b82",
64
+ "gitHead": "bb4874bc2e888d843be4946a9990b0add4570fa1",
65
65
  "publishConfig": {
66
66
  "access": "public"
67
67
  }