@deck.gl/aggregation-layers 8.6.3 → 8.7.0-alpha.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 (59) hide show
  1. package/dist/dist.dev.js +243 -243
  2. package/dist/es5/aggregation-layer.js +163 -109
  3. package/dist/es5/aggregation-layer.js.map +1 -1
  4. package/dist/es5/contour-layer/contour-layer.js +260 -240
  5. package/dist/es5/contour-layer/contour-layer.js.map +1 -1
  6. package/dist/es5/contour-layer/contour-utils.js +86 -65
  7. package/dist/es5/contour-layer/contour-utils.js.map +1 -1
  8. package/dist/es5/contour-layer/marching-squares-codes.js +106 -181
  9. package/dist/es5/contour-layer/marching-squares-codes.js.map +1 -1
  10. package/dist/es5/contour-layer/marching-squares.js +59 -56
  11. package/dist/es5/contour-layer/marching-squares.js.map +1 -1
  12. package/dist/es5/cpu-grid-layer/cpu-grid-layer.js +121 -85
  13. package/dist/es5/cpu-grid-layer/cpu-grid-layer.js.map +1 -1
  14. package/dist/es5/cpu-grid-layer/grid-aggregator.js +119 -93
  15. package/dist/es5/cpu-grid-layer/grid-aggregator.js.map +1 -1
  16. package/dist/es5/gpu-grid-layer/gpu-grid-cell-layer.js +167 -131
  17. package/dist/es5/gpu-grid-layer/gpu-grid-cell-layer.js.map +1 -1
  18. package/dist/es5/gpu-grid-layer/gpu-grid-layer.js +322 -319
  19. package/dist/es5/gpu-grid-layer/gpu-grid-layer.js.map +1 -1
  20. package/dist/es5/grid-aggregation-layer.js +230 -202
  21. package/dist/es5/grid-aggregation-layer.js.map +1 -1
  22. package/dist/es5/grid-layer/grid-layer.js +91 -61
  23. package/dist/es5/grid-layer/grid-layer.js.map +1 -1
  24. package/dist/es5/heatmap-layer/heatmap-layer-utils.js +59 -24
  25. package/dist/es5/heatmap-layer/heatmap-layer-utils.js.map +1 -1
  26. package/dist/es5/heatmap-layer/heatmap-layer.js +533 -515
  27. package/dist/es5/heatmap-layer/heatmap-layer.js.map +1 -1
  28. package/dist/es5/heatmap-layer/triangle-layer.js +91 -64
  29. package/dist/es5/heatmap-layer/triangle-layer.js.map +1 -1
  30. package/dist/es5/hexagon-layer/hexagon-aggregator.js +77 -59
  31. package/dist/es5/hexagon-layer/hexagon-aggregator.js.map +1 -1
  32. package/dist/es5/hexagon-layer/hexagon-layer.js +164 -121
  33. package/dist/es5/hexagon-layer/hexagon-layer.js.map +1 -1
  34. package/dist/es5/index.js +12 -12
  35. package/dist/es5/screen-grid-layer/screen-grid-cell-layer.js +193 -168
  36. package/dist/es5/screen-grid-layer/screen-grid-cell-layer.js.map +1 -1
  37. package/dist/es5/screen-grid-layer/screen-grid-layer.js +250 -235
  38. package/dist/es5/screen-grid-layer/screen-grid-layer.js.map +1 -1
  39. package/dist/es5/utils/aggregation-operation-utils.js +31 -16
  40. package/dist/es5/utils/aggregation-operation-utils.js.map +1 -1
  41. package/dist/es5/utils/bin-sorter.js +198 -118
  42. package/dist/es5/utils/bin-sorter.js.map +1 -1
  43. package/dist/es5/utils/color-utils.js +10 -8
  44. package/dist/es5/utils/color-utils.js.map +1 -1
  45. package/dist/es5/utils/cpu-aggregator.js +342 -323
  46. package/dist/es5/utils/cpu-aggregator.js.map +1 -1
  47. package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js +18 -20
  48. package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js.map +1 -1
  49. package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator.js +545 -545
  50. package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator.js.map +1 -1
  51. package/dist/es5/utils/grid-aggregation-utils.js +44 -50
  52. package/dist/es5/utils/grid-aggregation-utils.js.map +1 -1
  53. package/dist/es5/utils/prop-utils.js +2 -2
  54. package/dist/es5/utils/prop-utils.js.map +1 -1
  55. package/dist/es5/utils/resource-utils.js +39 -32
  56. package/dist/es5/utils/resource-utils.js.map +1 -1
  57. package/dist/es5/utils/scale-utils.js +66 -36
  58. package/dist/es5/utils/scale-utils.js.map +1 -1
  59. package/package.json +2 -2
@@ -7,6 +7,22 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports.default = void 0;
9
9
 
10
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
+
12
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
+
14
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
15
+
16
+ var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
17
+
18
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
19
+
20
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
21
+
22
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
23
+
24
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
25
+
10
26
  var _heatmapLayerUtils = require("./heatmap-layer-utils");
11
27
 
12
28
  var _core = require("@luma.gl/core");
@@ -27,26 +43,33 @@ var _maxVs = _interopRequireDefault(require("./max-vs.glsl"));
27
43
 
28
44
  var _maxFs = _interopRequireDefault(require("./max-fs.glsl"));
29
45
 
30
- const RESOLUTION = 2;
31
- const TEXTURE_OPTIONS = {
46
+ var _parameters;
47
+
48
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
49
+
50
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
51
+
52
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
53
+
54
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
55
+
56
+ var RESOLUTION = 2;
57
+ var TEXTURE_OPTIONS = {
32
58
  mipmaps: false,
33
- parameters: {
34
- [10240]: 9729,
35
- [10241]: 9729,
36
- [10242]: 33071,
37
- [10243]: 33071
38
- },
59
+ parameters: (_parameters = {}, (0, _defineProperty2.default)(_parameters, 10240, 9729), (0, _defineProperty2.default)(_parameters, 10241, 9729), (0, _defineProperty2.default)(_parameters, 10242, 33071), (0, _defineProperty2.default)(_parameters, 10243, 33071), _parameters),
39
60
  dataFormat: 6408
40
61
  };
41
- const DEFAULT_COLOR_DOMAIN = [0, 0];
42
- const AGGREGATION_MODE = {
62
+ var DEFAULT_COLOR_DOMAIN = [0, 0];
63
+ var AGGREGATION_MODE = {
43
64
  SUM: 0,
44
65
  MEAN: 1
45
66
  };
46
- const defaultProps = {
67
+ var defaultProps = {
47
68
  getPosition: {
48
69
  type: 'accessor',
49
- value: x => x.position
70
+ value: function value(x) {
71
+ return x.position;
72
+ }
50
73
  },
51
74
  getWeight: {
52
75
  type: 'accessor',
@@ -89,568 +112,563 @@ const defaultProps = {
89
112
  value: 500
90
113
  }
91
114
  };
92
- const REQUIRED_FEATURES = [_core.FEATURES.BLEND_EQUATION_MINMAX, _core.FEATURES.TEXTURE_FLOAT];
93
- const DIMENSIONS = {
115
+ var REQUIRED_FEATURES = [_core.FEATURES.BLEND_EQUATION_MINMAX, _core.FEATURES.TEXTURE_FLOAT];
116
+ var DIMENSIONS = {
94
117
  data: {
95
118
  props: ['radiusPixels']
96
119
  }
97
120
  };
98
121
 
99
- class HeatmapLayer extends _aggregationLayer.default {
100
- initializeState() {
101
- const {
102
- gl
103
- } = this.context;
122
+ var HeatmapLayer = function (_AggregationLayer) {
123
+ (0, _inherits2.default)(HeatmapLayer, _AggregationLayer);
104
124
 
105
- if (!(0, _core.hasFeatures)(gl, REQUIRED_FEATURES)) {
106
- this.setState({
107
- supported: false
108
- });
125
+ var _super = _createSuper(HeatmapLayer);
109
126
 
110
- _core2.log.error("HeatmapLayer: ".concat(this.id, " is not supported on this browser"))();
127
+ function HeatmapLayer() {
128
+ (0, _classCallCheck2.default)(this, HeatmapLayer);
129
+ return _super.apply(this, arguments);
130
+ }
111
131
 
112
- return;
113
- }
132
+ (0, _createClass2.default)(HeatmapLayer, [{
133
+ key: "initializeState",
134
+ value: function initializeState() {
135
+ var gl = this.context.gl;
114
136
 
115
- super.initializeState(DIMENSIONS);
116
- this.setState({
117
- supported: true,
118
- colorDomain: DEFAULT_COLOR_DOMAIN
119
- });
137
+ if (!(0, _core.hasFeatures)(gl, REQUIRED_FEATURES)) {
138
+ this.setState({
139
+ supported: false
140
+ });
120
141
 
121
- this._setupTextureParams();
142
+ _core2.log.error("HeatmapLayer: ".concat(this.id, " is not supported on this browser"))();
122
143
 
123
- this._setupAttributes();
144
+ return;
145
+ }
124
146
 
125
- this._setupResources();
126
- }
147
+ (0, _get2.default)((0, _getPrototypeOf2.default)(HeatmapLayer.prototype), "initializeState", this).call(this, DIMENSIONS);
148
+ this.setState({
149
+ supported: true,
150
+ colorDomain: DEFAULT_COLOR_DOMAIN
151
+ });
127
152
 
128
- shouldUpdateState({
129
- changeFlags
130
- }) {
131
- return changeFlags.somethingChanged;
132
- }
153
+ this._setupTextureParams();
154
+
155
+ this._setupAttributes();
133
156
 
134
- updateState(opts) {
135
- if (!this.state.supported) {
136
- return;
157
+ this._setupResources();
137
158
  }
159
+ }, {
160
+ key: "shouldUpdateState",
161
+ value: function shouldUpdateState(_ref) {
162
+ var changeFlags = _ref.changeFlags;
163
+ return changeFlags.somethingChanged;
164
+ }
165
+ }, {
166
+ key: "updateState",
167
+ value: function updateState(opts) {
168
+ if (!this.state.supported) {
169
+ return;
170
+ }
138
171
 
139
- super.updateState(opts);
172
+ (0, _get2.default)((0, _getPrototypeOf2.default)(HeatmapLayer.prototype), "updateState", this).call(this, opts);
140
173
 
141
- this._updateHeatmapState(opts);
142
- }
174
+ this._updateHeatmapState(opts);
175
+ }
176
+ }, {
177
+ key: "_updateHeatmapState",
178
+ value: function _updateHeatmapState(opts) {
179
+ var props = opts.props,
180
+ oldProps = opts.oldProps;
181
+
182
+ var changeFlags = this._getChangeFlags(opts);
143
183
 
144
- _updateHeatmapState(opts) {
145
- const {
146
- props,
147
- oldProps
148
- } = opts;
184
+ if (changeFlags.dataChanged || changeFlags.viewportChanged) {
185
+ changeFlags.boundsChanged = this._updateBounds(changeFlags.dataChanged);
149
186
 
150
- const changeFlags = this._getChangeFlags(opts);
187
+ this._updateTextureRenderingBounds();
188
+ }
151
189
 
152
- if (changeFlags.dataChanged || changeFlags.viewportChanged) {
153
- changeFlags.boundsChanged = this._updateBounds(changeFlags.dataChanged);
190
+ if (changeFlags.dataChanged || changeFlags.boundsChanged) {
191
+ clearTimeout(this.state.updateTimer);
192
+ this.setState({
193
+ isWeightMapDirty: true
194
+ });
195
+ } else if (changeFlags.viewportZoomChanged) {
196
+ this._debouncedUpdateWeightmap();
197
+ }
154
198
 
155
- this._updateTextureRenderingBounds();
156
- }
199
+ if (props.colorRange !== oldProps.colorRange) {
200
+ this._updateColorTexture(opts);
201
+ }
202
+
203
+ if (this.state.isWeightMapDirty) {
204
+ this._updateWeightmap();
205
+ }
157
206
 
158
- if (changeFlags.dataChanged || changeFlags.boundsChanged) {
159
- clearTimeout(this.state.updateTimer);
160
207
  this.setState({
161
- isWeightMapDirty: true
208
+ zoom: opts.context.viewport.zoom
162
209
  });
163
- } else if (changeFlags.viewportZoomChanged) {
164
- this._debouncedUpdateWeightmap();
165
210
  }
211
+ }, {
212
+ key: "renderLayers",
213
+ value: function renderLayers() {
214
+ if (!this.state.supported) {
215
+ return [];
216
+ }
166
217
 
167
- if (props.colorRange !== oldProps.colorRange) {
168
- this._updateColorTexture(opts);
218
+ var _this$state = this.state,
219
+ weightsTexture = _this$state.weightsTexture,
220
+ triPositionBuffer = _this$state.triPositionBuffer,
221
+ triTexCoordBuffer = _this$state.triTexCoordBuffer,
222
+ maxWeightsTexture = _this$state.maxWeightsTexture,
223
+ colorTexture = _this$state.colorTexture,
224
+ colorDomain = _this$state.colorDomain;
225
+ var _this$props = this.props,
226
+ updateTriggers = _this$props.updateTriggers,
227
+ intensity = _this$props.intensity,
228
+ threshold = _this$props.threshold,
229
+ aggregation = _this$props.aggregation;
230
+ var TriangleLayerClass = this.getSubLayerClass('triangle', _triangleLayer.default);
231
+ return new TriangleLayerClass(this.getSubLayerProps({
232
+ id: 'triangle-layer',
233
+ updateTriggers: updateTriggers
234
+ }), {
235
+ coordinateSystem: _core2.COORDINATE_SYSTEM.DEFAULT,
236
+ data: {
237
+ attributes: {
238
+ positions: triPositionBuffer,
239
+ texCoords: triTexCoordBuffer
240
+ }
241
+ },
242
+ vertexCount: 4,
243
+ maxTexture: maxWeightsTexture,
244
+ colorTexture: colorTexture,
245
+ aggregationMode: AGGREGATION_MODE[aggregation] || 0,
246
+ texture: weightsTexture,
247
+ intensity: intensity,
248
+ threshold: threshold,
249
+ colorDomain: colorDomain
250
+ });
169
251
  }
170
-
171
- if (this.state.isWeightMapDirty) {
172
- this._updateWeightmap();
252
+ }, {
253
+ key: "finalizeState",
254
+ value: function finalizeState() {
255
+ (0, _get2.default)((0, _getPrototypeOf2.default)(HeatmapLayer.prototype), "finalizeState", this).call(this);
256
+ var _this$state2 = this.state,
257
+ weightsTransform = _this$state2.weightsTransform,
258
+ weightsTexture = _this$state2.weightsTexture,
259
+ maxWeightTransform = _this$state2.maxWeightTransform,
260
+ maxWeightsTexture = _this$state2.maxWeightsTexture,
261
+ triPositionBuffer = _this$state2.triPositionBuffer,
262
+ triTexCoordBuffer = _this$state2.triTexCoordBuffer,
263
+ colorTexture = _this$state2.colorTexture,
264
+ updateTimer = _this$state2.updateTimer;
265
+ weightsTransform === null || weightsTransform === void 0 ? void 0 : weightsTransform.delete();
266
+ weightsTexture === null || weightsTexture === void 0 ? void 0 : weightsTexture.delete();
267
+ maxWeightTransform === null || maxWeightTransform === void 0 ? void 0 : maxWeightTransform.delete();
268
+ maxWeightsTexture === null || maxWeightsTexture === void 0 ? void 0 : maxWeightsTexture.delete();
269
+ triPositionBuffer === null || triPositionBuffer === void 0 ? void 0 : triPositionBuffer.delete();
270
+ triTexCoordBuffer === null || triTexCoordBuffer === void 0 ? void 0 : triTexCoordBuffer.delete();
271
+ colorTexture === null || colorTexture === void 0 ? void 0 : colorTexture.delete();
272
+ updateTimer && clearTimeout(updateTimer);
273
+ }
274
+ }, {
275
+ key: "_getAttributeManager",
276
+ value: function _getAttributeManager() {
277
+ return new _core2.AttributeManager(this.context.gl, {
278
+ id: this.props.id,
279
+ stats: this.context.stats
280
+ });
173
281
  }
282
+ }, {
283
+ key: "_getChangeFlags",
284
+ value: function _getChangeFlags(opts) {
285
+ var changeFlags = {};
286
+ var dimensions = this.state.dimensions;
287
+ changeFlags.dataChanged = this.isAttributeChanged() || this.isAggregationDirty(opts, {
288
+ compareAll: true,
289
+ dimension: dimensions.data
290
+ });
291
+ changeFlags.viewportChanged = opts.changeFlags.viewportChanged;
292
+ var zoom = this.state.zoom;
174
293
 
175
- this.setState({
176
- zoom: opts.context.viewport.zoom
177
- });
178
- }
294
+ if (!opts.context.viewport || opts.context.viewport.zoom !== zoom) {
295
+ changeFlags.viewportZoomChanged = true;
296
+ }
179
297
 
180
- renderLayers() {
181
- if (!this.state.supported) {
182
- return [];
298
+ return changeFlags;
183
299
  }
184
-
185
- const {
186
- weightsTexture,
187
- triPositionBuffer,
188
- triTexCoordBuffer,
189
- maxWeightsTexture,
190
- colorTexture,
191
- colorDomain
192
- } = this.state;
193
- const {
194
- updateTriggers,
195
- intensity,
196
- threshold,
197
- aggregation
198
- } = this.props;
199
- const TriangleLayerClass = this.getSubLayerClass('triangle', _triangleLayer.default);
200
- return new TriangleLayerClass(this.getSubLayerProps({
201
- id: 'triangle-layer',
202
- updateTriggers
203
- }), {
204
- coordinateSystem: _core2.COORDINATE_SYSTEM.DEFAULT,
205
- data: {
206
- attributes: {
207
- positions: triPositionBuffer,
208
- texCoords: triTexCoordBuffer
300
+ }, {
301
+ key: "_createTextures",
302
+ value: function _createTextures() {
303
+ var gl = this.context.gl;
304
+ var _this$state3 = this.state,
305
+ textureSize = _this$state3.textureSize,
306
+ format = _this$state3.format,
307
+ type = _this$state3.type;
308
+ this.setState({
309
+ weightsTexture: new _core.Texture2D(gl, _objectSpread({
310
+ width: textureSize,
311
+ height: textureSize,
312
+ format: format,
313
+ type: type
314
+ }, TEXTURE_OPTIONS)),
315
+ maxWeightsTexture: new _core.Texture2D(gl, _objectSpread({
316
+ format: format,
317
+ type: type
318
+ }, TEXTURE_OPTIONS))
319
+ });
320
+ }
321
+ }, {
322
+ key: "_setupAttributes",
323
+ value: function _setupAttributes() {
324
+ var attributeManager = this.getAttributeManager();
325
+ attributeManager.add({
326
+ positions: {
327
+ size: 3,
328
+ type: 5130,
329
+ accessor: 'getPosition'
330
+ },
331
+ weights: {
332
+ size: 1,
333
+ accessor: 'getWeight'
209
334
  }
210
- },
211
- vertexCount: 4,
212
- maxTexture: maxWeightsTexture,
213
- colorTexture,
214
- aggregationMode: AGGREGATION_MODE[aggregation] || 0,
215
- texture: weightsTexture,
216
- intensity,
217
- threshold,
218
- colorDomain
219
- });
220
- }
221
-
222
- finalizeState() {
223
- super.finalizeState();
224
- const {
225
- weightsTransform,
226
- weightsTexture,
227
- maxWeightTransform,
228
- maxWeightsTexture,
229
- triPositionBuffer,
230
- triTexCoordBuffer,
231
- colorTexture,
232
- updateTimer
233
- } = this.state;
234
- weightsTransform === null || weightsTransform === void 0 ? void 0 : weightsTransform.delete();
235
- weightsTexture === null || weightsTexture === void 0 ? void 0 : weightsTexture.delete();
236
- maxWeightTransform === null || maxWeightTransform === void 0 ? void 0 : maxWeightTransform.delete();
237
- maxWeightsTexture === null || maxWeightsTexture === void 0 ? void 0 : maxWeightsTexture.delete();
238
- triPositionBuffer === null || triPositionBuffer === void 0 ? void 0 : triPositionBuffer.delete();
239
- triTexCoordBuffer === null || triTexCoordBuffer === void 0 ? void 0 : triTexCoordBuffer.delete();
240
- colorTexture === null || colorTexture === void 0 ? void 0 : colorTexture.delete();
241
- updateTimer && clearTimeout(updateTimer);
242
- }
243
-
244
- _getAttributeManager() {
245
- return new _core2.AttributeManager(this.context.gl, {
246
- id: this.props.id,
247
- stats: this.context.stats
248
- });
249
- }
250
-
251
- _getChangeFlags(opts) {
252
- const changeFlags = {};
253
- const {
254
- dimensions
255
- } = this.state;
256
- changeFlags.dataChanged = this.isAttributeChanged() || this.isAggregationDirty(opts, {
257
- compareAll: true,
258
- dimension: dimensions.data
259
- });
260
- changeFlags.viewportChanged = opts.changeFlags.viewportChanged;
261
- const {
262
- zoom
263
- } = this.state;
264
-
265
- if (!opts.context.viewport || opts.context.viewport.zoom !== zoom) {
266
- changeFlags.viewportZoomChanged = true;
335
+ });
336
+ this.setState({
337
+ positionAttributeName: 'positions'
338
+ });
267
339
  }
268
-
269
- return changeFlags;
270
- }
271
-
272
- _createTextures() {
273
- const {
274
- gl
275
- } = this.context;
276
- const {
277
- textureSize,
278
- format,
279
- type
280
- } = this.state;
281
- this.setState({
282
- weightsTexture: new _core.Texture2D(gl, {
283
- width: textureSize,
284
- height: textureSize,
285
- format,
286
- type,
287
- ...TEXTURE_OPTIONS
340
+ }, {
341
+ key: "_setupTextureParams",
342
+ value: function _setupTextureParams() {
343
+ var gl = this.context.gl;
344
+ var weightsTextureSize = this.props.weightsTextureSize;
345
+ var textureSize = Math.min(weightsTextureSize, (0, _core.getParameters)(gl, 3379));
346
+ var floatTargetSupport = (0, _core.hasFeatures)(gl, _core.FEATURES.COLOR_ATTACHMENT_RGBA32F);
347
+
348
+ var _getTextureParams = (0, _heatmapLayerUtils.getTextureParams)({
349
+ gl: gl,
350
+ floatTargetSupport: floatTargetSupport
288
351
  }),
289
- maxWeightsTexture: new _core.Texture2D(gl, {
290
- format,
291
- type,
292
- ...TEXTURE_OPTIONS
293
- })
294
- });
295
- }
352
+ format = _getTextureParams.format,
353
+ type = _getTextureParams.type;
296
354
 
297
- _setupAttributes() {
298
- const attributeManager = this.getAttributeManager();
299
- attributeManager.add({
300
- positions: {
301
- size: 3,
302
- type: 5130,
303
- accessor: 'getPosition'
304
- },
305
- weights: {
306
- size: 1,
307
- accessor: 'getWeight'
308
- }
309
- });
310
- this.setState({
311
- positionAttributeName: 'positions'
312
- });
313
- }
355
+ var weightsScale = floatTargetSupport ? 1 : 1 / 255;
356
+ this.setState({
357
+ textureSize: textureSize,
358
+ format: format,
359
+ type: type,
360
+ weightsScale: weightsScale
361
+ });
314
362
 
315
- _setupTextureParams() {
316
- const {
317
- gl
318
- } = this.context;
319
- const {
320
- weightsTextureSize
321
- } = this.props;
322
- const textureSize = Math.min(weightsTextureSize, (0, _core.getParameters)(gl, 3379));
323
- const floatTargetSupport = (0, _core.hasFeatures)(gl, _core.FEATURES.COLOR_ATTACHMENT_RGBA32F);
324
- const {
325
- format,
326
- type
327
- } = (0, _heatmapLayerUtils.getTextureParams)({
328
- gl,
329
- floatTargetSupport
330
- });
331
- const weightsScale = floatTargetSupport ? 1 : 1 / 255;
332
- this.setState({
333
- textureSize,
334
- format,
335
- type,
336
- weightsScale
337
- });
338
-
339
- if (!floatTargetSupport) {
340
- _core2.log.warn("HeatmapLayer: ".concat(this.id, " rendering to float texture not supported, fallingback to low precession format"))();
363
+ if (!floatTargetSupport) {
364
+ _core2.log.warn("HeatmapLayer: ".concat(this.id, " rendering to float texture not supported, fallingback to low precession format"))();
365
+ }
341
366
  }
342
- }
343
-
344
- getShaders(type) {
345
- return super.getShaders(type === 'max-weights-transform' ? {
346
- vs: _maxVs.default,
347
- _fs: _maxFs.default
348
- } : {
349
- vs: _weightsVs.default,
350
- _fs: _weightsFs.default
351
- });
352
- }
353
-
354
- _createWeightsTransform(shaders = {}) {
355
- var _weightsTransform;
356
-
357
- const {
358
- gl
359
- } = this.context;
360
- let {
361
- weightsTransform
362
- } = this.state;
363
- const {
364
- weightsTexture
365
- } = this.state;
366
- (_weightsTransform = weightsTransform) === null || _weightsTransform === void 0 ? void 0 : _weightsTransform.delete();
367
- weightsTransform = new _core.Transform(gl, {
368
- id: "".concat(this.id, "-weights-transform"),
369
- elementCount: 1,
370
- _targetTexture: weightsTexture,
371
- _targetTextureVarying: 'weightsTexture',
372
- ...shaders
373
- });
374
- this.setState({
375
- weightsTransform
376
- });
377
- }
378
-
379
- _setupResources() {
380
- const {
381
- gl
382
- } = this.context;
383
-
384
- this._createTextures();
385
-
386
- const {
387
- textureSize,
388
- weightsTexture,
389
- maxWeightsTexture
390
- } = this.state;
391
- const weightsTransformShaders = this.getShaders('weights-transform');
392
-
393
- this._createWeightsTransform(weightsTransformShaders);
394
-
395
- const maxWeightsTransformShaders = this.getShaders('max-weights-transform');
396
- const maxWeightTransform = new _core.Transform(gl, {
397
- id: "".concat(this.id, "-max-weights-transform"),
398
- _sourceTextures: {
399
- inTexture: weightsTexture
400
- },
401
- _targetTexture: maxWeightsTexture,
402
- _targetTextureVarying: 'outTexture',
403
- ...maxWeightsTransformShaders,
404
- elementCount: textureSize * textureSize
405
- });
406
- this.setState({
407
- weightsTexture,
408
- maxWeightsTexture,
409
- maxWeightTransform,
410
- zoom: null,
411
- triPositionBuffer: new _core.Buffer(gl, {
412
- byteLength: 48,
413
- accessor: {
414
- size: 3
367
+ }, {
368
+ key: "getShaders",
369
+ value: function getShaders(type) {
370
+ return (0, _get2.default)((0, _getPrototypeOf2.default)(HeatmapLayer.prototype), "getShaders", this).call(this, type === 'max-weights-transform' ? {
371
+ vs: _maxVs.default,
372
+ _fs: _maxFs.default
373
+ } : {
374
+ vs: _weightsVs.default,
375
+ _fs: _weightsFs.default
376
+ });
377
+ }
378
+ }, {
379
+ key: "_createWeightsTransform",
380
+ value: function _createWeightsTransform() {
381
+ var _weightsTransform;
382
+
383
+ var shaders = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
384
+ var gl = this.context.gl;
385
+ var weightsTransform = this.state.weightsTransform;
386
+ var weightsTexture = this.state.weightsTexture;
387
+ (_weightsTransform = weightsTransform) === null || _weightsTransform === void 0 ? void 0 : _weightsTransform.delete();
388
+ weightsTransform = new _core.Transform(gl, _objectSpread({
389
+ id: "".concat(this.id, "-weights-transform"),
390
+ elementCount: 1,
391
+ _targetTexture: weightsTexture,
392
+ _targetTextureVarying: 'weightsTexture'
393
+ }, shaders));
394
+ this.setState({
395
+ weightsTransform: weightsTransform
396
+ });
397
+ }
398
+ }, {
399
+ key: "_setupResources",
400
+ value: function _setupResources() {
401
+ var gl = this.context.gl;
402
+
403
+ this._createTextures();
404
+
405
+ var _this$state4 = this.state,
406
+ textureSize = _this$state4.textureSize,
407
+ weightsTexture = _this$state4.weightsTexture,
408
+ maxWeightsTexture = _this$state4.maxWeightsTexture;
409
+ var weightsTransformShaders = this.getShaders('weights-transform');
410
+
411
+ this._createWeightsTransform(weightsTransformShaders);
412
+
413
+ var maxWeightsTransformShaders = this.getShaders('max-weights-transform');
414
+ var maxWeightTransform = new _core.Transform(gl, _objectSpread(_objectSpread({
415
+ id: "".concat(this.id, "-max-weights-transform"),
416
+ _sourceTextures: {
417
+ inTexture: weightsTexture
418
+ },
419
+ _targetTexture: maxWeightsTexture,
420
+ _targetTextureVarying: 'outTexture'
421
+ }, maxWeightsTransformShaders), {}, {
422
+ elementCount: textureSize * textureSize
423
+ }));
424
+ this.setState({
425
+ weightsTexture: weightsTexture,
426
+ maxWeightsTexture: maxWeightsTexture,
427
+ maxWeightTransform: maxWeightTransform,
428
+ zoom: null,
429
+ triPositionBuffer: new _core.Buffer(gl, {
430
+ byteLength: 48,
431
+ accessor: {
432
+ size: 3
433
+ }
434
+ }),
435
+ triTexCoordBuffer: new _core.Buffer(gl, {
436
+ byteLength: 48,
437
+ accessor: {
438
+ size: 2
439
+ }
440
+ })
441
+ });
442
+ }
443
+ }, {
444
+ key: "updateShaders",
445
+ value: function updateShaders(shaderOptions) {
446
+ this._createWeightsTransform(shaderOptions);
447
+ }
448
+ }, {
449
+ key: "_updateMaxWeightValue",
450
+ value: function _updateMaxWeightValue() {
451
+ var maxWeightTransform = this.state.maxWeightTransform;
452
+ maxWeightTransform.run({
453
+ parameters: {
454
+ blend: true,
455
+ depthTest: false,
456
+ blendFunc: [1, 1],
457
+ blendEquation: 32776
415
458
  }
416
- }),
417
- triTexCoordBuffer: new _core.Buffer(gl, {
418
- byteLength: 48,
419
- accessor: {
420
- size: 2
459
+ });
460
+ }
461
+ }, {
462
+ key: "_updateBounds",
463
+ value: function _updateBounds() {
464
+ var forceUpdate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
465
+ var viewport = this.context.viewport;
466
+ var viewportCorners = [viewport.unproject([0, 0]), viewport.unproject([viewport.width, 0]), viewport.unproject([viewport.width, viewport.height]), viewport.unproject([0, viewport.height])].map(function (p) {
467
+ return p.map(Math.fround);
468
+ });
469
+ var visibleWorldBounds = (0, _heatmapLayerUtils.getBounds)(viewportCorners);
470
+ var newState = {
471
+ visibleWorldBounds: visibleWorldBounds,
472
+ viewportCorners: viewportCorners
473
+ };
474
+ var boundsChanged = false;
475
+
476
+ if (forceUpdate || !this.state.worldBounds || !(0, _heatmapLayerUtils.boundsContain)(this.state.worldBounds, visibleWorldBounds)) {
477
+ var scaledCommonBounds = this._worldToCommonBounds(visibleWorldBounds);
478
+
479
+ var worldBounds = this._commonToWorldBounds(scaledCommonBounds);
480
+
481
+ if (this.props.coordinateSystem === _core2.COORDINATE_SYSTEM.LNGLAT) {
482
+ worldBounds[1] = Math.max(worldBounds[1], -85.051129);
483
+ worldBounds[3] = Math.min(worldBounds[3], 85.051129);
484
+ worldBounds[0] = Math.max(worldBounds[0], -360);
485
+ worldBounds[2] = Math.min(worldBounds[2], 360);
421
486
  }
422
- })
423
- });
424
- }
425
487
 
426
- updateShaders(shaderOptions) {
427
- this._createWeightsTransform(shaderOptions);
428
- }
488
+ var normalizedCommonBounds = this._worldToCommonBounds(worldBounds);
429
489
 
430
- _updateMaxWeightValue() {
431
- const {
432
- maxWeightTransform
433
- } = this.state;
434
- maxWeightTransform.run({
435
- parameters: {
436
- blend: true,
437
- depthTest: false,
438
- blendFunc: [1, 1],
439
- blendEquation: 32776
490
+ newState.worldBounds = worldBounds;
491
+ newState.normalizedCommonBounds = normalizedCommonBounds;
492
+ boundsChanged = true;
440
493
  }
441
- });
442
- }
443
494
 
444
- _updateBounds(forceUpdate = false) {
445
- const {
446
- viewport
447
- } = this.context;
448
- const viewportCorners = [viewport.unproject([0, 0]), viewport.unproject([viewport.width, 0]), viewport.unproject([viewport.width, viewport.height]), viewport.unproject([0, viewport.height])].map(p => p.map(Math.fround));
449
- const visibleWorldBounds = (0, _heatmapLayerUtils.getBounds)(viewportCorners);
450
- const newState = {
451
- visibleWorldBounds,
452
- viewportCorners
453
- };
454
- let boundsChanged = false;
455
-
456
- if (forceUpdate || !this.state.worldBounds || !(0, _heatmapLayerUtils.boundsContain)(this.state.worldBounds, visibleWorldBounds)) {
457
- const scaledCommonBounds = this._worldToCommonBounds(visibleWorldBounds);
458
-
459
- const worldBounds = this._commonToWorldBounds(scaledCommonBounds);
460
-
461
- if (this.props.coordinateSystem === _core2.COORDINATE_SYSTEM.LNGLAT) {
462
- worldBounds[1] = Math.max(worldBounds[1], -85.051129);
463
- worldBounds[3] = Math.min(worldBounds[3], 85.051129);
464
- worldBounds[0] = Math.max(worldBounds[0], -360);
465
- worldBounds[2] = Math.min(worldBounds[2], 360);
495
+ this.setState(newState);
496
+ return boundsChanged;
497
+ }
498
+ }, {
499
+ key: "_updateTextureRenderingBounds",
500
+ value: function _updateTextureRenderingBounds() {
501
+ var _this$state5 = this.state,
502
+ triPositionBuffer = _this$state5.triPositionBuffer,
503
+ triTexCoordBuffer = _this$state5.triTexCoordBuffer,
504
+ normalizedCommonBounds = _this$state5.normalizedCommonBounds,
505
+ viewportCorners = _this$state5.viewportCorners;
506
+ var viewport = this.context.viewport;
507
+ triPositionBuffer.subData((0, _heatmapLayerUtils.packVertices)(viewportCorners, 3));
508
+ var textureBounds = viewportCorners.map(function (p) {
509
+ return (0, _heatmapLayerUtils.getTextureCoordinates)(viewport.projectPosition(p), normalizedCommonBounds);
510
+ });
511
+ triTexCoordBuffer.subData((0, _heatmapLayerUtils.packVertices)(textureBounds, 2));
512
+ }
513
+ }, {
514
+ key: "_updateColorTexture",
515
+ value: function _updateColorTexture(opts) {
516
+ var colorRange = opts.props.colorRange;
517
+ var colorTexture = this.state.colorTexture;
518
+ var colors = (0, _colorUtils.colorRangeToFlatArray)(colorRange, false, Uint8Array);
519
+
520
+ if (colorTexture) {
521
+ colorTexture.setImageData({
522
+ data: colors,
523
+ width: colorRange.length
524
+ });
525
+ } else {
526
+ colorTexture = new _core.Texture2D(this.context.gl, _objectSpread({
527
+ data: colors,
528
+ width: colorRange.length,
529
+ height: 1
530
+ }, TEXTURE_OPTIONS));
466
531
  }
467
532
 
468
- const normalizedCommonBounds = this._worldToCommonBounds(worldBounds);
469
-
470
- newState.worldBounds = worldBounds;
471
- newState.normalizedCommonBounds = normalizedCommonBounds;
472
- boundsChanged = true;
533
+ this.setState({
534
+ colorTexture: colorTexture
535
+ });
473
536
  }
537
+ }, {
538
+ key: "_updateWeightmap",
539
+ value: function _updateWeightmap() {
540
+ var _weightsTexture$setPa;
541
+
542
+ var _this$props2 = this.props,
543
+ radiusPixels = _this$props2.radiusPixels,
544
+ colorDomain = _this$props2.colorDomain,
545
+ aggregation = _this$props2.aggregation;
546
+ var _this$state6 = this.state,
547
+ weightsTransform = _this$state6.weightsTransform,
548
+ worldBounds = _this$state6.worldBounds,
549
+ textureSize = _this$state6.textureSize,
550
+ weightsTexture = _this$state6.weightsTexture,
551
+ weightsScale = _this$state6.weightsScale;
552
+ this.state.isWeightMapDirty = false;
553
+
554
+ var commonBounds = this._worldToCommonBounds(worldBounds, {
555
+ useLayerCoordinateSystem: true
556
+ });
474
557
 
475
- this.setState(newState);
476
- return boundsChanged;
477
- }
478
-
479
- _updateTextureRenderingBounds() {
480
- const {
481
- triPositionBuffer,
482
- triTexCoordBuffer,
483
- normalizedCommonBounds,
484
- viewportCorners
485
- } = this.state;
486
- const {
487
- viewport
488
- } = this.context;
489
- triPositionBuffer.subData((0, _heatmapLayerUtils.packVertices)(viewportCorners, 3));
490
- const textureBounds = viewportCorners.map(p => (0, _heatmapLayerUtils.getTextureCoordinates)(viewport.projectPosition(p), normalizedCommonBounds));
491
- triTexCoordBuffer.subData((0, _heatmapLayerUtils.packVertices)(textureBounds, 2));
492
- }
558
+ if (colorDomain && aggregation === 'SUM') {
559
+ var viewport = this.context.viewport;
560
+ var metersPerPixel = viewport.distanceScales.metersPerUnit[2] * (commonBounds[2] - commonBounds[0]) / textureSize;
561
+ this.state.colorDomain = colorDomain.map(function (x) {
562
+ return x * metersPerPixel * weightsScale;
563
+ });
564
+ } else {
565
+ this.state.colorDomain = colorDomain || DEFAULT_COLOR_DOMAIN;
566
+ }
493
567
 
494
- _updateColorTexture(opts) {
495
- const {
496
- colorRange
497
- } = opts.props;
498
- let {
499
- colorTexture
500
- } = this.state;
501
- const colors = (0, _colorUtils.colorRangeToFlatArray)(colorRange, false, Uint8Array);
502
-
503
- if (colorTexture) {
504
- colorTexture.setImageData({
505
- data: colors,
506
- width: colorRange.length
568
+ var uniforms = {
569
+ radiusPixels: radiusPixels,
570
+ commonBounds: commonBounds,
571
+ textureWidth: textureSize,
572
+ weightsScale: weightsScale
573
+ };
574
+ weightsTransform.update({
575
+ elementCount: this.getNumInstances()
507
576
  });
508
- } else {
509
- colorTexture = new _core.Texture2D(this.context.gl, {
510
- data: colors,
511
- width: colorRange.length,
512
- height: 1,
513
- ...TEXTURE_OPTIONS
577
+ weightsTransform.run({
578
+ uniforms: uniforms,
579
+ parameters: {
580
+ blend: true,
581
+ depthTest: false,
582
+ blendFunc: [1, 1],
583
+ blendEquation: 32774
584
+ },
585
+ clearRenderTarget: true,
586
+ attributes: this.getAttributes(),
587
+ moduleSettings: this.getModuleSettings()
514
588
  });
515
- }
516
589
 
517
- this.setState({
518
- colorTexture
519
- });
520
- }
590
+ this._updateMaxWeightValue();
521
591
 
522
- _updateWeightmap() {
523
- const {
524
- radiusPixels,
525
- colorDomain,
526
- aggregation
527
- } = this.props;
528
- const {
529
- weightsTransform,
530
- worldBounds,
531
- textureSize,
532
- weightsTexture,
533
- weightsScale
534
- } = this.state;
535
- this.state.isWeightMapDirty = false;
536
-
537
- const commonBounds = this._worldToCommonBounds(worldBounds, {
538
- useLayerCoordinateSystem: true
539
- });
540
-
541
- if (colorDomain && aggregation === 'SUM') {
542
- const {
543
- viewport
544
- } = this.context;
545
- const metersPerPixel = viewport.distanceScales.metersPerUnit[2] * (commonBounds[2] - commonBounds[0]) / textureSize;
546
- this.state.colorDomain = colorDomain.map(x => x * metersPerPixel * weightsScale);
547
- } else {
548
- this.state.colorDomain = colorDomain || DEFAULT_COLOR_DOMAIN;
592
+ weightsTexture.setParameters((_weightsTexture$setPa = {}, (0, _defineProperty2.default)(_weightsTexture$setPa, 10240, 9729), (0, _defineProperty2.default)(_weightsTexture$setPa, 10241, 9729), _weightsTexture$setPa));
549
593
  }
550
-
551
- const uniforms = {
552
- radiusPixels,
553
- commonBounds,
554
- textureWidth: textureSize,
555
- weightsScale
556
- };
557
- weightsTransform.update({
558
- elementCount: this.getNumInstances()
559
- });
560
- weightsTransform.run({
561
- uniforms,
562
- parameters: {
563
- blend: true,
564
- depthTest: false,
565
- blendFunc: [1, 1],
566
- blendEquation: 32774
567
- },
568
- clearRenderTarget: true,
569
- attributes: this.getAttributes(),
570
- moduleSettings: this.getModuleSettings()
571
- });
572
-
573
- this._updateMaxWeightValue();
574
-
575
- weightsTexture.setParameters({
576
- [10240]: 9729,
577
- [10241]: 9729
578
- });
579
- }
580
-
581
- _debouncedUpdateWeightmap(fromTimer = false) {
582
- let {
583
- updateTimer
584
- } = this.state;
585
- const {
586
- debounceTimeout
587
- } = this.props;
588
-
589
- if (fromTimer) {
590
- updateTimer = null;
591
-
592
- this._updateBounds(true);
593
-
594
- this._updateTextureRenderingBounds();
594
+ }, {
595
+ key: "_debouncedUpdateWeightmap",
596
+ value: function _debouncedUpdateWeightmap() {
597
+ var fromTimer = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
598
+ var updateTimer = this.state.updateTimer;
599
+ var debounceTimeout = this.props.debounceTimeout;
600
+
601
+ if (fromTimer) {
602
+ updateTimer = null;
603
+
604
+ this._updateBounds(true);
605
+
606
+ this._updateTextureRenderingBounds();
607
+
608
+ this.setState({
609
+ isWeightMapDirty: true
610
+ });
611
+ } else {
612
+ this.setState({
613
+ isWeightMapDirty: false
614
+ });
615
+ clearTimeout(updateTimer);
616
+ updateTimer = setTimeout(this._debouncedUpdateWeightmap.bind(this, true), debounceTimeout);
617
+ }
595
618
 
596
619
  this.setState({
597
- isWeightMapDirty: true
620
+ updateTimer: updateTimer
598
621
  });
599
- } else {
600
- this.setState({
601
- isWeightMapDirty: false
602
- });
603
- clearTimeout(updateTimer);
604
- updateTimer = setTimeout(this._debouncedUpdateWeightmap.bind(this, true), debounceTimeout);
605
622
  }
623
+ }, {
624
+ key: "_worldToCommonBounds",
625
+ value: function _worldToCommonBounds(worldBounds) {
626
+ var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
627
+ var _opts$useLayerCoordin = opts.useLayerCoordinateSystem,
628
+ useLayerCoordinateSystem = _opts$useLayerCoordin === void 0 ? false : _opts$useLayerCoordin;
629
+
630
+ var _worldBounds = (0, _slicedToArray2.default)(worldBounds, 4),
631
+ minLong = _worldBounds[0],
632
+ minLat = _worldBounds[1],
633
+ maxLong = _worldBounds[2],
634
+ maxLat = _worldBounds[3];
635
+
636
+ var viewport = this.context.viewport;
637
+ var textureSize = this.state.textureSize;
638
+ var coordinateSystem = this.props.coordinateSystem;
639
+ var offsetMode = useLayerCoordinateSystem && (coordinateSystem === _core2.COORDINATE_SYSTEM.LNGLAT_OFFSETS || coordinateSystem === _core2.COORDINATE_SYSTEM.METER_OFFSETS);
640
+ var offsetOriginCommon = offsetMode ? viewport.projectPosition(this.props.coordinateOrigin) : [0, 0];
641
+ var size = textureSize * RESOLUTION / viewport.scale;
642
+ var bottomLeftCommon;
643
+ var topRightCommon;
644
+
645
+ if (useLayerCoordinateSystem && !offsetMode) {
646
+ bottomLeftCommon = this.projectPosition([minLong, minLat, 0]);
647
+ topRightCommon = this.projectPosition([maxLong, maxLat, 0]);
648
+ } else {
649
+ bottomLeftCommon = viewport.projectPosition([minLong, minLat, 0]);
650
+ topRightCommon = viewport.projectPosition([maxLong, maxLat, 0]);
651
+ }
606
652
 
607
- this.setState({
608
- updateTimer
609
- });
610
- }
611
-
612
- _worldToCommonBounds(worldBounds, opts = {}) {
613
- const {
614
- useLayerCoordinateSystem = false
615
- } = opts;
616
- const [minLong, minLat, maxLong, maxLat] = worldBounds;
617
- const {
618
- viewport
619
- } = this.context;
620
- const {
621
- textureSize
622
- } = this.state;
623
- const {
624
- coordinateSystem
625
- } = this.props;
626
- const offsetMode = useLayerCoordinateSystem && (coordinateSystem === _core2.COORDINATE_SYSTEM.LNGLAT_OFFSETS || coordinateSystem === _core2.COORDINATE_SYSTEM.METER_OFFSETS);
627
- const offsetOriginCommon = offsetMode ? viewport.projectPosition(this.props.coordinateOrigin) : [0, 0];
628
- const size = textureSize * RESOLUTION / viewport.scale;
629
- let bottomLeftCommon;
630
- let topRightCommon;
631
-
632
- if (useLayerCoordinateSystem && !offsetMode) {
633
- bottomLeftCommon = this.projectPosition([minLong, minLat, 0]);
634
- topRightCommon = this.projectPosition([maxLong, maxLat, 0]);
635
- } else {
636
- bottomLeftCommon = viewport.projectPosition([minLong, minLat, 0]);
637
- topRightCommon = viewport.projectPosition([maxLong, maxLat, 0]);
653
+ return (0, _heatmapLayerUtils.scaleToAspectRatio)([bottomLeftCommon[0] - offsetOriginCommon[0], bottomLeftCommon[1] - offsetOriginCommon[1], topRightCommon[0] - offsetOriginCommon[0], topRightCommon[1] - offsetOriginCommon[1]], size, size);
638
654
  }
639
-
640
- return (0, _heatmapLayerUtils.scaleToAspectRatio)([bottomLeftCommon[0] - offsetOriginCommon[0], bottomLeftCommon[1] - offsetOriginCommon[1], topRightCommon[0] - offsetOriginCommon[0], topRightCommon[1] - offsetOriginCommon[1]], size, size);
641
- }
642
-
643
- _commonToWorldBounds(commonBounds) {
644
- const [xMin, yMin, xMax, yMax] = commonBounds;
645
- const {
646
- viewport
647
- } = this.context;
648
- const bottomLeftWorld = viewport.unprojectPosition([xMin, yMin]);
649
- const topRightWorld = viewport.unprojectPosition([xMax, yMax]);
650
- return bottomLeftWorld.slice(0, 2).concat(topRightWorld.slice(0, 2));
651
- }
652
-
653
- }
655
+ }, {
656
+ key: "_commonToWorldBounds",
657
+ value: function _commonToWorldBounds(commonBounds) {
658
+ var _commonBounds = (0, _slicedToArray2.default)(commonBounds, 4),
659
+ xMin = _commonBounds[0],
660
+ yMin = _commonBounds[1],
661
+ xMax = _commonBounds[2],
662
+ yMax = _commonBounds[3];
663
+
664
+ var viewport = this.context.viewport;
665
+ var bottomLeftWorld = viewport.unprojectPosition([xMin, yMin]);
666
+ var topRightWorld = viewport.unprojectPosition([xMax, yMax]);
667
+ return bottomLeftWorld.slice(0, 2).concat(topRightWorld.slice(0, 2));
668
+ }
669
+ }]);
670
+ return HeatmapLayer;
671
+ }(_aggregationLayer.default);
654
672
 
655
673
  exports.default = HeatmapLayer;
656
674
  HeatmapLayer.layerName = 'HeatmapLayer';