@deck.gl/extensions 8.6.4 → 8.6.8

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 (40) hide show
  1. package/dist/dist.dev.js +11 -12
  2. package/dist/es5/brushing/brushing.js +80 -49
  3. package/dist/es5/brushing/brushing.js.map +1 -1
  4. package/dist/es5/brushing/shader-module.js +16 -15
  5. package/dist/es5/brushing/shader-module.js.map +1 -1
  6. package/dist/es5/clip/clip.js +62 -35
  7. package/dist/es5/clip/clip.js.map +1 -1
  8. package/dist/es5/data-filter/aggregator.js +20 -15
  9. package/dist/es5/data-filter/aggregator.js.map +1 -1
  10. package/dist/es5/data-filter/data-filter.js +177 -147
  11. package/dist/es5/data-filter/data-filter.js.map +1 -1
  12. package/dist/es5/data-filter/shader-module.js +58 -37
  13. package/dist/es5/data-filter/shader-module.js.map +1 -1
  14. package/dist/es5/fill-style/fill-style.js +244 -158
  15. package/dist/es5/fill-style/fill-style.js.map +1 -1
  16. package/dist/es5/fill-style/shaders.glsl.js +18 -19
  17. package/dist/es5/fill-style/shaders.glsl.js.map +1 -1
  18. package/dist/es5/fp64/fp64.js +36 -12
  19. package/dist/es5/fp64/fp64.js.map +1 -1
  20. package/dist/es5/fp64/project64.js +18 -20
  21. package/dist/es5/fp64/project64.js.map +1 -1
  22. package/dist/es5/index.js +17 -17
  23. package/dist/es5/path-style/path-style.js +121 -89
  24. package/dist/es5/path-style/path-style.js.map +1 -1
  25. package/dist/es5/path-style/shaders.glsl.js +2 -2
  26. package/dist/es5/path-style/shaders.glsl.js.map +1 -1
  27. package/dist/esm/clip/clip.js +4 -3
  28. package/dist/esm/clip/clip.js.map +1 -1
  29. package/dist/esm/data-filter/data-filter.js +17 -12
  30. package/dist/esm/data-filter/data-filter.js.map +1 -1
  31. package/dist/esm/fill-style/fill-style.js +20 -15
  32. package/dist/esm/fill-style/fill-style.js.map +1 -1
  33. package/dist/esm/fill-style/shaders.glsl.js +4 -1
  34. package/dist/esm/fill-style/shaders.glsl.js.map +1 -1
  35. package/dist/esm/fp64/project64.js +8 -5
  36. package/dist/esm/fp64/project64.js.map +1 -1
  37. package/dist/esm/path-style/path-style.js +6 -5
  38. package/dist/esm/path-style/path-style.js.map +1 -1
  39. package/dist.min.js +1 -1
  40. package/package.json +2 -2
package/dist/dist.dev.js CHANGED
@@ -6295,7 +6295,7 @@ class MathArray extends _extendableBuiltin(Array) {
6295
6295
  string += (i > 0 ? ', ' : '') + Object(_lib_common__WEBPACK_IMPORTED_MODULE_0__["formatValue"])(this[i], opts);
6296
6296
  }
6297
6297
 
6298
- return `${opts.printTypes ? this.constructor.name : ''}[${string}]`;
6298
+ return "".concat(opts.printTypes ? this.constructor.name : '', "[").concat(string, "]");
6299
6299
  }
6300
6300
 
6301
6301
  equals(array) {
@@ -6459,7 +6459,7 @@ class MathArray extends _extendableBuiltin(Array) {
6459
6459
 
6460
6460
  check() {
6461
6461
  if (_lib_common__WEBPACK_IMPORTED_MODULE_0__["config"].debug && !this.validate()) {
6462
- throw new Error(`math.gl: ${this.constructor.name} some fields set to invalid numbers'`);
6462
+ throw new Error("math.gl: ".concat(this.constructor.name, " some fields set to invalid numbers'"));
6463
6463
  }
6464
6464
 
6465
6465
  return this;
@@ -6517,14 +6517,14 @@ class Matrix extends _math_array__WEBPACK_IMPORTED_MODULE_0__["default"] {
6517
6517
 
6518
6518
  for (let row = 0; row < this.RANK; ++row) {
6519
6519
  for (let col = 0; col < this.RANK; ++col) {
6520
- string += ` ${this[col * this.RANK + row]}`;
6520
+ string += " ".concat(this[col * this.RANK + row]);
6521
6521
  }
6522
6522
  }
6523
6523
  } else {
6524
6524
  string += 'column-major:';
6525
6525
 
6526
6526
  for (let i = 0; i < this.ELEMENTS; ++i) {
6527
- string += ` ${this[i]}`;
6527
+ string += " ".concat(this[i]);
6528
6528
  }
6529
6529
  }
6530
6530
 
@@ -7019,7 +7019,7 @@ class Euler extends _base_math_array__WEBPACK_IMPORTED_MODULE_0__["default"] {
7019
7019
  getQuaternion() {
7020
7020
  const q = new _quaternion__WEBPACK_IMPORTED_MODULE_3__["default"]();
7021
7021
 
7022
- switch (this[4]) {
7022
+ switch (this[3]) {
7023
7023
  case Euler.XYZ:
7024
7024
  return q.rotateX(this[0]).rotateY(this[1]).rotateZ(this[2]);
7025
7025
 
@@ -8412,8 +8412,7 @@ class SphericalCoordinates {
8412
8412
  printTypes = false
8413
8413
  }) {
8414
8414
  const f = _lib_common__WEBPACK_IMPORTED_MODULE_0__["formatValue"];
8415
- return `${printTypes ? 'Spherical' : ''}\
8416
- [rho:${f(this.radius)},theta:${f(this.theta)},phi:${f(this.phi)}]`;
8415
+ return "".concat(printTypes ? 'Spherical' : '', "[rho:").concat(f(this.radius), ",theta:").concat(f(this.theta), ",phi:").concat(f(this.phi), "]");
8417
8416
  }
8418
8417
 
8419
8418
  equals(other) {
@@ -9060,7 +9059,7 @@ __webpack_require__.r(__webpack_exports__);
9060
9059
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return assert; });
9061
9060
  function assert(condition, message) {
9062
9061
  if (!condition) {
9063
- throw new Error(`math.gl assertion ${message}`);
9062
+ throw new Error("math.gl assertion ".concat(message));
9064
9063
  }
9065
9064
  }
9066
9065
  //# sourceMappingURL=assert.js.map
@@ -9125,7 +9124,7 @@ function formatValue(value, {
9125
9124
  precision = config.precision || 4
9126
9125
  } = {}) {
9127
9126
  value = round(value);
9128
- return `${parseFloat(value.toPrecision(precision))}`;
9127
+ return "".concat(parseFloat(value.toPrecision(precision)));
9129
9128
  }
9130
9129
  function isArray(value) {
9131
9130
  return Array.isArray(value) || ArrayBuffer.isView(value) && !(value instanceof DataView);
@@ -9416,14 +9415,14 @@ function validateVector(v, length) {
9416
9415
  }
9417
9416
  function checkNumber(value) {
9418
9417
  if (!Number.isFinite(value)) {
9419
- throw new Error(`Invalid number ${value}`);
9418
+ throw new Error("Invalid number ".concat(value));
9420
9419
  }
9421
9420
 
9422
9421
  return value;
9423
9422
  }
9424
9423
  function checkVector(v, length, callerName = '') {
9425
9424
  if (_common__WEBPACK_IMPORTED_MODULE_0__["config"].debug && !validateVector(v, length)) {
9426
- throw new Error(`math.gl: ${callerName} some fields set to invalid numbers'`);
9425
+ throw new Error("math.gl: ".concat(callerName, " some fields set to invalid numbers'"));
9427
9426
  }
9428
9427
 
9429
9428
  return v;
@@ -9432,7 +9431,7 @@ const map = {};
9432
9431
  function deprecated(method, version) {
9433
9432
  if (!map[method]) {
9434
9433
  map[method] = true;
9435
- console.warn(`${method} has been removed in version ${version}, see upgrade guide for more information`);
9434
+ console.warn("".concat(method, " has been removed in version ").concat(version, ", see upgrade guide for more information"));
9436
9435
  }
9437
9436
  }
9438
9437
  //# sourceMappingURL=validators.js.map
@@ -7,11 +7,25 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports.default = void 0;
9
9
 
10
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
+
12
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
+
14
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
15
+
16
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
17
+
18
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
19
+
10
20
  var _core = require("@deck.gl/core");
11
21
 
12
22
  var _shaderModule = _interopRequireDefault(require("./shader-module"));
13
23
 
14
- const defaultProps = {
24
+ 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); }; }
25
+
26
+ 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; } }
27
+
28
+ var defaultProps = {
15
29
  getBrushingTarget: {
16
30
  type: 'accessor',
17
31
  value: [0, 0]
@@ -21,62 +35,79 @@ const defaultProps = {
21
35
  brushingRadius: 10000
22
36
  };
23
37
 
24
- class BrushingExtension extends _core.LayerExtension {
25
- getShaders(extension) {
26
- return {
27
- modules: [_shaderModule.default]
28
- };
38
+ var BrushingExtension = function (_LayerExtension) {
39
+ (0, _inherits2.default)(BrushingExtension, _LayerExtension);
40
+
41
+ var _super = _createSuper(BrushingExtension);
42
+
43
+ function BrushingExtension() {
44
+ (0, _classCallCheck2.default)(this, BrushingExtension);
45
+ return _super.apply(this, arguments);
29
46
  }
30
47
 
31
- initializeState(context, extension) {
32
- const attributeManager = this.getAttributeManager();
33
-
34
- if (attributeManager) {
35
- attributeManager.add({
36
- brushingTargets: {
37
- size: 2,
38
- accessor: 'getBrushingTarget',
39
- update: !this.props.getBrushingTarget && extension.useConstantTargetPositions,
40
- shaderAttributes: {
41
- brushingTargets: {
42
- divisor: 0
43
- },
44
- instanceBrushingTargets: {
45
- divisor: 1
48
+ (0, _createClass2.default)(BrushingExtension, [{
49
+ key: "getShaders",
50
+ value: function getShaders(extension) {
51
+ return {
52
+ modules: [_shaderModule.default]
53
+ };
54
+ }
55
+ }, {
56
+ key: "initializeState",
57
+ value: function initializeState(context, extension) {
58
+ var _this = this;
59
+
60
+ var attributeManager = this.getAttributeManager();
61
+
62
+ if (attributeManager) {
63
+ attributeManager.add({
64
+ brushingTargets: {
65
+ size: 2,
66
+ accessor: 'getBrushingTarget',
67
+ update: !this.props.getBrushingTarget && extension.useConstantTargetPositions,
68
+ shaderAttributes: {
69
+ brushingTargets: {
70
+ divisor: 0
71
+ },
72
+ instanceBrushingTargets: {
73
+ divisor: 1
74
+ }
46
75
  }
47
76
  }
48
- }
49
- });
50
- }
77
+ });
78
+ }
51
79
 
52
- extension.onMouseMove = () => {
53
- this.getCurrentLayer().setNeedsRedraw();
54
- };
80
+ extension.onMouseMove = function () {
81
+ _this.getCurrentLayer().setNeedsRedraw();
82
+ };
55
83
 
56
- if (this.context.deck) {
57
- this.context.deck.eventManager.on({
58
- pointermove: extension.onMouseMove,
59
- pointerleave: extension.onMouseMove
60
- });
84
+ if (this.context.deck) {
85
+ this.context.deck.eventManager.on({
86
+ pointermove: extension.onMouseMove,
87
+ pointerleave: extension.onMouseMove
88
+ });
89
+ }
61
90
  }
62
- }
63
-
64
- finalizeState(extension) {
65
- if (this.context.deck) {
66
- this.context.deck.eventManager.off({
67
- pointermove: extension.onMouseMove,
68
- pointerleave: extension.onMouseMove
69
- });
91
+ }, {
92
+ key: "finalizeState",
93
+ value: function finalizeState(extension) {
94
+ if (this.context.deck) {
95
+ this.context.deck.eventManager.off({
96
+ pointermove: extension.onMouseMove,
97
+ pointerleave: extension.onMouseMove
98
+ });
99
+ }
70
100
  }
71
- }
72
-
73
- useConstantTargetPositions(attribute) {
74
- attribute.constant = true;
75
- attribute.value = new Float32Array(2);
76
- return;
77
- }
78
-
79
- }
101
+ }, {
102
+ key: "useConstantTargetPositions",
103
+ value: function useConstantTargetPositions(attribute) {
104
+ attribute.constant = true;
105
+ attribute.value = new Float32Array(2);
106
+ return;
107
+ }
108
+ }]);
109
+ return BrushingExtension;
110
+ }(_core.LayerExtension);
80
111
 
81
112
  exports.default = BrushingExtension;
82
113
  BrushingExtension.extensionName = 'BrushingExtension';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/brushing/brushing.js"],"names":["defaultProps","getBrushingTarget","type","value","brushingTarget","brushingEnabled","brushingRadius","BrushingExtension","LayerExtension","getShaders","extension","modules","shaderModule","initializeState","context","attributeManager","getAttributeManager","add","brushingTargets","size","accessor","update","props","useConstantTargetPositions","shaderAttributes","divisor","instanceBrushingTargets","onMouseMove","getCurrentLayer","setNeedsRedraw","deck","eventManager","on","pointermove","pointerleave","finalizeState","off","attribute","constant","Float32Array","extensionName"],"mappings":";;;;;;;;;AAoBA;;AACA;;AAEA,MAAMA,YAAY,GAAG;AACnBC,EAAAA,iBAAiB,EAAE;AAACC,IAAAA,IAAI,EAAE,UAAP;AAAmBC,IAAAA,KAAK,EAAE,CAAC,CAAD,EAAI,CAAJ;AAA1B,GADA;AAGnBC,EAAAA,cAAc,EAAE,QAHG;AAInBC,EAAAA,eAAe,EAAE,IAJE;AAKnBC,EAAAA,cAAc,EAAE;AALG,CAArB;;AAQe,MAAMC,iBAAN,SAAgCC,oBAAhC,CAA+C;AAC5DC,EAAAA,UAAU,CAACC,SAAD,EAAY;AACpB,WAAO;AACLC,MAAAA,OAAO,EAAE,CAACC,qBAAD;AADJ,KAAP;AAGD;;AAEDC,EAAAA,eAAe,CAACC,OAAD,EAAUJ,SAAV,EAAqB;AAClC,UAAMK,gBAAgB,GAAG,KAAKC,mBAAL,EAAzB;;AACA,QAAID,gBAAJ,EAAsB;AACpBA,MAAAA,gBAAgB,CAACE,GAAjB,CAAqB;AACnBC,QAAAA,eAAe,EAAE;AACfC,UAAAA,IAAI,EAAE,CADS;AAEfC,UAAAA,QAAQ,EAAE,mBAFK;AAKfC,UAAAA,MAAM,EAAE,CAAC,KAAKC,KAAL,CAAWrB,iBAAZ,IAAiCS,SAAS,CAACa,0BALpC;AAMfC,UAAAA,gBAAgB,EAAE;AAChBN,YAAAA,eAAe,EAAE;AACfO,cAAAA,OAAO,EAAE;AADM,aADD;AAIhBC,YAAAA,uBAAuB,EAAE;AACvBD,cAAAA,OAAO,EAAE;AADc;AAJT;AANH;AADE,OAArB;AAiBD;;AAIDf,IAAAA,SAAS,CAACiB,WAAV,GAAwB,MAAM;AAC5B,WAAKC,eAAL,GAAuBC,cAAvB;AACD,KAFD;;AAGA,QAAI,KAAKf,OAAL,CAAagB,IAAjB,EAAuB;AACrB,WAAKhB,OAAL,CAAagB,IAAb,CAAkBC,YAAlB,CAA+BC,EAA/B,CAAkC;AAChCC,QAAAA,WAAW,EAAEvB,SAAS,CAACiB,WADS;AAEhCO,QAAAA,YAAY,EAAExB,SAAS,CAACiB;AAFQ,OAAlC;AAID;AACF;;AAEDQ,EAAAA,aAAa,CAACzB,SAAD,EAAY;AAEvB,QAAI,KAAKI,OAAL,CAAagB,IAAjB,EAAuB;AACrB,WAAKhB,OAAL,CAAagB,IAAb,CAAkBC,YAAlB,CAA+BK,GAA/B,CAAmC;AACjCH,QAAAA,WAAW,EAAEvB,SAAS,CAACiB,WADU;AAEjCO,QAAAA,YAAY,EAAExB,SAAS,CAACiB;AAFS,OAAnC;AAID;AACF;;AAEDJ,EAAAA,0BAA0B,CAACc,SAAD,EAAY;AACpCA,IAAAA,SAAS,CAACC,QAAV,GAAqB,IAArB;AACAD,IAAAA,SAAS,CAAClC,KAAV,GAAkB,IAAIoC,YAAJ,CAAiB,CAAjB,CAAlB;AACA;AACD;;AAxD2D;;;AA2D9DhC,iBAAiB,CAACiC,aAAlB,GAAkC,mBAAlC;AACAjC,iBAAiB,CAACP,YAAlB,GAAiCA,YAAjC","sourcesContent":["// Copyright (c) 2015 - 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\nimport {LayerExtension} from '@deck.gl/core';\nimport shaderModule from './shader-module';\n\nconst defaultProps = {\n getBrushingTarget: {type: 'accessor', value: [0, 0]},\n\n brushingTarget: 'source',\n brushingEnabled: true,\n brushingRadius: 10000\n};\n\nexport default class BrushingExtension extends LayerExtension {\n getShaders(extension) {\n return {\n modules: [shaderModule]\n };\n }\n\n initializeState(context, extension) {\n const attributeManager = this.getAttributeManager();\n if (attributeManager) {\n attributeManager.add({\n brushingTargets: {\n size: 2,\n accessor: 'getBrushingTarget',\n // Hack: extension's defaultProps is not merged with the layer's defaultProps,\n // So we can't use the standard accessor when the prop is undefined\n update: !this.props.getBrushingTarget && extension.useConstantTargetPositions,\n shaderAttributes: {\n brushingTargets: {\n divisor: 0\n },\n instanceBrushingTargets: {\n divisor: 1\n }\n }\n }\n });\n }\n\n // Trigger redraw when mouse moves\n // TODO - expose this in a better way\n extension.onMouseMove = () => {\n this.getCurrentLayer().setNeedsRedraw();\n };\n if (this.context.deck) {\n this.context.deck.eventManager.on({\n pointermove: extension.onMouseMove,\n pointerleave: extension.onMouseMove\n });\n }\n }\n\n finalizeState(extension) {\n // Remove event listeners\n if (this.context.deck) {\n this.context.deck.eventManager.off({\n pointermove: extension.onMouseMove,\n pointerleave: extension.onMouseMove\n });\n }\n }\n\n useConstantTargetPositions(attribute) {\n attribute.constant = true;\n attribute.value = new Float32Array(2);\n return;\n }\n}\n\nBrushingExtension.extensionName = 'BrushingExtension';\nBrushingExtension.defaultProps = defaultProps;\n"],"file":"brushing.js"}
1
+ {"version":3,"sources":["../../../src/brushing/brushing.js"],"names":["defaultProps","getBrushingTarget","type","value","brushingTarget","brushingEnabled","brushingRadius","BrushingExtension","extension","modules","shaderModule","context","attributeManager","getAttributeManager","add","brushingTargets","size","accessor","update","props","useConstantTargetPositions","shaderAttributes","divisor","instanceBrushingTargets","onMouseMove","getCurrentLayer","setNeedsRedraw","deck","eventManager","on","pointermove","pointerleave","off","attribute","constant","Float32Array","LayerExtension","extensionName"],"mappings":";;;;;;;;;;;;;;;;;;;AAoBA;;AACA;;;;;;AAEA,IAAMA,YAAY,GAAG;AACnBC,EAAAA,iBAAiB,EAAE;AAACC,IAAAA,IAAI,EAAE,UAAP;AAAmBC,IAAAA,KAAK,EAAE,CAAC,CAAD,EAAI,CAAJ;AAA1B,GADA;AAGnBC,EAAAA,cAAc,EAAE,QAHG;AAInBC,EAAAA,eAAe,EAAE,IAJE;AAKnBC,EAAAA,cAAc,EAAE;AALG,CAArB;;IAQqBC,iB;;;;;;;;;;;;WACnB,oBAAWC,SAAX,EAAsB;AACpB,aAAO;AACLC,QAAAA,OAAO,EAAE,CAACC,qBAAD;AADJ,OAAP;AAGD;;;WAED,yBAAgBC,OAAhB,EAAyBH,SAAzB,EAAoC;AAAA;;AAClC,UAAMI,gBAAgB,GAAG,KAAKC,mBAAL,EAAzB;;AACA,UAAID,gBAAJ,EAAsB;AACpBA,QAAAA,gBAAgB,CAACE,GAAjB,CAAqB;AACnBC,UAAAA,eAAe,EAAE;AACfC,YAAAA,IAAI,EAAE,CADS;AAEfC,YAAAA,QAAQ,EAAE,mBAFK;AAKfC,YAAAA,MAAM,EAAE,CAAC,KAAKC,KAAL,CAAWlB,iBAAZ,IAAiCO,SAAS,CAACY,0BALpC;AAMfC,YAAAA,gBAAgB,EAAE;AAChBN,cAAAA,eAAe,EAAE;AACfO,gBAAAA,OAAO,EAAE;AADM,eADD;AAIhBC,cAAAA,uBAAuB,EAAE;AACvBD,gBAAAA,OAAO,EAAE;AADc;AAJT;AANH;AADE,SAArB;AAiBD;;AAIDd,MAAAA,SAAS,CAACgB,WAAV,GAAwB,YAAM;AAC5B,QAAA,KAAI,CAACC,eAAL,GAAuBC,cAAvB;AACD,OAFD;;AAGA,UAAI,KAAKf,OAAL,CAAagB,IAAjB,EAAuB;AACrB,aAAKhB,OAAL,CAAagB,IAAb,CAAkBC,YAAlB,CAA+BC,EAA/B,CAAkC;AAChCC,UAAAA,WAAW,EAAEtB,SAAS,CAACgB,WADS;AAEhCO,UAAAA,YAAY,EAAEvB,SAAS,CAACgB;AAFQ,SAAlC;AAID;AACF;;;WAED,uBAAchB,SAAd,EAAyB;AAEvB,UAAI,KAAKG,OAAL,CAAagB,IAAjB,EAAuB;AACrB,aAAKhB,OAAL,CAAagB,IAAb,CAAkBC,YAAlB,CAA+BI,GAA/B,CAAmC;AACjCF,UAAAA,WAAW,EAAEtB,SAAS,CAACgB,WADU;AAEjCO,UAAAA,YAAY,EAAEvB,SAAS,CAACgB;AAFS,SAAnC;AAID;AACF;;;WAED,oCAA2BS,SAA3B,EAAsC;AACpCA,MAAAA,SAAS,CAACC,QAAV,GAAqB,IAArB;AACAD,MAAAA,SAAS,CAAC9B,KAAV,GAAkB,IAAIgC,YAAJ,CAAiB,CAAjB,CAAlB;AACA;AACD;;;EAxD4CC,oB;;;AA2D/C7B,iBAAiB,CAAC8B,aAAlB,GAAkC,mBAAlC;AACA9B,iBAAiB,CAACP,YAAlB,GAAiCA,YAAjC","sourcesContent":["// Copyright (c) 2015 - 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\nimport {LayerExtension} from '@deck.gl/core';\nimport shaderModule from './shader-module';\n\nconst defaultProps = {\n getBrushingTarget: {type: 'accessor', value: [0, 0]},\n\n brushingTarget: 'source',\n brushingEnabled: true,\n brushingRadius: 10000\n};\n\nexport default class BrushingExtension extends LayerExtension {\n getShaders(extension) {\n return {\n modules: [shaderModule]\n };\n }\n\n initializeState(context, extension) {\n const attributeManager = this.getAttributeManager();\n if (attributeManager) {\n attributeManager.add({\n brushingTargets: {\n size: 2,\n accessor: 'getBrushingTarget',\n // Hack: extension's defaultProps is not merged with the layer's defaultProps,\n // So we can't use the standard accessor when the prop is undefined\n update: !this.props.getBrushingTarget && extension.useConstantTargetPositions,\n shaderAttributes: {\n brushingTargets: {\n divisor: 0\n },\n instanceBrushingTargets: {\n divisor: 1\n }\n }\n }\n });\n }\n\n // Trigger redraw when mouse moves\n // TODO - expose this in a better way\n extension.onMouseMove = () => {\n this.getCurrentLayer().setNeedsRedraw();\n };\n if (this.context.deck) {\n this.context.deck.eventManager.on({\n pointermove: extension.onMouseMove,\n pointerleave: extension.onMouseMove\n });\n }\n }\n\n finalizeState(extension) {\n // Remove event listeners\n if (this.context.deck) {\n this.context.deck.eventManager.off({\n pointermove: extension.onMouseMove,\n pointerleave: extension.onMouseMove\n });\n }\n }\n\n useConstantTargetPositions(attribute) {\n attribute.constant = true;\n attribute.value = new Float32Array(2);\n return;\n }\n}\n\nBrushingExtension.extensionName = 'BrushingExtension';\nBrushingExtension.defaultProps = defaultProps;\n"],"file":"brushing.js"}
@@ -7,36 +7,37 @@ exports.default = void 0;
7
7
 
8
8
  var _core = require("@deck.gl/core");
9
9
 
10
- const vs = "\n uniform bool brushing_enabled;\n uniform int brushing_target;\n uniform vec2 brushing_mousePos;\n uniform float brushing_radius;\n\n #ifdef NON_INSTANCED_MODEL\n attribute vec2 brushingTargets;\n #else\n attribute vec2 instanceBrushingTargets;\n #endif\n\n varying float brushing_isVisible;\n\n bool brushing_isPointInRange(vec2 position) {\n if (!brushing_enabled) {\n return true;\n }\n vec2 source_commonspace = project_position(position);\n vec2 target_commonspace = project_position(brushing_mousePos);\n float distance = length((target_commonspace - source_commonspace) / project_uCommonUnitsPerMeter.xy);\n\n return distance <= brushing_radius;\n }\n\n bool brushing_arePointsInRange(vec2 sourcePos, vec2 targetPos) {\n return brushing_isPointInRange(sourcePos) || brushing_isPointInRange(targetPos);\n }\n\n void brushing_setVisible(bool visible) {\n brushing_isVisible = float(visible);\n }\n";
11
- const fs = "\n uniform bool brushing_enabled;\n varying float brushing_isVisible;\n";
12
- const TARGET = {
10
+ var vs = "\n uniform bool brushing_enabled;\n uniform int brushing_target;\n uniform vec2 brushing_mousePos;\n uniform float brushing_radius;\n\n #ifdef NON_INSTANCED_MODEL\n attribute vec2 brushingTargets;\n #else\n attribute vec2 instanceBrushingTargets;\n #endif\n\n varying float brushing_isVisible;\n\n bool brushing_isPointInRange(vec2 position) {\n if (!brushing_enabled) {\n return true;\n }\n vec2 source_commonspace = project_position(position);\n vec2 target_commonspace = project_position(brushing_mousePos);\n float distance = length((target_commonspace - source_commonspace) / project_uCommonUnitsPerMeter.xy);\n\n return distance <= brushing_radius;\n }\n\n bool brushing_arePointsInRange(vec2 sourcePos, vec2 targetPos) {\n return brushing_isPointInRange(sourcePos) || brushing_isPointInRange(targetPos);\n }\n\n void brushing_setVisible(bool visible) {\n brushing_isVisible = float(visible);\n }\n";
11
+ var fs = "\n uniform bool brushing_enabled;\n varying float brushing_isVisible;\n";
12
+ var TARGET = {
13
13
  source: 0,
14
14
  target: 1,
15
15
  custom: 2,
16
16
  source_target: 3
17
17
  };
18
- const inject = {
18
+ var inject = {
19
19
  'vs:DECKGL_FILTER_GL_POSITION': "\n vec2 brushingTarget;\n vec2 brushingSource;\n if (brushing_target == 3) {\n brushingTarget = geometry.worldPositionAlt.xy;\n brushingSource = geometry.worldPosition.xy;\n } else if (brushing_target == 0) {\n brushingTarget = geometry.worldPosition.xy;\n } else if (brushing_target == 1) {\n brushingTarget = geometry.worldPositionAlt.xy;\n } else {\n #ifdef NON_INSTANCED_MODEL\n brushingTarget = brushingTargets;\n #else\n brushingTarget = instanceBrushingTargets;\n #endif\n }\n bool visible;\n if (brushing_target == 3) {\n visible = brushing_arePointsInRange(brushingSource, brushingTarget);\n } else {\n visible = brushing_isPointInRange(brushingTarget);\n }\n brushing_setVisible(visible);\n ",
20
20
  'fs:DECKGL_FILTER_COLOR': "\n if (brushing_enabled && brushing_isVisible < 0.5) {\n discard;\n }\n "
21
21
  };
22
22
  var _default = {
23
23
  name: 'brushing',
24
24
  dependencies: [_core.project],
25
- vs,
26
- fs,
27
- inject,
28
- getUniforms: opts => {
25
+ vs: vs,
26
+ fs: fs,
27
+ inject: inject,
28
+ getUniforms: function getUniforms(opts) {
29
29
  if (!opts || !opts.viewport) {
30
30
  return {};
31
31
  }
32
32
 
33
- const {
34
- brushingEnabled = true,
35
- brushingRadius = 10000,
36
- brushingTarget = 'source',
37
- mousePosition,
38
- viewport
39
- } = opts;
33
+ var _opts$brushingEnabled = opts.brushingEnabled,
34
+ brushingEnabled = _opts$brushingEnabled === void 0 ? true : _opts$brushingEnabled,
35
+ _opts$brushingRadius = opts.brushingRadius,
36
+ brushingRadius = _opts$brushingRadius === void 0 ? 10000 : _opts$brushingRadius,
37
+ _opts$brushingTarget = opts.brushingTarget,
38
+ brushingTarget = _opts$brushingTarget === void 0 ? 'source' : _opts$brushingTarget,
39
+ mousePosition = opts.mousePosition,
40
+ viewport = opts.viewport;
40
41
  return {
41
42
  brushing_enabled: Boolean(brushingEnabled && mousePosition && viewport.containsPixel(mousePosition)),
42
43
  brushing_radius: brushingRadius,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/brushing/shader-module.js"],"names":["vs","fs","TARGET","source","target","custom","source_target","inject","name","dependencies","project","getUniforms","opts","viewport","brushingEnabled","brushingRadius","brushingTarget","mousePosition","brushing_enabled","Boolean","containsPixel","brushing_radius","brushing_target","brushing_mousePos","unproject","x","y"],"mappings":";;;;;;;AAmBA;;AAEA,MAAMA,EAAE,07BAAR;AAkCA,MAAMC,EAAE,8EAAR;AAKA,MAAMC,MAAM,GAAG;AACbC,EAAAA,MAAM,EAAE,CADK;AAEbC,EAAAA,MAAM,EAAE,CAFK;AAGbC,EAAAA,MAAM,EAAE,CAHK;AAIbC,EAAAA,aAAa,EAAE;AAJF,CAAf;AAOA,MAAMC,MAAM,GAAG;AACb,6zBADa;AA2Bb;AA3Ba,CAAf;eAkCe;AACbC,EAAAA,IAAI,EAAE,UADO;AAEbC,EAAAA,YAAY,EAAE,CAACC,aAAD,CAFD;AAGbV,EAAAA,EAHa;AAIbC,EAAAA,EAJa;AAKbM,EAAAA,MALa;AAMbI,EAAAA,WAAW,EAAEC,IAAI,IAAI;AACnB,QAAI,CAACA,IAAD,IAAS,CAACA,IAAI,CAACC,QAAnB,EAA6B;AAC3B,aAAO,EAAP;AACD;;AACD,UAAM;AACJC,MAAAA,eAAe,GAAG,IADd;AAEJC,MAAAA,cAAc,GAAG,KAFb;AAGJC,MAAAA,cAAc,GAAG,QAHb;AAIJC,MAAAA,aAJI;AAKJJ,MAAAA;AALI,QAMFD,IANJ;AAOA,WAAO;AACLM,MAAAA,gBAAgB,EAAEC,OAAO,CACvBL,eAAe,IAAIG,aAAnB,IAAoCJ,QAAQ,CAACO,aAAT,CAAuBH,aAAvB,CADb,CADpB;AAILI,MAAAA,eAAe,EAAEN,cAJZ;AAKLO,MAAAA,eAAe,EAAEpB,MAAM,CAACc,cAAD,CAAN,IAA0B,CALtC;AAMLO,MAAAA,iBAAiB,EAAEN,aAAa,GAC5BJ,QAAQ,CAACW,SAAT,CAAmB,CAACP,aAAa,CAACQ,CAAd,GAAkBZ,QAAQ,CAACY,CAA5B,EAA+BR,aAAa,CAACS,CAAd,GAAkBb,QAAQ,CAACa,CAA1D,CAAnB,CAD4B,GAE5B,CAAC,CAAD,EAAI,CAAJ;AARC,KAAP;AAUD;AA3BY,C","sourcesContent":["// Copyright (c) 2015-2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\nimport {project} from '@deck.gl/core';\n\nconst vs = `\n uniform bool brushing_enabled;\n uniform int brushing_target;\n uniform vec2 brushing_mousePos;\n uniform float brushing_radius;\n\n #ifdef NON_INSTANCED_MODEL\n attribute vec2 brushingTargets;\n #else\n attribute vec2 instanceBrushingTargets;\n #endif\n\n varying float brushing_isVisible;\n\n bool brushing_isPointInRange(vec2 position) {\n if (!brushing_enabled) {\n return true;\n }\n vec2 source_commonspace = project_position(position);\n vec2 target_commonspace = project_position(brushing_mousePos);\n float distance = length((target_commonspace - source_commonspace) / project_uCommonUnitsPerMeter.xy);\n\n return distance <= brushing_radius;\n }\n\n bool brushing_arePointsInRange(vec2 sourcePos, vec2 targetPos) {\n return brushing_isPointInRange(sourcePos) || brushing_isPointInRange(targetPos);\n }\n\n void brushing_setVisible(bool visible) {\n brushing_isVisible = float(visible);\n }\n`;\n\nconst fs = `\n uniform bool brushing_enabled;\n varying float brushing_isVisible;\n`;\n\nconst TARGET = {\n source: 0,\n target: 1,\n custom: 2,\n source_target: 3\n};\n\nconst inject = {\n 'vs:DECKGL_FILTER_GL_POSITION': `\n vec2 brushingTarget;\n vec2 brushingSource;\n if (brushing_target == 3) {\n brushingTarget = geometry.worldPositionAlt.xy;\n brushingSource = geometry.worldPosition.xy;\n } else if (brushing_target == 0) {\n brushingTarget = geometry.worldPosition.xy;\n } else if (brushing_target == 1) {\n brushingTarget = geometry.worldPositionAlt.xy;\n } else {\n #ifdef NON_INSTANCED_MODEL\n brushingTarget = brushingTargets;\n #else\n brushingTarget = instanceBrushingTargets;\n #endif\n }\n bool visible;\n if (brushing_target == 3) {\n visible = brushing_arePointsInRange(brushingSource, brushingTarget);\n } else {\n visible = brushing_isPointInRange(brushingTarget);\n }\n brushing_setVisible(visible);\n `,\n\n 'fs:DECKGL_FILTER_COLOR': `\n if (brushing_enabled && brushing_isVisible < 0.5) {\n discard;\n }\n `\n};\n\nexport default {\n name: 'brushing',\n dependencies: [project],\n vs,\n fs,\n inject,\n getUniforms: opts => {\n if (!opts || !opts.viewport) {\n return {};\n }\n const {\n brushingEnabled = true,\n brushingRadius = 10000,\n brushingTarget = 'source',\n mousePosition,\n viewport\n } = opts;\n return {\n brushing_enabled: Boolean(\n brushingEnabled && mousePosition && viewport.containsPixel(mousePosition)\n ),\n brushing_radius: brushingRadius,\n brushing_target: TARGET[brushingTarget] || 0,\n brushing_mousePos: mousePosition\n ? viewport.unproject([mousePosition.x - viewport.x, mousePosition.y - viewport.y])\n : [0, 0]\n };\n }\n};\n"],"file":"shader-module.js"}
1
+ {"version":3,"sources":["../../../src/brushing/shader-module.js"],"names":["vs","fs","TARGET","source","target","custom","source_target","inject","name","dependencies","project","getUniforms","opts","viewport","brushingEnabled","brushingRadius","brushingTarget","mousePosition","brushing_enabled","Boolean","containsPixel","brushing_radius","brushing_target","brushing_mousePos","unproject","x","y"],"mappings":";;;;;;;AAmBA;;AAEA,IAAMA,EAAE,07BAAR;AAkCA,IAAMC,EAAE,8EAAR;AAKA,IAAMC,MAAM,GAAG;AACbC,EAAAA,MAAM,EAAE,CADK;AAEbC,EAAAA,MAAM,EAAE,CAFK;AAGbC,EAAAA,MAAM,EAAE,CAHK;AAIbC,EAAAA,aAAa,EAAE;AAJF,CAAf;AAOA,IAAMC,MAAM,GAAG;AACb,6zBADa;AA2Bb;AA3Ba,CAAf;eAkCe;AACbC,EAAAA,IAAI,EAAE,UADO;AAEbC,EAAAA,YAAY,EAAE,CAACC,aAAD,CAFD;AAGbV,EAAAA,EAAE,EAAFA,EAHa;AAIbC,EAAAA,EAAE,EAAFA,EAJa;AAKbM,EAAAA,MAAM,EAANA,MALa;AAMbI,EAAAA,WAAW,EAAE,qBAAAC,IAAI,EAAI;AACnB,QAAI,CAACA,IAAD,IAAS,CAACA,IAAI,CAACC,QAAnB,EAA6B;AAC3B,aAAO,EAAP;AACD;;AACD,gCAMID,IANJ,CACEE,eADF;AAAA,QACEA,eADF,sCACoB,IADpB;AAAA,+BAMIF,IANJ,CAEEG,cAFF;AAAA,QAEEA,cAFF,qCAEmB,KAFnB;AAAA,+BAMIH,IANJ,CAGEI,cAHF;AAAA,QAGEA,cAHF,qCAGmB,QAHnB;AAAA,QAIEC,aAJF,GAMIL,IANJ,CAIEK,aAJF;AAAA,QAKEJ,QALF,GAMID,IANJ,CAKEC,QALF;AAOA,WAAO;AACLK,MAAAA,gBAAgB,EAAEC,OAAO,CACvBL,eAAe,IAAIG,aAAnB,IAAoCJ,QAAQ,CAACO,aAAT,CAAuBH,aAAvB,CADb,CADpB;AAILI,MAAAA,eAAe,EAAEN,cAJZ;AAKLO,MAAAA,eAAe,EAAEpB,MAAM,CAACc,cAAD,CAAN,IAA0B,CALtC;AAMLO,MAAAA,iBAAiB,EAAEN,aAAa,GAC5BJ,QAAQ,CAACW,SAAT,CAAmB,CAACP,aAAa,CAACQ,CAAd,GAAkBZ,QAAQ,CAACY,CAA5B,EAA+BR,aAAa,CAACS,CAAd,GAAkBb,QAAQ,CAACa,CAA1D,CAAnB,CAD4B,GAE5B,CAAC,CAAD,EAAI,CAAJ;AARC,KAAP;AAUD;AA3BY,C","sourcesContent":["// Copyright (c) 2015-2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\nimport {project} from '@deck.gl/core';\n\nconst vs = `\n uniform bool brushing_enabled;\n uniform int brushing_target;\n uniform vec2 brushing_mousePos;\n uniform float brushing_radius;\n\n #ifdef NON_INSTANCED_MODEL\n attribute vec2 brushingTargets;\n #else\n attribute vec2 instanceBrushingTargets;\n #endif\n\n varying float brushing_isVisible;\n\n bool brushing_isPointInRange(vec2 position) {\n if (!brushing_enabled) {\n return true;\n }\n vec2 source_commonspace = project_position(position);\n vec2 target_commonspace = project_position(brushing_mousePos);\n float distance = length((target_commonspace - source_commonspace) / project_uCommonUnitsPerMeter.xy);\n\n return distance <= brushing_radius;\n }\n\n bool brushing_arePointsInRange(vec2 sourcePos, vec2 targetPos) {\n return brushing_isPointInRange(sourcePos) || brushing_isPointInRange(targetPos);\n }\n\n void brushing_setVisible(bool visible) {\n brushing_isVisible = float(visible);\n }\n`;\n\nconst fs = `\n uniform bool brushing_enabled;\n varying float brushing_isVisible;\n`;\n\nconst TARGET = {\n source: 0,\n target: 1,\n custom: 2,\n source_target: 3\n};\n\nconst inject = {\n 'vs:DECKGL_FILTER_GL_POSITION': `\n vec2 brushingTarget;\n vec2 brushingSource;\n if (brushing_target == 3) {\n brushingTarget = geometry.worldPositionAlt.xy;\n brushingSource = geometry.worldPosition.xy;\n } else if (brushing_target == 0) {\n brushingTarget = geometry.worldPosition.xy;\n } else if (brushing_target == 1) {\n brushingTarget = geometry.worldPositionAlt.xy;\n } else {\n #ifdef NON_INSTANCED_MODEL\n brushingTarget = brushingTargets;\n #else\n brushingTarget = instanceBrushingTargets;\n #endif\n }\n bool visible;\n if (brushing_target == 3) {\n visible = brushing_arePointsInRange(brushingSource, brushingTarget);\n } else {\n visible = brushing_isPointInRange(brushingTarget);\n }\n brushing_setVisible(visible);\n `,\n\n 'fs:DECKGL_FILTER_COLOR': `\n if (brushing_enabled && brushing_isVisible < 0.5) {\n discard;\n }\n `\n};\n\nexport default {\n name: 'brushing',\n dependencies: [project],\n vs,\n fs,\n inject,\n getUniforms: opts => {\n if (!opts || !opts.viewport) {\n return {};\n }\n const {\n brushingEnabled = true,\n brushingRadius = 10000,\n brushingTarget = 'source',\n mousePosition,\n viewport\n } = opts;\n return {\n brushing_enabled: Boolean(\n brushingEnabled && mousePosition && viewport.containsPixel(mousePosition)\n ),\n brushing_radius: brushingRadius,\n brushing_target: TARGET[brushingTarget] || 0,\n brushing_mousePos: mousePosition\n ? viewport.unproject([mousePosition.x - viewport.x, mousePosition.y - viewport.y])\n : [0, 0]\n };\n }\n};\n"],"file":"shader-module.js"}
@@ -1,72 +1,99 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
6
8
  exports.default = void 0;
7
9
 
10
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
+
12
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
+
14
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
15
+
16
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
17
+
18
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
19
+
8
20
  var _core = require("@deck.gl/core");
9
21
 
10
- const defaultProps = {
22
+ 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); }; }
23
+
24
+ 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; } }
25
+
26
+ var defaultProps = {
11
27
  clipBounds: [0, 0, 1, 1]
12
28
  };
13
- const shaderFunction = "\nuniform vec4 clip_bounds;\n\nbool clip_isInBounds(vec2 position) {\n return position.x >= clip_bounds[0] && position.y >= clip_bounds[1] && position.x < clip_bounds[2] && position.y < clip_bounds[3];\n}\n";
14
- const shaderModuleVs = {
29
+ var shaderFunction = "\nuniform vec4 clip_bounds;\n\nbool clip_isInBounds(vec2 position) {\n return position.x >= clip_bounds[0] && position.y >= clip_bounds[1] && position.x < clip_bounds[2] && position.y < clip_bounds[3];\n}\n";
30
+ var shaderModuleVs = {
15
31
  name: 'clip-vs',
16
32
  vs: shaderFunction
17
33
  };
18
- const injectionVs = {
34
+ var injectionVs = {
19
35
  'vs:#decl': "\nvarying float clip_isVisible;\n",
20
36
  'vs:DECKGL_FILTER_GL_POSITION': "\n clip_isVisible = float(clip_isInBounds(geometry.worldPosition.xy));\n",
21
37
  'fs:#decl': "\nvarying float clip_isVisible;\n",
22
38
  'fs:DECKGL_FILTER_COLOR': "\n if (clip_isVisible < 0.5) discard;\n"
23
39
  };
24
- const shaderModuleFs = {
40
+ var shaderModuleFs = {
25
41
  name: 'clip-fs',
26
42
  fs: shaderFunction
27
43
  };
28
- const injectionFs = {
44
+ var injectionFs = {
29
45
  'vs:#decl': "\nvarying vec2 clip_commonPosition;\n",
30
46
  'vs:DECKGL_FILTER_GL_POSITION': "\n clip_commonPosition = geometry.position.xy;\n",
31
47
  'fs:#decl': "\nvarying vec2 clip_commonPosition;\n",
32
48
  'fs:DECKGL_FILTER_COLOR': "\n if (!clip_isInBounds(clip_commonPosition)) discard;\n"
33
49
  };
34
50
 
35
- class ClipExtension extends _core.LayerExtension {
36
- getShaders() {
37
- let clipByInstance = ('instancePositions' in this.getAttributeManager().attributes);
51
+ var ClipExtension = function (_LayerExtension) {
52
+ (0, _inherits2.default)(ClipExtension, _LayerExtension);
38
53
 
39
- if ('clipByInstance' in this.props) {
40
- clipByInstance = this.props.clipByInstance;
41
- }
54
+ var _super = _createSuper(ClipExtension);
42
55
 
43
- this.state.clipByInstance = clipByInstance;
44
- return clipByInstance ? {
45
- modules: [shaderModuleVs],
46
- inject: injectionVs
47
- } : {
48
- modules: [shaderModuleFs],
49
- inject: injectionFs
50
- };
56
+ function ClipExtension() {
57
+ (0, _classCallCheck2.default)(this, ClipExtension);
58
+ return _super.apply(this, arguments);
51
59
  }
52
60
 
53
- draw({
54
- uniforms
55
- }) {
56
- const {
57
- clipBounds = defaultProps.clipBounds
58
- } = this.props;
59
-
60
- if (this.state.clipByInstance) {
61
- uniforms.clip_bounds = clipBounds;
62
- } else {
63
- const corner0 = this.projectPosition([clipBounds[0], clipBounds[1], 0]);
64
- const corner1 = this.projectPosition([clipBounds[2], clipBounds[3], 0]);
65
- uniforms.clip_bounds = [Math.min(corner0[0], corner1[0]), Math.min(corner0[1], corner1[1]), Math.max(corner0[0], corner1[0]), Math.max(corner0[1], corner1[1])];
61
+ (0, _createClass2.default)(ClipExtension, [{
62
+ key: "getShaders",
63
+ value: function getShaders() {
64
+ var clipByInstance = ('instancePositions' in this.getAttributeManager().attributes);
65
+
66
+ if ('clipByInstance' in this.props) {
67
+ clipByInstance = this.props.clipByInstance;
68
+ }
69
+
70
+ this.state.clipByInstance = clipByInstance;
71
+ return clipByInstance ? {
72
+ modules: [shaderModuleVs],
73
+ inject: injectionVs
74
+ } : {
75
+ modules: [shaderModuleFs],
76
+ inject: injectionFs
77
+ };
66
78
  }
67
- }
79
+ }, {
80
+ key: "draw",
81
+ value: function draw(_ref) {
82
+ var uniforms = _ref.uniforms;
83
+ var _this$props$clipBound = this.props.clipBounds,
84
+ clipBounds = _this$props$clipBound === void 0 ? defaultProps.clipBounds : _this$props$clipBound;
68
85
 
69
- }
86
+ if (this.state.clipByInstance) {
87
+ uniforms.clip_bounds = clipBounds;
88
+ } else {
89
+ var corner0 = this.projectPosition([clipBounds[0], clipBounds[1], 0]);
90
+ var corner1 = this.projectPosition([clipBounds[2], clipBounds[3], 0]);
91
+ uniforms.clip_bounds = [Math.min(corner0[0], corner1[0]), Math.min(corner0[1], corner1[1]), Math.max(corner0[0], corner1[0]), Math.max(corner0[1], corner1[1])];
92
+ }
93
+ }
94
+ }]);
95
+ return ClipExtension;
96
+ }(_core.LayerExtension);
70
97
 
71
98
  exports.default = ClipExtension;
72
99
  ClipExtension.extensionName = 'ClipExtension';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/clip/clip.js"],"names":["defaultProps","clipBounds","shaderFunction","shaderModuleVs","name","vs","injectionVs","shaderModuleFs","fs","injectionFs","ClipExtension","LayerExtension","getShaders","clipByInstance","getAttributeManager","attributes","props","state","modules","inject","draw","uniforms","clip_bounds","corner0","projectPosition","corner1","Math","min","max","extensionName"],"mappings":";;;;;;;AAoBA;;AAEA,MAAMA,YAAY,GAAG;AACnBC,EAAAA,UAAU,EAAE,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,EAAU,CAAV;AADO,CAArB;AAIA,MAAMC,cAAc,oNAApB;AAYA,MAAMC,cAAc,GAAG;AACrBC,EAAAA,IAAI,EAAE,SADe;AAErBC,EAAAA,EAAE,EAAEH;AAFiB,CAAvB;AAKA,MAAMI,WAAW,GAAG;AAClB,iDADkB;AAIlB,6GAJkB;AAOlB,iDAPkB;AAUlB;AAVkB,CAApB;AAmBA,MAAMC,cAAc,GAAG;AACrBH,EAAAA,IAAI,EAAE,SADe;AAErBI,EAAAA,EAAE,EAAEN;AAFiB,CAAvB;AAKA,MAAMO,WAAW,GAAG;AAClB,qDADkB;AAIlB,qFAJkB;AAOlB,qDAPkB;AAUlB;AAVkB,CAApB;;AAee,MAAMC,aAAN,SAA4BC,oBAA5B,CAA2C;AACxDC,EAAAA,UAAU,GAAG;AAKX,QAAIC,cAAc,IAAG,uBAAuB,KAAKC,mBAAL,GAA2BC,UAArD,CAAlB;;AAEA,QAAI,oBAAoB,KAAKC,KAA7B,EAAoC;AAClCH,MAAAA,cAAc,GAAG,KAAKG,KAAL,CAAWH,cAA5B;AACD;;AACD,SAAKI,KAAL,CAAWJ,cAAX,GAA4BA,cAA5B;AAEA,WAAOA,cAAc,GACjB;AACEK,MAAAA,OAAO,EAAE,CAACf,cAAD,CADX;AAEEgB,MAAAA,MAAM,EAAEb;AAFV,KADiB,GAKjB;AACEY,MAAAA,OAAO,EAAE,CAACX,cAAD,CADX;AAEEY,MAAAA,MAAM,EAAEV;AAFV,KALJ;AASD;;AAEDW,EAAAA,IAAI,CAAC;AAACC,IAAAA;AAAD,GAAD,EAAa;AACf,UAAM;AAACpB,MAAAA,UAAU,GAAGD,YAAY,CAACC;AAA3B,QAAyC,KAAKe,KAApD;;AACA,QAAI,KAAKC,KAAL,CAAWJ,cAAf,EAA+B;AAC7BQ,MAAAA,QAAQ,CAACC,WAAT,GAAuBrB,UAAvB;AACD,KAFD,MAEO;AACL,YAAMsB,OAAO,GAAG,KAAKC,eAAL,CAAqB,CAACvB,UAAU,CAAC,CAAD,CAAX,EAAgBA,UAAU,CAAC,CAAD,CAA1B,EAA+B,CAA/B,CAArB,CAAhB;AACA,YAAMwB,OAAO,GAAG,KAAKD,eAAL,CAAqB,CAACvB,UAAU,CAAC,CAAD,CAAX,EAAgBA,UAAU,CAAC,CAAD,CAA1B,EAA+B,CAA/B,CAArB,CAAhB;AAEAoB,MAAAA,QAAQ,CAACC,WAAT,GAAuB,CACrBI,IAAI,CAACC,GAAL,CAASJ,OAAO,CAAC,CAAD,CAAhB,EAAqBE,OAAO,CAAC,CAAD,CAA5B,CADqB,EAErBC,IAAI,CAACC,GAAL,CAASJ,OAAO,CAAC,CAAD,CAAhB,EAAqBE,OAAO,CAAC,CAAD,CAA5B,CAFqB,EAGrBC,IAAI,CAACE,GAAL,CAASL,OAAO,CAAC,CAAD,CAAhB,EAAqBE,OAAO,CAAC,CAAD,CAA5B,CAHqB,EAIrBC,IAAI,CAACE,GAAL,CAASL,OAAO,CAAC,CAAD,CAAhB,EAAqBE,OAAO,CAAC,CAAD,CAA5B,CAJqB,CAAvB;AAMD;AACF;;AAvCuD;;;AA0C1Df,aAAa,CAACmB,aAAd,GAA8B,eAA9B;AACAnB,aAAa,CAACV,YAAd,GAA6BA,YAA7B","sourcesContent":["// Copyright (c) 2015 - 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\nimport {LayerExtension} from '@deck.gl/core';\n\nconst defaultProps = {\n clipBounds: [0, 0, 1, 1]\n};\n\nconst shaderFunction = `\nuniform vec4 clip_bounds;\n\nbool clip_isInBounds(vec2 position) {\n return position.x >= clip_bounds[0] && position.y >= clip_bounds[1] && position.x < clip_bounds[2] && position.y < clip_bounds[3];\n}\n`;\n\n/*\n * The vertex-shader version clips geometries by their anchor position\n * e.g. ScatterplotLayer - show if the center of a circle is within bounds\n */\nconst shaderModuleVs = {\n name: 'clip-vs',\n vs: shaderFunction\n};\n\nconst injectionVs = {\n 'vs:#decl': `\nvarying float clip_isVisible;\n`,\n 'vs:DECKGL_FILTER_GL_POSITION': `\n clip_isVisible = float(clip_isInBounds(geometry.worldPosition.xy));\n`,\n 'fs:#decl': `\nvarying float clip_isVisible;\n`,\n 'fs:DECKGL_FILTER_COLOR': `\n if (clip_isVisible < 0.5) discard;\n`\n};\n\n/*\n * The fragment-shader version clips pixels at the bounds\n * e.g. PolygonLayer - show the part of the polygon that intersect with the bounds \n */\nconst shaderModuleFs = {\n name: 'clip-fs',\n fs: shaderFunction\n};\n\nconst injectionFs = {\n 'vs:#decl': `\nvarying vec2 clip_commonPosition;\n`,\n 'vs:DECKGL_FILTER_GL_POSITION': `\n clip_commonPosition = geometry.position.xy;\n`,\n 'fs:#decl': `\nvarying vec2 clip_commonPosition;\n`,\n 'fs:DECKGL_FILTER_COLOR': `\n if (!clip_isInBounds(clip_commonPosition)) discard;\n`\n};\n\nexport default class ClipExtension extends LayerExtension {\n getShaders() {\n // If `clipByInstance: true`, the entire object is shown/hidden based on its anchor position (done by vertex shader)\n // Otherwise, the object is trimmed by the clip bounds (done by fragment shader)\n\n // Default behavior: consider a layer instanced if it has attribute `instancePositions`\n let clipByInstance = 'instancePositions' in this.getAttributeManager().attributes;\n // Users can override by setting the `clipByInstance` prop\n if ('clipByInstance' in this.props) {\n clipByInstance = this.props.clipByInstance;\n }\n this.state.clipByInstance = clipByInstance;\n\n return clipByInstance\n ? {\n modules: [shaderModuleVs],\n inject: injectionVs\n }\n : {\n modules: [shaderModuleFs],\n inject: injectionFs\n };\n }\n\n draw({uniforms}) {\n const {clipBounds = defaultProps.clipBounds} = this.props;\n if (this.state.clipByInstance) {\n uniforms.clip_bounds = clipBounds;\n } else {\n const corner0 = this.projectPosition([clipBounds[0], clipBounds[1], 0]);\n const corner1 = this.projectPosition([clipBounds[2], clipBounds[3], 0]);\n\n uniforms.clip_bounds = [\n Math.min(corner0[0], corner1[0]),\n Math.min(corner0[1], corner1[1]),\n Math.max(corner0[0], corner1[0]),\n Math.max(corner0[1], corner1[1])\n ];\n }\n }\n}\n\nClipExtension.extensionName = 'ClipExtension';\nClipExtension.defaultProps = defaultProps;\n"],"file":"clip.js"}
1
+ {"version":3,"sources":["../../../src/clip/clip.js"],"names":["defaultProps","clipBounds","shaderFunction","shaderModuleVs","name","vs","injectionVs","shaderModuleFs","fs","injectionFs","ClipExtension","clipByInstance","getAttributeManager","attributes","props","state","modules","inject","uniforms","clip_bounds","corner0","projectPosition","corner1","Math","min","max","LayerExtension","extensionName"],"mappings":";;;;;;;;;;;;;;;;;;;AAoBA;;;;;;AAEA,IAAMA,YAAY,GAAG;AACnBC,EAAAA,UAAU,EAAE,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,EAAU,CAAV;AADO,CAArB;AAIA,IAAMC,cAAc,oNAApB;AAYA,IAAMC,cAAc,GAAG;AACrBC,EAAAA,IAAI,EAAE,SADe;AAErBC,EAAAA,EAAE,EAAEH;AAFiB,CAAvB;AAKA,IAAMI,WAAW,GAAG;AAClB,iDADkB;AAIlB,6GAJkB;AAOlB,iDAPkB;AAUlB;AAVkB,CAApB;AAmBA,IAAMC,cAAc,GAAG;AACrBH,EAAAA,IAAI,EAAE,SADe;AAErBI,EAAAA,EAAE,EAAEN;AAFiB,CAAvB;AAKA,IAAMO,WAAW,GAAG;AAClB,qDADkB;AAIlB,qFAJkB;AAOlB,qDAPkB;AAUlB;AAVkB,CAApB;;IAeqBC,a;;;;;;;;;;;;WACnB,sBAAa;AAKX,UAAIC,cAAc,IAAG,uBAAuB,KAAKC,mBAAL,GAA2BC,UAArD,CAAlB;;AAEA,UAAI,oBAAoB,KAAKC,KAA7B,EAAoC;AAClCH,QAAAA,cAAc,GAAG,KAAKG,KAAL,CAAWH,cAA5B;AACD;;AACD,WAAKI,KAAL,CAAWJ,cAAX,GAA4BA,cAA5B;AAEA,aAAOA,cAAc,GACjB;AACEK,QAAAA,OAAO,EAAE,CAACb,cAAD,CADX;AAEEc,QAAAA,MAAM,EAAEX;AAFV,OADiB,GAKjB;AACEU,QAAAA,OAAO,EAAE,CAACT,cAAD,CADX;AAEEU,QAAAA,MAAM,EAAER;AAFV,OALJ;AASD;;;WAED,oBAAiB;AAAA,UAAXS,QAAW,QAAXA,QAAW;AACf,kCAA+C,KAAKJ,KAApD,CAAOb,UAAP;AAAA,UAAOA,UAAP,sCAAoBD,YAAY,CAACC,UAAjC;;AACA,UAAI,KAAKc,KAAL,CAAWJ,cAAf,EAA+B;AAC7BO,QAAAA,QAAQ,CAACC,WAAT,GAAuBlB,UAAvB;AACD,OAFD,MAEO;AACL,YAAMmB,OAAO,GAAG,KAAKC,eAAL,CAAqB,CAACpB,UAAU,CAAC,CAAD,CAAX,EAAgBA,UAAU,CAAC,CAAD,CAA1B,EAA+B,CAA/B,CAArB,CAAhB;AACA,YAAMqB,OAAO,GAAG,KAAKD,eAAL,CAAqB,CAACpB,UAAU,CAAC,CAAD,CAAX,EAAgBA,UAAU,CAAC,CAAD,CAA1B,EAA+B,CAA/B,CAArB,CAAhB;AAEAiB,QAAAA,QAAQ,CAACC,WAAT,GAAuB,CACrBI,IAAI,CAACC,GAAL,CAASJ,OAAO,CAAC,CAAD,CAAhB,EAAqBE,OAAO,CAAC,CAAD,CAA5B,CADqB,EAErBC,IAAI,CAACC,GAAL,CAASJ,OAAO,CAAC,CAAD,CAAhB,EAAqBE,OAAO,CAAC,CAAD,CAA5B,CAFqB,EAGrBC,IAAI,CAACE,GAAL,CAASL,OAAO,CAAC,CAAD,CAAhB,EAAqBE,OAAO,CAAC,CAAD,CAA5B,CAHqB,EAIrBC,IAAI,CAACE,GAAL,CAASL,OAAO,CAAC,CAAD,CAAhB,EAAqBE,OAAO,CAAC,CAAD,CAA5B,CAJqB,CAAvB;AAMD;AACF;;;EAvCwCI,oB;;;AA0C3ChB,aAAa,CAACiB,aAAd,GAA8B,eAA9B;AACAjB,aAAa,CAACV,YAAd,GAA6BA,YAA7B","sourcesContent":["// Copyright (c) 2015 - 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\nimport {LayerExtension} from '@deck.gl/core';\n\nconst defaultProps = {\n clipBounds: [0, 0, 1, 1]\n};\n\nconst shaderFunction = `\nuniform vec4 clip_bounds;\n\nbool clip_isInBounds(vec2 position) {\n return position.x >= clip_bounds[0] && position.y >= clip_bounds[1] && position.x < clip_bounds[2] && position.y < clip_bounds[3];\n}\n`;\n\n/*\n * The vertex-shader version clips geometries by their anchor position\n * e.g. ScatterplotLayer - show if the center of a circle is within bounds\n */\nconst shaderModuleVs = {\n name: 'clip-vs',\n vs: shaderFunction\n};\n\nconst injectionVs = {\n 'vs:#decl': `\nvarying float clip_isVisible;\n`,\n 'vs:DECKGL_FILTER_GL_POSITION': `\n clip_isVisible = float(clip_isInBounds(geometry.worldPosition.xy));\n`,\n 'fs:#decl': `\nvarying float clip_isVisible;\n`,\n 'fs:DECKGL_FILTER_COLOR': `\n if (clip_isVisible < 0.5) discard;\n`\n};\n\n/*\n * The fragment-shader version clips pixels at the bounds\n * e.g. PolygonLayer - show the part of the polygon that intersect with the bounds \n */\nconst shaderModuleFs = {\n name: 'clip-fs',\n fs: shaderFunction\n};\n\nconst injectionFs = {\n 'vs:#decl': `\nvarying vec2 clip_commonPosition;\n`,\n 'vs:DECKGL_FILTER_GL_POSITION': `\n clip_commonPosition = geometry.position.xy;\n`,\n 'fs:#decl': `\nvarying vec2 clip_commonPosition;\n`,\n 'fs:DECKGL_FILTER_COLOR': `\n if (!clip_isInBounds(clip_commonPosition)) discard;\n`\n};\n\nexport default class ClipExtension extends LayerExtension {\n getShaders() {\n // If `clipByInstance: true`, the entire object is shown/hidden based on its anchor position (done by vertex shader)\n // Otherwise, the object is trimmed by the clip bounds (done by fragment shader)\n\n // Default behavior: consider a layer instanced if it has attribute `instancePositions`\n let clipByInstance = 'instancePositions' in this.getAttributeManager().attributes;\n // Users can override by setting the `clipByInstance` prop\n if ('clipByInstance' in this.props) {\n clipByInstance = this.props.clipByInstance;\n }\n this.state.clipByInstance = clipByInstance;\n\n return clipByInstance\n ? {\n modules: [shaderModuleVs],\n inject: injectionVs\n }\n : {\n modules: [shaderModuleFs],\n inject: injectionFs\n };\n }\n\n draw({uniforms}) {\n const {clipBounds = defaultProps.clipBounds} = this.props;\n if (this.state.clipByInstance) {\n uniforms.clip_bounds = clipBounds;\n } else {\n const corner0 = this.projectPosition([clipBounds[0], clipBounds[1], 0]);\n const corner1 = this.projectPosition([clipBounds[2], clipBounds[3], 0]);\n\n uniforms.clip_bounds = [\n Math.min(corner0[0], corner1[0]),\n Math.min(corner0[1], corner1[1]),\n Math.max(corner0[0], corner1[0]),\n Math.max(corner0[1], corner1[1])\n ];\n }\n }\n}\n\nClipExtension.extensionName = 'ClipExtension';\nClipExtension.defaultProps = defaultProps;\n"],"file":"clip.js"}
@@ -1,17 +1,25 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
6
- exports.supportsFloatTarget = supportsFloatTarget;
7
8
  exports.getFramebuffer = getFramebuffer;
8
9
  exports.getModel = getModel;
9
10
  exports.parameters = void 0;
11
+ exports.supportsFloatTarget = supportsFloatTarget;
12
+
13
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
14
 
11
15
  var _core = require("@luma.gl/core");
12
16
 
13
- const AGGREGATE_VS = "#define SHADER_NAME data-filter-vertex-shader\n\n#ifdef FLOAT_TARGET\n attribute float filterIndices;\n attribute float filterPrevIndices;\n#else\n attribute vec2 filterIndices;\n attribute vec2 filterPrevIndices;\n#endif\n\nvarying vec4 vColor;\nconst float component = 1.0 / 255.0;\n\nvoid main() {\n #ifdef FLOAT_TARGET\n dataFilter_value *= float(filterIndices != filterPrevIndices);\n gl_Position = vec4(0.0, 0.0, 0.0, 1.0);\n vColor = vec4(0.0, 0.0, 0.0, 1.0);\n #else\n // Float texture is not supported: pack result into 4 channels x 256 px x 64px\n dataFilter_value *= float(filterIndices.x != filterPrevIndices.x);\n float col = filterIndices.x;\n float row = filterIndices.y * 4.0;\n float channel = floor(row);\n row = fract(row);\n vColor = component * vec4(bvec4(channel == 0.0, channel == 1.0, channel == 2.0, channel == 3.0));\n gl_Position = vec4(col * 2.0 - 1.0, row * 2.0 - 1.0, 0.0, 1.0);\n #endif\n gl_PointSize = 1.0;\n}\n";
14
- const AGGREGATE_FS = "#define SHADER_NAME data-filter-fragment-shader\nprecision highp float;\n\nvarying vec4 vColor;\n\nvoid main() {\n if (dataFilter_value < 0.5) {\n discard;\n }\n gl_FragColor = vColor;\n}\n";
17
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
18
+
19
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
20
+
21
+ var AGGREGATE_VS = "#define SHADER_NAME data-filter-vertex-shader\n\n#ifdef FLOAT_TARGET\n attribute float filterIndices;\n attribute float filterPrevIndices;\n#else\n attribute vec2 filterIndices;\n attribute vec2 filterPrevIndices;\n#endif\n\nvarying vec4 vColor;\nconst float component = 1.0 / 255.0;\n\nvoid main() {\n #ifdef FLOAT_TARGET\n dataFilter_value *= float(filterIndices != filterPrevIndices);\n gl_Position = vec4(0.0, 0.0, 0.0, 1.0);\n vColor = vec4(0.0, 0.0, 0.0, 1.0);\n #else\n // Float texture is not supported: pack result into 4 channels x 256 px x 64px\n dataFilter_value *= float(filterIndices.x != filterPrevIndices.x);\n float col = filterIndices.x;\n float row = filterIndices.y * 4.0;\n float channel = floor(row);\n row = fract(row);\n vColor = component * vec4(bvec4(channel == 0.0, channel == 1.0, channel == 2.0, channel == 3.0));\n gl_Position = vec4(col * 2.0 - 1.0, row * 2.0 - 1.0, 0.0, 1.0);\n #endif\n gl_PointSize = 1.0;\n}\n";
22
+ var AGGREGATE_FS = "#define SHADER_NAME data-filter-fragment-shader\nprecision highp float;\n\nvarying vec4 vColor;\n\nvoid main() {\n if (dataFilter_value < 0.5) {\n discard;\n }\n gl_FragColor = vColor;\n}\n";
15
23
 
16
24
  function supportsFloatTarget(gl) {
17
25
  return gl.getExtension('EXT_float_blend') && (gl.getExtension('EXT_color_buffer_float') || gl.getExtension('WEBGL_color_buffer_float'));
@@ -22,13 +30,11 @@ function getFramebuffer(gl, useFloatTarget) {
22
30
  return new _core.Framebuffer(gl, {
23
31
  width: 1,
24
32
  height: 1,
25
- attachments: {
26
- [36064]: new _core.Texture2D(gl, {
27
- format: (0, _core.isWebGL2)(gl) ? 34836 : 6408,
28
- type: 5126,
29
- mipmaps: false
30
- })
31
- }
33
+ attachments: (0, _defineProperty2.default)({}, 36064, new _core.Texture2D(gl, {
34
+ format: (0, _core.isWebGL2)(gl) ? 34836 : 6408,
35
+ type: 5126,
36
+ mipmaps: false
37
+ }))
32
38
  });
33
39
  }
34
40
 
@@ -46,18 +52,17 @@ function getModel(gl, shaderOptions, useFloatTarget) {
46
52
  shaderOptions.defines.FLOAT_TARGET = 1;
47
53
  }
48
54
 
49
- return new _core.Model(gl, {
55
+ return new _core.Model(gl, _objectSpread({
50
56
  id: 'data-filter-aggregation-model',
51
57
  vertexCount: 1,
52
58
  isInstanced: false,
53
59
  drawMode: 0,
54
60
  vs: AGGREGATE_VS,
55
- fs: AGGREGATE_FS,
56
- ...shaderOptions
57
- });
61
+ fs: AGGREGATE_FS
62
+ }, shaderOptions));
58
63
  }
59
64
 
60
- const parameters = {
65
+ var parameters = {
61
66
  blend: true,
62
67
  blendFunc: [1, 1, 1, 1],
63
68
  blendEquation: [32774, 32774],