@deck.gl/aggregation-layers 8.6.0-alpha.3 → 8.6.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.
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@deck.gl/aggregation-layers",
3
3
  "description": "deck.gl layers that aggregate the input data into alternative representations",
4
4
  "license": "MIT",
5
- "version": "8.6.0-alpha.3",
5
+ "version": "8.6.1",
6
6
  "publishConfig": {
7
7
  "access": "public"
8
8
  },
@@ -29,7 +29,7 @@
29
29
  "prepublishOnly": "npm run build-bundle && npm run build-bundle -- --env.dev"
30
30
  },
31
31
  "dependencies": {
32
- "@luma.gl/shadertools": "^8.5.5",
32
+ "@luma.gl/shadertools": "^8.5.10",
33
33
  "@math.gl/web-mercator": "^3.5.4",
34
34
  "d3-hexbin": "^0.2.1"
35
35
  },
@@ -37,5 +37,5 @@
37
37
  "@deck.gl/core": "^8.0.0",
38
38
  "@deck.gl/layers": "^8.0.0"
39
39
  },
40
- "gitHead": "b43ac51af23cb186e3cbb2ed9c69fddd16483745"
40
+ "gitHead": "9611fa7fc206cf2970ac4dfdb35a50677b0afa3c"
41
41
  }
@@ -95,7 +95,6 @@ float linearScale(vec2 domain, vec2 range, float value) {
95
95
  }
96
96
 
97
97
  void main(void) {
98
-
99
98
  vec2 clrDomain = colorDomainValid ? colorDomain : vec2(colorData.maxMinCount.a, colorData.maxMinCount.r);
100
99
  vec4 color = quantizeScale(clrDomain, colorRange, colors.r);
101
100
 
@@ -121,6 +120,7 @@ void main(void) {
121
120
 
122
121
  vec3 centroidPosition = vec3(instancePositionXFP64[0], instancePositionYFP64[0], elevation);
123
122
  vec3 centroidPosition64Low = vec3(instancePositionXFP64[1], instancePositionYFP64[1], 0.0);
123
+ geometry.worldPosition = centroidPosition;
124
124
  vec3 pos = vec3(project_size(positions.xy + offset) * dotRadius, 0.);
125
125
 
126
126
  // Set color to be rendered to picking fbo (also used to check for selection highlight).
@@ -114,8 +114,9 @@ export default class HeatmapLayer extends AggregationLayer {
114
114
  const {props, oldProps} = opts;
115
115
  const changeFlags = this._getChangeFlags(opts);
116
116
 
117
- if (changeFlags.viewportChanged) {
118
- changeFlags.boundsChanged = this._updateBounds();
117
+ if (changeFlags.dataChanged || changeFlags.viewportChanged) {
118
+ // if data is changed, do not debounce and immediately update the weight map
119
+ changeFlags.boundsChanged = this._updateBounds(changeFlags.dataChanged);
119
120
  this._updateTextureRenderingBounds();
120
121
  }
121
122
 
@@ -66,9 +66,6 @@ const defaultProps = {
66
66
  };
67
67
 
68
68
  export default class HexagonLayer extends AggregationLayer {
69
- shouldUpdateState({changeFlags}) {
70
- return changeFlags.somethingChanged;
71
- }
72
69
  initializeState() {
73
70
  const cpuAggregator = new CPUAggregator({
74
71
  getAggregator: props => props.hexagonAggregator,
@@ -78,7 +75,7 @@ export default class HexagonLayer extends AggregationLayer {
78
75
  this.state = {
79
76
  cpuAggregator,
80
77
  aggregatorState: cpuAggregator.state,
81
- hexagonVertices: null
78
+ vertices: null
82
79
  };
83
80
  const attributeManager = this.getAttributeManager();
84
81
  attributeManager.add({
@@ -90,47 +87,25 @@ export default class HexagonLayer extends AggregationLayer {
90
87
 
91
88
  updateState(opts) {
92
89
  super.updateState(opts);
93
- const {cpuAggregator, hexagonVertices: oldVertices} = this.state;
94
90
 
95
91
  if (opts.changeFlags.propsOrDataChanged) {
96
- this.setState({
97
- // make a copy of the internal state of cpuAggregator for testing
98
- aggregatorState: cpuAggregator.updateState(opts, {
99
- viewport: this.context.viewport,
100
- attributes: this.getAttributes()
101
- })
92
+ const aggregatorState = this.state.cpuAggregator.updateState(opts, {
93
+ viewport: this.context.viewport,
94
+ attributes: this.getAttributes()
102
95
  });
103
- }
104
-
105
- // if user provided custom aggregator and returns hexagonVertices,
106
- // Need to recalculate radius and angle based on vertices
107
- const {hexagonVertices} = cpuAggregator.state.layerData || {};
108
-
109
- if (hexagonVertices && oldVertices !== hexagonVertices) {
110
- const vertices = this.convertLatLngToMeterOffset(hexagonVertices);
111
- if (vertices) {
96
+ if (this.state.aggregatorState.layerData !== aggregatorState.layerData) {
97
+ // if user provided custom aggregator and returns hexagonVertices,
98
+ // Need to recalculate radius and angle based on vertices
99
+ const {hexagonVertices} = aggregatorState.layerData || {};
112
100
  this.setState({
113
- hexagonVertices,
114
- vertices
101
+ vertices: hexagonVertices && this.convertLatLngToMeterOffset(hexagonVertices)
115
102
  });
116
103
  }
117
- } else {
118
- // update radius angle by viewport
119
- this.updateRadiusAngle();
120
- }
121
- }
122
-
123
- updateRadiusAngle(vertices) {
124
- const {viewport} = this.context;
125
- const {unitsPerMeter} = viewport.getDistanceScales();
126
- const {cpuAggregator} = this.state;
127
-
128
- if (cpuAggregator.state.layerData && cpuAggregator.state.layerData.radiusCommon) {
129
- const {radiusCommon} = cpuAggregator.state.layerData;
130
- const radius = radiusCommon / unitsPerMeter[0];
131
104
 
132
- // convert radius in common to meter
133
- this.setState({angle: 90, radius});
105
+ this.setState({
106
+ // make a copy of the internal state of cpuAggregator for testing
107
+ aggregatorState
108
+ });
134
109
  }
135
110
  }
136
111
 
@@ -183,12 +158,19 @@ export default class HexagonLayer extends AggregationLayer {
183
158
 
184
159
  renderLayers() {
185
160
  const {elevationScale, extruded, coverage, material, transitions} = this.props;
186
- const {angle, radius, cpuAggregator, vertices} = this.state;
161
+ const {aggregatorState, vertices} = this.state;
187
162
 
188
163
  const SubLayerClass = this.getSubLayerClass('hexagon-cell', ColumnLayer);
189
164
  const updateTriggers = this._getSublayerUpdateTriggers();
190
165
 
191
- const geometry = vertices && vertices.length ? {vertices, radius: 1} : {radius, angle};
166
+ const geometry = vertices
167
+ ? {vertices, radius: 1}
168
+ : {
169
+ // default geometry
170
+ radius: aggregatorState.layerData.radiusCommon || 1,
171
+ radiusUnits: 'common',
172
+ angle: 90
173
+ };
192
174
  return new SubLayerClass(
193
175
  {
194
176
  ...geometry,
@@ -210,7 +192,7 @@ export default class HexagonLayer extends AggregationLayer {
210
192
  updateTriggers
211
193
  }),
212
194
  {
213
- data: cpuAggregator.state.layerData.data
195
+ data: aggregatorState.layerData.data
214
196
  }
215
197
  );
216
198
  }