globe.gl 2.34.2 → 2.34.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/globe.gl.js CHANGED
@@ -1,4 +1,4 @@
1
- // Version 2.34.2 globe.gl - https://github.com/vasturiano/globe.gl
1
+ // Version 2.34.4 globe.gl - https://github.com/vasturiano/globe.gl
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
4
4
  typeof define === 'function' && define.amd ? define(factory) :
@@ -43,7 +43,7 @@
43
43
  function _arrayWithoutHoles$5(r) {
44
44
  if (Array.isArray(r)) return _arrayLikeToArray$7(r);
45
45
  }
46
- function _defineProperty$3(e, r, t) {
46
+ function _defineProperty$2(e, r, t) {
47
47
  return (r = _toPropertyKey$4(r)) in e ? Object.defineProperty(e, r, {
48
48
  value: t,
49
49
  enumerable: !0,
@@ -57,7 +57,7 @@
57
57
  function _nonIterableSpread$5() {
58
58
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
59
59
  }
60
- function ownKeys$2(e, r) {
60
+ function ownKeys$1(e, r) {
61
61
  var t = Object.keys(e);
62
62
  if (Object.getOwnPropertySymbols) {
63
63
  var o = Object.getOwnPropertySymbols(e);
@@ -67,29 +67,29 @@
67
67
  }
68
68
  return t;
69
69
  }
70
- function _objectSpread2$2(e) {
70
+ function _objectSpread2$1(e) {
71
71
  for (var r = 1; r < arguments.length; r++) {
72
72
  var t = null != arguments[r] ? arguments[r] : {};
73
- r % 2 ? ownKeys$2(Object(t), !0).forEach(function (r) {
74
- _defineProperty$3(e, r, t[r]);
75
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function (r) {
73
+ r % 2 ? ownKeys$1(Object(t), !0).forEach(function (r) {
74
+ _defineProperty$2(e, r, t[r]);
75
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) {
76
76
  Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
77
77
  });
78
78
  }
79
79
  return e;
80
80
  }
81
- function _objectWithoutProperties$3(e, t) {
81
+ function _objectWithoutProperties$2(e, t) {
82
82
  if (null == e) return {};
83
83
  var o,
84
84
  r,
85
- i = _objectWithoutPropertiesLoose$3(e, t);
85
+ i = _objectWithoutPropertiesLoose$2(e, t);
86
86
  if (Object.getOwnPropertySymbols) {
87
87
  var s = Object.getOwnPropertySymbols(e);
88
88
  for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
89
89
  }
90
90
  return i;
91
91
  }
92
- function _objectWithoutPropertiesLoose$3(r, e) {
92
+ function _objectWithoutPropertiesLoose$2(r, e) {
93
93
  if (null == r) return {};
94
94
  var t = {};
95
95
  for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
@@ -29250,7 +29250,7 @@
29250
29250
 
29251
29251
  }
29252
29252
 
29253
- let _id$8 = 0;
29253
+ let _id$9 = 0;
29254
29254
 
29255
29255
  class WebGLShaderCache {
29256
29256
 
@@ -29364,7 +29364,7 @@
29364
29364
 
29365
29365
  constructor( code ) {
29366
29366
 
29367
- this.id = _id$8 ++;
29367
+ this.id = _id$9 ++;
29368
29368
 
29369
29369
  this.code = code;
29370
29370
  this.usedTimes = 0;
@@ -40947,10 +40947,10 @@ void main() {
40947
40947
  function _arrayWithHoles$6(r) {
40948
40948
  if (Array.isArray(r)) return r;
40949
40949
  }
40950
- function _classCallCheck$3(a, n) {
40950
+ function _classCallCheck$4(a, n) {
40951
40951
  if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
40952
40952
  }
40953
- function _createClass$3(e, r, t) {
40953
+ function _createClass$4(e, r, t) {
40954
40954
  return Object.defineProperty(e, "prototype", {
40955
40955
  writable: !1
40956
40956
  }), e;
@@ -40993,14 +40993,14 @@ void main() {
40993
40993
  }
40994
40994
  }
40995
40995
 
40996
- var Prop = /*#__PURE__*/_createClass$3(function Prop(name, _ref) {
40996
+ var Prop = /*#__PURE__*/_createClass$4(function Prop(name, _ref) {
40997
40997
  var _ref$default = _ref["default"],
40998
40998
  defaultVal = _ref$default === void 0 ? null : _ref$default,
40999
40999
  _ref$triggerUpdate = _ref.triggerUpdate,
41000
41000
  triggerUpdate = _ref$triggerUpdate === void 0 ? true : _ref$triggerUpdate,
41001
41001
  _ref$onChange = _ref.onChange,
41002
41002
  onChange = _ref$onChange === void 0 ? function (newVal, state) {} : _ref$onChange;
41003
- _classCallCheck$3(this, Prop);
41003
+ _classCallCheck$4(this, Prop);
41004
41004
  this.name = name;
41005
41005
  this.defaultVal = defaultVal;
41006
41006
  this.triggerUpdate = triggerUpdate;
@@ -45293,10 +45293,10 @@ void main() {
45293
45293
  function _callSuper$2(t, o, e) {
45294
45294
  return o = _getPrototypeOf$3(o), _possibleConstructorReturn$2(t, _isNativeReflectConstruct$3() ? Reflect.construct(o, [], _getPrototypeOf$3(t).constructor) : o.apply(t, e));
45295
45295
  }
45296
- function _classCallCheck$2(a, n) {
45296
+ function _classCallCheck$3(a, n) {
45297
45297
  if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
45298
45298
  }
45299
- function _createClass$2(e, r, t) {
45299
+ function _createClass$3(e, r, t) {
45300
45300
  return Object.defineProperty(e, "prototype", {
45301
45301
  writable: !1
45302
45302
  }), e;
@@ -45461,7 +45461,7 @@ void main() {
45461
45461
  var _this;
45462
45462
  var radius = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
45463
45463
  var resolution = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 5;
45464
- _classCallCheck$2(this, GeoJsonGeometry);
45464
+ _classCallCheck$3(this, GeoJsonGeometry);
45465
45465
  _this = _callSuper$2(this, GeoJsonGeometry);
45466
45466
  _this.type = 'GeoJsonGeometry';
45467
45467
  _this.parameters = {
@@ -45623,7 +45623,7 @@ void main() {
45623
45623
  return _this;
45624
45624
  }
45625
45625
  _inherits$2(GeoJsonGeometry, _THREE$BufferGeometry);
45626
- return _createClass$2(GeoJsonGeometry);
45626
+ return _createClass$3(GeoJsonGeometry);
45627
45627
  }(THREE$k.BufferGeometry); //
45628
45628
  function concatGroup(main, extra) {
45629
45629
  var prevVertCnt = Math.round(main.vertices.length / 3);
@@ -48629,6 +48629,36 @@ void main() {
48629
48629
  function _arrayWithoutHoles$4(r) {
48630
48630
  if (Array.isArray(r)) return _arrayLikeToArray$4(r);
48631
48631
  }
48632
+ function _assertClassBrand$1(e, t, n) {
48633
+ if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
48634
+ throw new TypeError("Private element is not present on this object");
48635
+ }
48636
+ function _checkPrivateRedeclaration$1(e, t) {
48637
+ if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object");
48638
+ }
48639
+ function _classCallCheck$2(a, n) {
48640
+ if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
48641
+ }
48642
+ function _classPrivateFieldGet2$1(s, a) {
48643
+ return s.get(_assertClassBrand$1(s, a));
48644
+ }
48645
+ function _classPrivateFieldInitSpec$1(e, t, a) {
48646
+ _checkPrivateRedeclaration$1(e, t), t.set(e, a);
48647
+ }
48648
+ function _classPrivateFieldSet2$1(s, a, r) {
48649
+ return s.set(_assertClassBrand$1(s, a), r), r;
48650
+ }
48651
+ function _defineProperties$1(e, r) {
48652
+ for (var t = 0; t < r.length; t++) {
48653
+ var o = r[t];
48654
+ o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey$3(o.key), o);
48655
+ }
48656
+ }
48657
+ function _createClass$2(e, r, t) {
48658
+ return r && _defineProperties$1(e.prototype, r), Object.defineProperty(e, "prototype", {
48659
+ writable: !1
48660
+ }), e;
48661
+ }
48632
48662
  function _iterableToArray$4(r) {
48633
48663
  if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
48634
48664
  }
@@ -48662,26 +48692,6 @@ void main() {
48662
48692
  function _nonIterableSpread$4() {
48663
48693
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
48664
48694
  }
48665
- function _objectWithoutProperties$2(e, t) {
48666
- if (null == e) return {};
48667
- var o,
48668
- r,
48669
- i = _objectWithoutPropertiesLoose$2(e, t);
48670
- if (Object.getOwnPropertySymbols) {
48671
- var s = Object.getOwnPropertySymbols(e);
48672
- for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
48673
- }
48674
- return i;
48675
- }
48676
- function _objectWithoutPropertiesLoose$2(r, e) {
48677
- if (null == r) return {};
48678
- var t = {};
48679
- for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
48680
- if (e.includes(n)) continue;
48681
- t[n] = r[n];
48682
- }
48683
- return t;
48684
- }
48685
48695
  function _slicedToArray$4(r, e) {
48686
48696
  return _arrayWithHoles$4(r) || _iterableToArrayLimit$4(r, e) || _unsupportedIterableToArray$4(r, e) || _nonIterableRest$4();
48687
48697
  }
@@ -48692,7 +48702,7 @@ void main() {
48692
48702
  if ("object" != typeof t || !t) return t;
48693
48703
  var e = t[Symbol.toPrimitive];
48694
48704
  if (void 0 !== e) {
48695
- var i = e.call(t, r );
48705
+ var i = e.call(t, r);
48696
48706
  if ("object" != typeof i) return i;
48697
48707
  throw new TypeError("@@toPrimitive must return a primitive value.");
48698
48708
  }
@@ -48710,367 +48720,106 @@ void main() {
48710
48720
  }
48711
48721
  }
48712
48722
 
48713
- var index = (function () {
48714
- var list = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
48715
- var keyAccessors = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
48716
- var multiItem = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
48717
- var flattenKeys = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
48718
- var keys = (keyAccessors instanceof Array ? keyAccessors.length ? keyAccessors : [undefined] : [keyAccessors]).map(function (key) {
48719
- return {
48720
- keyAccessor: key,
48721
- isProp: !(key instanceof Function)
48722
- };
48723
- });
48724
- var indexedResult = list.reduce(function (res, item) {
48725
- var iterObj = res;
48726
- var itemVal = item;
48727
- keys.forEach(function (_ref, idx) {
48728
- var keyAccessor = _ref.keyAccessor,
48729
- isProp = _ref.isProp;
48730
- var key;
48731
- if (isProp) {
48732
- var _itemVal = itemVal,
48733
- propVal = _itemVal[keyAccessor],
48734
- rest = _objectWithoutProperties$2(_itemVal, [keyAccessor].map(_toPropertyKey$3));
48735
- key = propVal;
48736
- itemVal = rest;
48737
- } else {
48738
- key = keyAccessor(itemVal, idx);
48739
- }
48740
- if (idx + 1 < keys.length) {
48741
- if (!iterObj.hasOwnProperty(key)) {
48742
- iterObj[key] = {};
48743
- }
48744
- iterObj = iterObj[key];
48745
- } else {
48746
- // Leaf key
48747
- if (multiItem) {
48748
- if (!iterObj.hasOwnProperty(key)) {
48749
- iterObj[key] = [];
48750
- }
48751
- iterObj[key].push(itemVal);
48752
- } else {
48753
- iterObj[key] = itemVal;
48754
- }
48755
- }
48723
+ var _dataMap = /*#__PURE__*/new WeakMap();
48724
+ var _objMap = /*#__PURE__*/new WeakMap();
48725
+ var _id$8 = /*#__PURE__*/new WeakMap();
48726
+ var _createObj = /*#__PURE__*/new WeakMap();
48727
+ var _updateObj = /*#__PURE__*/new WeakMap();
48728
+ var _removeObj = /*#__PURE__*/new WeakMap();
48729
+ var DataBindMapper = /*#__PURE__*/function () {
48730
+ function DataBindMapper() {
48731
+ _classCallCheck$2(this, DataBindMapper);
48732
+ _classPrivateFieldInitSpec$1(this, _dataMap, new Map());
48733
+ _classPrivateFieldInitSpec$1(this, _objMap, new Map());
48734
+ _classPrivateFieldInitSpec$1(this, _id$8, function (d) {
48735
+ return d;
48756
48736
  });
48757
- return res;
48758
- }, {});
48759
- if (multiItem instanceof Function) {
48760
- // Reduce leaf multiple values
48761
- (function reduce(node) {
48762
- var level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
48763
- if (level === keys.length) {
48764
- Object.keys(node).forEach(function (k) {
48765
- return node[k] = multiItem(node[k]);
48766
- });
48767
- } else {
48768
- Object.values(node).forEach(function (child) {
48769
- return reduce(child, level + 1);
48770
- });
48771
- }
48772
- })(indexedResult); // IIFE
48737
+ _classPrivateFieldInitSpec$1(this, _createObj, function () {
48738
+ return {};
48739
+ });
48740
+ _classPrivateFieldInitSpec$1(this, _updateObj, function () {});
48741
+ _classPrivateFieldInitSpec$1(this, _removeObj, function () {});
48773
48742
  }
48774
- var result = indexedResult;
48775
- if (flattenKeys) {
48776
- // flatten into array
48777
- result = [];
48778
- (function flatten(node) {
48779
- var accKeys = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
48780
- if (accKeys.length === keys.length) {
48781
- result.push({
48782
- keys: accKeys,
48783
- vals: node
48784
- });
48785
- } else {
48786
- Object.entries(node).forEach(function (_ref2) {
48787
- var _ref3 = _slicedToArray$4(_ref2, 2),
48788
- key = _ref3[0],
48789
- val = _ref3[1];
48790
- return flatten(val, [].concat(_toConsumableArray$4(accKeys), [key]));
48791
- });
48792
- }
48793
- })(indexedResult); //IIFE
48794
-
48795
- if (keyAccessors instanceof Array && keyAccessors.length === 0 && result.length === 1) {
48796
- // clear keys if there's no key accessors (single result)
48797
- result[0].keys = [];
48743
+ return _createClass$2(DataBindMapper, [{
48744
+ key: "getObj",
48745
+ value: function getObj(d) {
48746
+ return _classPrivateFieldGet2$1(_dataMap, this).get(_classPrivateFieldGet2$1(_id$8, this).call(this, d));
48798
48747
  }
48799
- }
48800
- return result;
48801
- });
48802
-
48803
- function _iterableToArrayLimit$3(arr, i) {
48804
- var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
48805
- if (null != _i) {
48806
- var _s,
48807
- _e,
48808
- _x,
48809
- _r,
48810
- _arr = [],
48811
- _n = !0,
48812
- _d = !1;
48813
- try {
48814
- if (_x = (_i = _i.call(arr)).next, 0 === i) ; else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
48815
- } catch (err) {
48816
- _d = !0, _e = err;
48817
- } finally {
48818
- try {
48819
- if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return;
48820
- } finally {
48821
- if (_d) throw _e;
48822
- }
48748
+ }, {
48749
+ key: "getData",
48750
+ value: function getData(o) {
48751
+ return _classPrivateFieldGet2$1(_objMap, this).get(o);
48823
48752
  }
48824
- return _arr;
48825
- }
48826
- }
48827
- function ownKeys$1(object, enumerableOnly) {
48828
- var keys = Object.keys(object);
48829
- if (Object.getOwnPropertySymbols) {
48830
- var symbols = Object.getOwnPropertySymbols(object);
48831
- enumerableOnly && (symbols = symbols.filter(function (sym) {
48832
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
48833
- })), keys.push.apply(keys, symbols);
48834
- }
48835
- return keys;
48836
- }
48837
- function _objectSpread2$1(target) {
48838
- for (var i = 1; i < arguments.length; i++) {
48839
- var source = null != arguments[i] ? arguments[i] : {};
48840
- i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) {
48841
- _defineProperty$2(target, key, source[key]);
48842
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) {
48843
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
48844
- });
48845
- }
48846
- return target;
48847
- }
48848
- function _defineProperty$2(obj, key, value) {
48849
- key = _toPropertyKey$2(key);
48850
- if (key in obj) {
48851
- Object.defineProperty(obj, key, {
48852
- value: value,
48853
- enumerable: true,
48854
- configurable: true,
48855
- writable: true
48856
- });
48857
- } else {
48858
- obj[key] = value;
48859
- }
48860
- return obj;
48861
- }
48862
- function _objectWithoutPropertiesLoose$1(source, excluded) {
48863
- if (source == null) return {};
48864
- var target = {};
48865
- var sourceKeys = Object.keys(source);
48866
- var key, i;
48867
- for (i = 0; i < sourceKeys.length; i++) {
48868
- key = sourceKeys[i];
48869
- if (excluded.indexOf(key) >= 0) continue;
48870
- target[key] = source[key];
48871
- }
48872
- return target;
48873
- }
48874
- function _objectWithoutProperties$1(source, excluded) {
48875
- if (source == null) return {};
48876
- var target = _objectWithoutPropertiesLoose$1(source, excluded);
48877
- var key, i;
48878
- if (Object.getOwnPropertySymbols) {
48879
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
48880
- for (i = 0; i < sourceSymbolKeys.length; i++) {
48881
- key = sourceSymbolKeys[i];
48882
- if (excluded.indexOf(key) >= 0) continue;
48883
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
48884
- target[key] = source[key];
48753
+ }, {
48754
+ key: "entries",
48755
+ value: function entries() {
48756
+ return _toConsumableArray$4(_classPrivateFieldGet2$1(_objMap, this).entries()).map(function (_ref) {
48757
+ var _ref2 = _slicedToArray$4(_ref, 2),
48758
+ o = _ref2[0],
48759
+ d = _ref2[1];
48760
+ return [d, o];
48761
+ });
48885
48762
  }
48886
- }
48887
- return target;
48888
- }
48889
- function _slicedToArray$3(arr, i) {
48890
- return _arrayWithHoles$3(arr) || _iterableToArrayLimit$3(arr, i) || _unsupportedIterableToArray$3(arr, i) || _nonIterableRest$3();
48891
- }
48892
- function _toConsumableArray$3(arr) {
48893
- return _arrayWithoutHoles$3(arr) || _iterableToArray$3(arr) || _unsupportedIterableToArray$3(arr) || _nonIterableSpread$3();
48894
- }
48895
- function _arrayWithoutHoles$3(arr) {
48896
- if (Array.isArray(arr)) return _arrayLikeToArray$3(arr);
48897
- }
48898
- function _arrayWithHoles$3(arr) {
48899
- if (Array.isArray(arr)) return arr;
48900
- }
48901
- function _iterableToArray$3(iter) {
48902
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
48903
- }
48904
- function _unsupportedIterableToArray$3(o, minLen) {
48905
- if (!o) return;
48906
- if (typeof o === "string") return _arrayLikeToArray$3(o, minLen);
48907
- var n = Object.prototype.toString.call(o).slice(8, -1);
48908
- if (n === "Object" && o.constructor) n = o.constructor.name;
48909
- if (n === "Map" || n === "Set") return Array.from(o);
48910
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$3(o, minLen);
48911
- }
48912
- function _arrayLikeToArray$3(arr, len) {
48913
- if (len == null || len > arr.length) len = arr.length;
48914
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
48915
- return arr2;
48916
- }
48917
- function _nonIterableSpread$3() {
48918
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
48919
- }
48920
- function _nonIterableRest$3() {
48921
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
48922
- }
48923
- function _toPrimitive$2(input, hint) {
48924
- if (typeof input !== "object" || input === null) return input;
48925
- var prim = input[Symbol.toPrimitive];
48926
- if (prim !== undefined) {
48927
- var res = prim.call(input, hint || "default");
48928
- if (typeof res !== "object") return res;
48929
- throw new TypeError("@@toPrimitive must return a primitive value.");
48930
- }
48931
- return (hint === "string" ? String : Number)(input);
48932
- }
48933
- function _toPropertyKey$2(arg) {
48934
- var key = _toPrimitive$2(arg, "string");
48935
- return typeof key === "symbol" ? key : String(key);
48936
- }
48937
-
48938
- var _excluded$2 = ["createObj", "updateObj", "exitObj", "objBindAttr", "dataBindAttr"];
48939
- function diffArrays(prev, next, idAccessor) {
48940
- var result = {
48941
- enter: [],
48942
- update: [],
48943
- exit: []
48944
- };
48945
- if (!idAccessor) {
48946
- // use object references for comparison
48947
- var prevSet = new Set(prev);
48948
- var nextSet = new Set(next);
48949
- new Set([].concat(_toConsumableArray$3(prevSet), _toConsumableArray$3(nextSet))).forEach(function (item) {
48950
- var type = !prevSet.has(item) ? 'enter' : !nextSet.has(item) ? 'exit' : 'update';
48951
- result[type].push(type === 'update' ? [item, item] : item);
48952
- });
48953
- } else {
48954
- // compare by id (duplicate keys are ignored)
48955
- var prevById = index(prev, idAccessor, false);
48956
- var nextById = index(next, idAccessor, false);
48957
- var byId = Object.assign({}, prevById, nextById);
48958
- Object.entries(byId).forEach(function (_ref) {
48959
- var _ref2 = _slicedToArray$3(_ref, 2),
48960
- id = _ref2[0],
48961
- item = _ref2[1];
48962
- var type = !prevById.hasOwnProperty(id) ? 'enter' : !nextById.hasOwnProperty(id) ? 'exit' : 'update';
48963
- result[type].push(type === 'update' ? [prevById[id], nextById[id]] : item);
48964
- });
48965
- }
48966
- return result;
48967
- }
48968
- function dataBindDiff(data, existingObjs, _ref3) {
48969
- var _ref3$objBindAttr = _ref3.objBindAttr,
48970
- objBindAttr = _ref3$objBindAttr === void 0 ? '__obj' : _ref3$objBindAttr,
48971
- _ref3$dataBindAttr = _ref3.dataBindAttr,
48972
- dataBindAttr = _ref3$dataBindAttr === void 0 ? '__data' : _ref3$dataBindAttr,
48973
- idAccessor = _ref3.idAccessor,
48974
- _ref3$purge = _ref3.purge,
48975
- purge = _ref3$purge === void 0 ? false : _ref3$purge;
48976
- var isObjValid = function isObjValid(obj) {
48977
- return obj.hasOwnProperty(dataBindAttr);
48978
- };
48979
- var removeObjs = existingObjs.filter(function (obj) {
48980
- return !isObjValid(obj);
48981
- });
48982
- var prevD = existingObjs.filter(isObjValid).map(function (obj) {
48983
- return obj[dataBindAttr];
48984
- });
48985
- var nextD = data;
48986
- var diff = purge ? {
48987
- enter: nextD,
48988
- exit: prevD,
48989
- update: []
48990
- } // don't diff data in purge mode
48991
- : diffArrays(prevD, nextD, idAccessor);
48992
- diff.update = diff.update.map(function (_ref4) {
48993
- var _ref5 = _slicedToArray$3(_ref4, 2),
48994
- prevD = _ref5[0],
48995
- nextD = _ref5[1];
48996
- if (prevD !== nextD) {
48997
- // transfer obj to new data point (if different)
48998
- nextD[objBindAttr] = prevD[objBindAttr];
48999
- nextD[objBindAttr][dataBindAttr] = nextD;
48763
+ }, {
48764
+ key: "id",
48765
+ value: function id(p) {
48766
+ _classPrivateFieldSet2$1(_id$8, this, index$1(p));
48767
+ return this;
49000
48768
  }
49001
- return nextD;
49002
- });
49003
- diff.exit = diff.exit.concat(removeObjs.map(function (obj) {
49004
- return _defineProperty$2({}, objBindAttr, obj);
49005
- }));
49006
- return diff;
49007
- }
49008
- function viewDigest(data, existingObjs,
49009
- // list
49010
- appendObj,
49011
- // item => {...} function
49012
- removeObj, // item => {...} function
49013
- _ref7) {
49014
- var _ref7$createObj = _ref7.createObj,
49015
- createObj = _ref7$createObj === void 0 ? function (d) {
49016
- return {};
49017
- } : _ref7$createObj,
49018
- _ref7$updateObj = _ref7.updateObj,
49019
- updateObj = _ref7$updateObj === void 0 ? function (obj, d) {} : _ref7$updateObj,
49020
- _ref7$exitObj = _ref7.exitObj,
49021
- exitObj = _ref7$exitObj === void 0 ? function (obj) {} : _ref7$exitObj,
49022
- _ref7$objBindAttr = _ref7.objBindAttr,
49023
- objBindAttr = _ref7$objBindAttr === void 0 ? '__obj' : _ref7$objBindAttr,
49024
- _ref7$dataBindAttr = _ref7.dataBindAttr,
49025
- dataBindAttr = _ref7$dataBindAttr === void 0 ? '__data' : _ref7$dataBindAttr,
49026
- dataDiffOptions = _objectWithoutProperties$1(_ref7, _excluded$2);
49027
- var _dataBindDiff = dataBindDiff(data, existingObjs, _objectSpread2$1({
49028
- objBindAttr: objBindAttr,
49029
- dataBindAttr: dataBindAttr
49030
- }, dataDiffOptions)),
49031
- enter = _dataBindDiff.enter,
49032
- update = _dataBindDiff.update,
49033
- exit = _dataBindDiff.exit;
49034
-
49035
- // Remove exiting points
49036
- exit.forEach(function (d) {
49037
- var obj = d[objBindAttr];
49038
- delete d[objBindAttr]; // unbind obj
49039
-
49040
- exitObj(obj);
49041
- removeObj(obj);
49042
- });
49043
- var newObjs = createObjs(enter);
49044
- var pointsData = [].concat(_toConsumableArray$3(enter), _toConsumableArray$3(update));
49045
- updateObjs(pointsData);
49046
-
49047
- // Add new points
49048
- newObjs.forEach(appendObj);
49049
-
49050
- //
49051
-
49052
- function createObjs(data) {
49053
- var newObjs = [];
49054
- data.forEach(function (d) {
49055
- var obj = createObj(d);
49056
- if (obj) {
49057
- obj[dataBindAttr] = d;
49058
- d[objBindAttr] = obj;
49059
- newObjs.push(obj);
49060
- }
49061
- });
49062
- return newObjs;
49063
- }
49064
- function updateObjs(data) {
49065
- data.forEach(function (d) {
49066
- var obj = d[objBindAttr];
49067
- if (obj) {
49068
- obj[dataBindAttr] = d;
49069
- updateObj(obj, d);
49070
- }
49071
- });
49072
- }
49073
- }
48769
+ }, {
48770
+ key: "onCreateObj",
48771
+ value: function onCreateObj(fn) {
48772
+ _classPrivateFieldSet2$1(_createObj, this, fn);
48773
+ return this;
48774
+ }
48775
+ }, {
48776
+ key: "onUpdateObj",
48777
+ value: function onUpdateObj(fn) {
48778
+ _classPrivateFieldSet2$1(_updateObj, this, fn);
48779
+ return this;
48780
+ }
48781
+ }, {
48782
+ key: "onRemoveObj",
48783
+ value: function onRemoveObj(fn) {
48784
+ _classPrivateFieldSet2$1(_removeObj, this, fn);
48785
+ return this;
48786
+ }
48787
+ }, {
48788
+ key: "digest",
48789
+ value: function digest(data) {
48790
+ var _this = this;
48791
+ data.filter(function (d) {
48792
+ return !_classPrivateFieldGet2$1(_dataMap, _this).has(_classPrivateFieldGet2$1(_id$8, _this).call(_this, d));
48793
+ }).forEach(function (d) {
48794
+ var obj = _classPrivateFieldGet2$1(_createObj, _this).call(_this, d);
48795
+ _classPrivateFieldGet2$1(_dataMap, _this).set(_classPrivateFieldGet2$1(_id$8, _this).call(_this, d), obj);
48796
+ _classPrivateFieldGet2$1(_objMap, _this).set(obj, d);
48797
+ });
48798
+ var dataIdsMap = new Map(data.map(function (d) {
48799
+ return [_classPrivateFieldGet2$1(_id$8, _this).call(_this, d), d];
48800
+ }));
48801
+ _classPrivateFieldGet2$1(_dataMap, this).entries().forEach(function (_ref3) {
48802
+ var _ref4 = _slicedToArray$4(_ref3, 2),
48803
+ dId = _ref4[0],
48804
+ o = _ref4[1];
48805
+ if (!dataIdsMap.has(dId)) {
48806
+ _classPrivateFieldGet2$1(_removeObj, _this).call(_this, o, dId);
48807
+ _classPrivateFieldGet2$1(_dataMap, _this)["delete"](dId);
48808
+ _classPrivateFieldGet2$1(_objMap, _this)["delete"](o);
48809
+ } else {
48810
+ _classPrivateFieldGet2$1(_updateObj, _this).call(_this, o, dataIdsMap.get(dId));
48811
+ }
48812
+ });
48813
+ return this;
48814
+ }
48815
+ }, {
48816
+ key: "clear",
48817
+ value: function clear() {
48818
+ this.digest([]);
48819
+ return this;
48820
+ }
48821
+ }]);
48822
+ }();
49074
48823
 
49075
48824
  function getDefaultExportFromCjs (x) {
49076
48825
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
@@ -52018,16 +51767,16 @@ void main() {
52018
51767
  return data ? v(data) : v;
52019
51768
  }
52020
51769
 
52021
- function _arrayLikeToArray$2(r, a) {
51770
+ function _arrayLikeToArray$3(r, a) {
52022
51771
  (null == a || a > r.length) && (a = r.length);
52023
51772
  for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
52024
51773
  return n;
52025
51774
  }
52026
- function _arrayWithHoles$2(r) {
51775
+ function _arrayWithHoles$3(r) {
52027
51776
  if (Array.isArray(r)) return r;
52028
51777
  }
52029
- function _arrayWithoutHoles$2(r) {
52030
- if (Array.isArray(r)) return _arrayLikeToArray$2(r);
51778
+ function _arrayWithoutHoles$3(r) {
51779
+ if (Array.isArray(r)) return _arrayLikeToArray$3(r);
52031
51780
  }
52032
51781
  function _assertThisInitialized$2(e) {
52033
51782
  if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
@@ -52069,10 +51818,10 @@ void main() {
52069
51818
  return !!t;
52070
51819
  })();
52071
51820
  }
52072
- function _iterableToArray$2(r) {
51821
+ function _iterableToArray$3(r) {
52073
51822
  if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
52074
51823
  }
52075
- function _iterableToArrayLimit$2(r, l) {
51824
+ function _iterableToArrayLimit$3(r, l) {
52076
51825
  var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
52077
51826
  if (null != t) {
52078
51827
  var e,
@@ -52096,10 +51845,10 @@ void main() {
52096
51845
  return a;
52097
51846
  }
52098
51847
  }
52099
- function _nonIterableRest$2() {
51848
+ function _nonIterableRest$3() {
52100
51849
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
52101
51850
  }
52102
- function _nonIterableSpread$2() {
51851
+ function _nonIterableSpread$3() {
52103
51852
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
52104
51853
  }
52105
51854
  function _possibleConstructorReturn$1(t, e) {
@@ -52112,17 +51861,17 @@ void main() {
52112
51861
  return t.__proto__ = e, t;
52113
51862
  }, _setPrototypeOf$2(t, e);
52114
51863
  }
52115
- function _slicedToArray$2(r, e) {
52116
- return _arrayWithHoles$2(r) || _iterableToArrayLimit$2(r, e) || _unsupportedIterableToArray$2(r, e) || _nonIterableRest$2();
51864
+ function _slicedToArray$3(r, e) {
51865
+ return _arrayWithHoles$3(r) || _iterableToArrayLimit$3(r, e) || _unsupportedIterableToArray$3(r, e) || _nonIterableRest$3();
52117
51866
  }
52118
- function _toConsumableArray$2(r) {
52119
- return _arrayWithoutHoles$2(r) || _iterableToArray$2(r) || _unsupportedIterableToArray$2(r) || _nonIterableSpread$2();
51867
+ function _toConsumableArray$3(r) {
51868
+ return _arrayWithoutHoles$3(r) || _iterableToArray$3(r) || _unsupportedIterableToArray$3(r) || _nonIterableSpread$3();
52120
51869
  }
52121
- function _unsupportedIterableToArray$2(r, a) {
51870
+ function _unsupportedIterableToArray$3(r, a) {
52122
51871
  if (r) {
52123
- if ("string" == typeof r) return _arrayLikeToArray$2(r, a);
51872
+ if ("string" == typeof r) return _arrayLikeToArray$3(r, a);
52124
51873
  var t = {}.toString.call(r).slice(8, -1);
52125
- return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$2(r, a) : void 0;
51874
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$3(r, a) : void 0;
52126
51875
  }
52127
51876
  }
52128
51877
 
@@ -52133,17 +51882,17 @@ void main() {
52133
51882
  var contour = interpolateContourPoints(polygon, resolution);
52134
51883
  var edgePoints = merge(contour);
52135
51884
  var innerPoints = getInnerGeoPoints(polygon, resolution);
52136
- var points = [].concat(_toConsumableArray$2(edgePoints), _toConsumableArray$2(innerPoints));
51885
+ var points = [].concat(_toConsumableArray$3(edgePoints), _toConsumableArray$3(innerPoints));
52137
51886
  var boundariesGeojson = {
52138
51887
  type: 'Polygon',
52139
51888
  coordinates: polygon
52140
51889
  };
52141
51890
  var _geoBounds = geoBounds(boundariesGeojson),
52142
- _geoBounds2 = _slicedToArray$2(_geoBounds, 2),
52143
- _geoBounds2$ = _slicedToArray$2(_geoBounds2[0], 2),
51891
+ _geoBounds2 = _slicedToArray$3(_geoBounds, 2),
51892
+ _geoBounds2$ = _slicedToArray$3(_geoBounds2[0], 2),
52144
51893
  minLng = _geoBounds2$[0],
52145
51894
  minLat = _geoBounds2$[1],
52146
- _geoBounds2$2 = _slicedToArray$2(_geoBounds2[1], 2),
51895
+ _geoBounds2$2 = _slicedToArray$3(_geoBounds2[1], 2),
52147
51896
  maxLng = _geoBounds2$2[0],
52148
51897
  maxLat = _geoBounds2$2[1];
52149
51898
  var crossesPoleOrAntimeridian = minLng > maxLng // crosses antimeridian
@@ -52155,7 +51904,7 @@ void main() {
52155
51904
  // Use d3-geo-voronoi. Slowest, but most accurate for polygons that cross poles or anti-meridian
52156
51905
  var vt = geoVoronoi(points).triangles(); // geoDelaunay generates more triangles than needed
52157
51906
  var pntMap = new Map(points.map(function (_ref2, idx) {
52158
- var _ref3 = _slicedToArray$2(_ref2, 2),
51907
+ var _ref3 = _slicedToArray$3(_ref2, 2),
52159
51908
  lng = _ref3[0],
52160
51909
  lat = _ref3[1];
52161
51910
  return ["".concat(lng, "-").concat(lat), idx];
@@ -52166,7 +51915,7 @@ void main() {
52166
51915
 
52167
51916
  var inds = [];
52168
51917
  triangle.forEach(function (_ref4) {
52169
- var _ref5 = _slicedToArray$2(_ref4, 2),
51918
+ var _ref5 = _slicedToArray$3(_ref4, 2),
52170
51919
  lng = _ref5[0],
52171
51920
  lat = _ref5[1];
52172
51921
  var k = "".concat(lng, "-").concat(lat);
@@ -52213,7 +51962,7 @@ void main() {
52213
51962
  });
52214
51963
  if (!pointInside(triangleCentroid, boundariesGeojson, crossesPoleOrAntimeridian)) return 1; // continue
52215
51964
  }
52216
- (_indices2 = indices).push.apply(_indices2, _toConsumableArray$2(inds));
51965
+ (_indices2 = indices).push.apply(_indices2, _toConsumableArray$3(inds));
52217
51966
  };
52218
51967
  for (var i = 0, len = delaunay.triangles.length; i < len; i += 3) {
52219
51968
  if (_loop(i)) continue;
@@ -52228,7 +51977,7 @@ void main() {
52228
51977
  return d[1];
52229
51978
  }), [0, 1]);
52230
51979
  var uvs = points.map(function (_ref6) {
52231
- var _ref7 = _slicedToArray$2(_ref6, 2),
51980
+ var _ref7 = _slicedToArray$3(_ref6, 2),
52232
51981
  lng = _ref7[0],
52233
51982
  lat = _ref7[1];
52234
51983
  return [lngUvScale(lng), latUvScale(lat)];
@@ -52272,11 +52021,11 @@ void main() {
52272
52021
  coordinates: polygon
52273
52022
  };
52274
52023
  var _geoBounds3 = geoBounds(boundariesGeojson),
52275
- _geoBounds4 = _slicedToArray$2(_geoBounds3, 2),
52276
- _geoBounds4$ = _slicedToArray$2(_geoBounds4[0], 2),
52024
+ _geoBounds4 = _slicedToArray$3(_geoBounds3, 2),
52025
+ _geoBounds4$ = _slicedToArray$3(_geoBounds4[0], 2),
52277
52026
  minLng = _geoBounds4$[0],
52278
52027
  minLat = _geoBounds4$[1],
52279
- _geoBounds4$2 = _slicedToArray$2(_geoBounds4[1], 2),
52028
+ _geoBounds4$2 = _slicedToArray$3(_geoBounds4[1], 2),
52280
52029
  maxLng = _geoBounds4$2[0],
52281
52030
  maxLat = _geoBounds4$2[1];
52282
52031
 
@@ -52346,12 +52095,12 @@ void main() {
52346
52095
 
52347
52096
  // support both modes for backwards threejs compatibility
52348
52097
  var setAttributeFn = new THREE$j.BufferGeometry().setAttribute ? 'setAttribute' : 'addAttribute';
52349
- var ConicPolygonBufferGeometry = /*#__PURE__*/function (_THREE$BufferGeometry) {
52350
- function ConicPolygonBufferGeometry(polygonGeoJson, startHeight, endHeight, closedBottom, closedTop, includeSides, curvatureResolution) {
52098
+ var ConicPolygonGeometry = /*#__PURE__*/function (_THREE$BufferGeometry) {
52099
+ function ConicPolygonGeometry(polygonGeoJson, startHeight, endHeight, closedBottom, closedTop, includeSides, curvatureResolution) {
52351
52100
  var _this;
52352
- _classCallCheck$1(this, ConicPolygonBufferGeometry);
52353
- _this = _callSuper$1(this, ConicPolygonBufferGeometry);
52354
- _this.type = 'ConicPolygonBufferGeometry';
52101
+ _classCallCheck$1(this, ConicPolygonGeometry);
52102
+ _this = _callSuper$1(this, ConicPolygonGeometry);
52103
+ _this.type = 'ConicPolygonGeometry';
52355
52104
  _this.parameters = {
52356
52105
  polygonGeoJson: polygonGeoJson,
52357
52106
  startHeight: startHeight,
@@ -52409,7 +52158,7 @@ void main() {
52409
52158
  function generateVertices(polygon, altitude) {
52410
52159
  var coords3d = polygon.map(function (coords) {
52411
52160
  return coords.map(function (_ref) {
52412
- var _ref2 = _slicedToArray$2(_ref, 2),
52161
+ var _ref2 = _slicedToArray$3(_ref, 2),
52413
52162
  lng = _ref2[0],
52414
52163
  lat = _ref2[1];
52415
52164
  return polar2Cartesian$1(lat, lng, altitude);
@@ -52462,8 +52211,8 @@ void main() {
52462
52211
  }
52463
52212
  return _this;
52464
52213
  }
52465
- _inherits$1(ConicPolygonBufferGeometry, _THREE$BufferGeometry);
52466
- return _createClass$1(ConicPolygonBufferGeometry);
52214
+ _inherits$1(ConicPolygonGeometry, _THREE$BufferGeometry);
52215
+ return _createClass$1(ConicPolygonGeometry);
52467
52216
  }(THREE$j.BufferGeometry); //
52468
52217
  function polar2Cartesian$1(lat, lng) {
52469
52218
  var r = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
@@ -52477,6 +52226,188 @@ void main() {
52477
52226
  ];
52478
52227
  }
52479
52228
 
52229
+ function _arrayLikeToArray$2(r, a) {
52230
+ (null == a || a > r.length) && (a = r.length);
52231
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
52232
+ return n;
52233
+ }
52234
+ function _arrayWithHoles$2(r) {
52235
+ if (Array.isArray(r)) return r;
52236
+ }
52237
+ function _arrayWithoutHoles$2(r) {
52238
+ if (Array.isArray(r)) return _arrayLikeToArray$2(r);
52239
+ }
52240
+ function _iterableToArray$2(r) {
52241
+ if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
52242
+ }
52243
+ function _iterableToArrayLimit$2(r, l) {
52244
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
52245
+ if (null != t) {
52246
+ var e,
52247
+ n,
52248
+ i,
52249
+ u,
52250
+ a = [],
52251
+ f = !0,
52252
+ o = !1;
52253
+ try {
52254
+ if (i = (t = t.call(r)).next, 0 === l) ; else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
52255
+ } catch (r) {
52256
+ o = !0, n = r;
52257
+ } finally {
52258
+ try {
52259
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
52260
+ } finally {
52261
+ if (o) throw n;
52262
+ }
52263
+ }
52264
+ return a;
52265
+ }
52266
+ }
52267
+ function _nonIterableRest$2() {
52268
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
52269
+ }
52270
+ function _nonIterableSpread$2() {
52271
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
52272
+ }
52273
+ function _objectWithoutProperties$1(e, t) {
52274
+ if (null == e) return {};
52275
+ var o,
52276
+ r,
52277
+ i = _objectWithoutPropertiesLoose$1(e, t);
52278
+ if (Object.getOwnPropertySymbols) {
52279
+ var s = Object.getOwnPropertySymbols(e);
52280
+ for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
52281
+ }
52282
+ return i;
52283
+ }
52284
+ function _objectWithoutPropertiesLoose$1(r, e) {
52285
+ if (null == r) return {};
52286
+ var t = {};
52287
+ for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
52288
+ if (e.includes(n)) continue;
52289
+ t[n] = r[n];
52290
+ }
52291
+ return t;
52292
+ }
52293
+ function _slicedToArray$2(r, e) {
52294
+ return _arrayWithHoles$2(r) || _iterableToArrayLimit$2(r, e) || _unsupportedIterableToArray$2(r, e) || _nonIterableRest$2();
52295
+ }
52296
+ function _toConsumableArray$2(r) {
52297
+ return _arrayWithoutHoles$2(r) || _iterableToArray$2(r) || _unsupportedIterableToArray$2(r) || _nonIterableSpread$2();
52298
+ }
52299
+ function _toPrimitive$2(t, r) {
52300
+ if ("object" != typeof t || !t) return t;
52301
+ var e = t[Symbol.toPrimitive];
52302
+ if (void 0 !== e) {
52303
+ var i = e.call(t, r );
52304
+ if ("object" != typeof i) return i;
52305
+ throw new TypeError("@@toPrimitive must return a primitive value.");
52306
+ }
52307
+ return (String )(t);
52308
+ }
52309
+ function _toPropertyKey$2(t) {
52310
+ var i = _toPrimitive$2(t, "string");
52311
+ return "symbol" == typeof i ? i : i + "";
52312
+ }
52313
+ function _unsupportedIterableToArray$2(r, a) {
52314
+ if (r) {
52315
+ if ("string" == typeof r) return _arrayLikeToArray$2(r, a);
52316
+ var t = {}.toString.call(r).slice(8, -1);
52317
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$2(r, a) : void 0;
52318
+ }
52319
+ }
52320
+
52321
+ var index = (function () {
52322
+ var list = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
52323
+ var keyAccessors = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
52324
+ var multiItem = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
52325
+ var flattenKeys = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
52326
+ var keys = (keyAccessors instanceof Array ? keyAccessors.length ? keyAccessors : [undefined] : [keyAccessors]).map(function (key) {
52327
+ return {
52328
+ keyAccessor: key,
52329
+ isProp: !(key instanceof Function)
52330
+ };
52331
+ });
52332
+ var indexedResult = list.reduce(function (res, item) {
52333
+ var iterObj = res;
52334
+ var itemVal = item;
52335
+ keys.forEach(function (_ref, idx) {
52336
+ var keyAccessor = _ref.keyAccessor,
52337
+ isProp = _ref.isProp;
52338
+ var key;
52339
+ if (isProp) {
52340
+ var _itemVal = itemVal,
52341
+ propVal = _itemVal[keyAccessor],
52342
+ rest = _objectWithoutProperties$1(_itemVal, [keyAccessor].map(_toPropertyKey$2));
52343
+ key = propVal;
52344
+ itemVal = rest;
52345
+ } else {
52346
+ key = keyAccessor(itemVal, idx);
52347
+ }
52348
+ if (idx + 1 < keys.length) {
52349
+ if (!iterObj.hasOwnProperty(key)) {
52350
+ iterObj[key] = {};
52351
+ }
52352
+ iterObj = iterObj[key];
52353
+ } else {
52354
+ // Leaf key
52355
+ if (multiItem) {
52356
+ if (!iterObj.hasOwnProperty(key)) {
52357
+ iterObj[key] = [];
52358
+ }
52359
+ iterObj[key].push(itemVal);
52360
+ } else {
52361
+ iterObj[key] = itemVal;
52362
+ }
52363
+ }
52364
+ });
52365
+ return res;
52366
+ }, {});
52367
+ if (multiItem instanceof Function) {
52368
+ // Reduce leaf multiple values
52369
+ (function reduce(node) {
52370
+ var level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
52371
+ if (level === keys.length) {
52372
+ Object.keys(node).forEach(function (k) {
52373
+ return node[k] = multiItem(node[k]);
52374
+ });
52375
+ } else {
52376
+ Object.values(node).forEach(function (child) {
52377
+ return reduce(child, level + 1);
52378
+ });
52379
+ }
52380
+ })(indexedResult); // IIFE
52381
+ }
52382
+ var result = indexedResult;
52383
+ if (flattenKeys) {
52384
+ // flatten into array
52385
+ result = [];
52386
+ (function flatten(node) {
52387
+ var accKeys = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
52388
+ if (accKeys.length === keys.length) {
52389
+ result.push({
52390
+ keys: accKeys,
52391
+ vals: node
52392
+ });
52393
+ } else {
52394
+ Object.entries(node).forEach(function (_ref2) {
52395
+ var _ref3 = _slicedToArray$2(_ref2, 2),
52396
+ key = _ref3[0],
52397
+ val = _ref3[1];
52398
+ return flatten(val, [].concat(_toConsumableArray$2(accKeys), [key]));
52399
+ });
52400
+ }
52401
+ })(indexedResult); //IIFE
52402
+
52403
+ if (keyAccessors instanceof Array && keyAccessors.length === 0 && result.length === 1) {
52404
+ // clear keys if there's no key accessors (single result)
52405
+ result[0].keys = [];
52406
+ }
52407
+ }
52408
+ return result;
52409
+ });
52410
+
52480
52411
  // @ts-nocheck
52481
52412
  var libh3 = function (libh3) {
52482
52413
  libh3 = libh3 || {};
@@ -69466,6 +69397,15 @@ void main() {
69466
69397
  writable: !0
69467
69398
  }) : e[r] = t, e;
69468
69399
  }
69400
+ function _get() {
69401
+ return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) {
69402
+ var p = _superPropBase(e, t);
69403
+ if (p) {
69404
+ var n = Object.getOwnPropertyDescriptor(p, t);
69405
+ return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value;
69406
+ }
69407
+ }, _get.apply(null, arguments);
69408
+ }
69469
69409
  function _getPrototypeOf$1(t) {
69470
69410
  return _getPrototypeOf$1 = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
69471
69411
  return t.__proto__ || Object.getPrototypeOf(t);
@@ -69581,6 +69521,16 @@ void main() {
69581
69521
  function _slicedToArray$1(r, e) {
69582
69522
  return _arrayWithHoles$1(r) || _iterableToArrayLimit$1(r, e) || _unsupportedIterableToArray$1(r, e) || _nonIterableRest$1();
69583
69523
  }
69524
+ function _superPropBase(t, o) {
69525
+ for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf$1(t)););
69526
+ return t;
69527
+ }
69528
+ function _superPropGet(t, o, e, r) {
69529
+ var p = _get(_getPrototypeOf$1(t.prototype ), o, e);
69530
+ return "function" == typeof p ? function (t) {
69531
+ return p.apply(e, t);
69532
+ } : p;
69533
+ }
69584
69534
  function _toConsumableArray$1(r) {
69585
69535
  return _arrayWithoutHoles$1(r) || _iterableToArray$1(r) || _unsupportedIterableToArray$1(r) || _nonIterableSpread$1();
69586
69536
  }
@@ -69709,22 +69659,16 @@ void main() {
69709
69659
  Mesh: Mesh,
69710
69660
  ShaderMaterial: ShaderMaterial
69711
69661
  };
69712
- var fragmentShader = "\nuniform vec3 color;\nuniform float coefficient;\nuniform float power;\nvarying vec3 vVertexNormal;\nvarying vec3 vVertexWorldPosition;\nvoid main() {\n vec3 worldCameraToVertex = vVertexWorldPosition - cameraPosition;\n vec3 viewCameraToVertex\t= (viewMatrix * vec4(worldCameraToVertex, 0.0)).xyz;\n viewCameraToVertex = normalize(viewCameraToVertex);\n float intensity\t= pow(\n coefficient + dot(vVertexNormal, viewCameraToVertex),\n power\n );\n gl_FragColor = vec4(color, intensity);\n}";
69713
- var vertexShader = "\nvarying vec3 vVertexWorldPosition;\nvarying vec3 vVertexNormal;\nvoid main() {\n vVertexNormal\t= normalize(normalMatrix * normal);\n vVertexWorldPosition = (modelMatrix * vec4(position, 1.0)).xyz;\n gl_Position\t= projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n";
69714
- var defaultOptions = {
69715
- backside: true,
69716
- coefficient: 0.5,
69717
- color: 'gold',
69718
- size: 2,
69719
- power: 1
69720
- };
69662
+ var vertexShader = "\nuniform float hollowRadius;\n\nvarying vec3 vVertexWorldPosition;\nvarying vec3 vVertexNormal;\nvarying float vCameraDistanceToObjCenter;\nvarying float vVertexAngularDistanceToHollowRadius;\n\nvoid main() { \n vVertexNormal\t= normalize(normalMatrix * normal);\n vVertexWorldPosition = (modelMatrix * vec4(position, 1.0)).xyz;\n \n vec4 objCenterViewPosition = modelViewMatrix * vec4(0.0, 0.0, 0.0, 1.0);\n vCameraDistanceToObjCenter = length(objCenterViewPosition);\n \n float edgeAngle = atan(hollowRadius / vCameraDistanceToObjCenter);\n float vertexAngle = acos(dot(normalize(modelViewMatrix * vec4(position, 1.0)), normalize(objCenterViewPosition)));\n vVertexAngularDistanceToHollowRadius = vertexAngle - edgeAngle;\n\n gl_Position\t= projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}";
69663
+ var fragmentShader = "\nuniform vec3 color;\nuniform float coefficient;\nuniform float power;\nuniform float hollowRadius;\n\nvarying vec3 vVertexNormal;\nvarying vec3 vVertexWorldPosition;\nvarying float vCameraDistanceToObjCenter;\nvarying float vVertexAngularDistanceToHollowRadius;\n\nvoid main() {\n if (vCameraDistanceToObjCenter < hollowRadius) discard; // inside the hollowRadius\n if (vVertexAngularDistanceToHollowRadius < 0.0) discard; // frag position is within the hollow radius\n\n vec3 worldCameraToVertex = vVertexWorldPosition - cameraPosition;\n vec3 viewCameraToVertex\t= (viewMatrix * vec4(worldCameraToVertex, 0.0)).xyz;\n viewCameraToVertex = normalize(viewCameraToVertex);\n float intensity\t= pow(\n coefficient + dot(vVertexNormal, viewCameraToVertex),\n power\n );\n gl_FragColor = vec4(color, intensity);\n}";
69721
69664
 
69722
69665
  // Based off: http://stemkoski.blogspot.fr/2013/07/shaders-in-threejs-glow-and-halo.html
69723
- function createGlowMaterial(coefficient, color, power) {
69666
+ function createGlowMaterial(coefficient, color, power, hollowRadius) {
69724
69667
  return new THREE$h.ShaderMaterial({
69725
69668
  depthWrite: false,
69726
- fragmentShader: fragmentShader,
69727
69669
  transparent: true,
69670
+ vertexShader: vertexShader,
69671
+ fragmentShader: fragmentShader,
69728
69672
  uniforms: {
69729
69673
  coefficient: {
69730
69674
  value: coefficient
@@ -69734,13 +69678,14 @@ void main() {
69734
69678
  },
69735
69679
  power: {
69736
69680
  value: power
69681
+ },
69682
+ hollowRadius: {
69683
+ value: hollowRadius
69737
69684
  }
69738
- },
69739
- vertexShader: vertexShader
69685
+ }
69740
69686
  });
69741
69687
  }
69742
69688
  function createGlowGeometry(geometry, size) {
69743
- // expect BufferGeometry
69744
69689
  var glowGeometry = geometry.clone();
69745
69690
 
69746
69691
  // Resize vertex positions according to normals
@@ -69753,20 +69698,34 @@ void main() {
69753
69698
  glowGeometry.setAttribute('position', new THREE$h.BufferAttribute(position, 3));
69754
69699
  return glowGeometry;
69755
69700
  }
69756
- function createGlowMesh(geometry) {
69757
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultOptions;
69758
- var backside = options.backside,
69759
- coefficient = options.coefficient,
69760
- color = options.color,
69761
- size = options.size,
69762
- power = options.power;
69763
- var glowGeometry = createGlowGeometry(geometry, size);
69764
- var glowMaterial = createGlowMaterial(coefficient, color, power);
69765
- if (backside) {
69766
- glowMaterial.side = THREE$h.BackSide;
69701
+ var GlowMesh = /*#__PURE__*/function (_THREE$Mesh) {
69702
+ function GlowMesh(geometry) {
69703
+ var _this;
69704
+ var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
69705
+ _ref$color = _ref.color,
69706
+ color = _ref$color === void 0 ? 'gold' : _ref$color,
69707
+ _ref$size = _ref.size,
69708
+ size = _ref$size === void 0 ? 2 : _ref$size,
69709
+ _ref$coefficient = _ref.coefficient,
69710
+ coefficient = _ref$coefficient === void 0 ? 0.5 : _ref$coefficient,
69711
+ _ref$power = _ref.power,
69712
+ power = _ref$power === void 0 ? 1 : _ref$power,
69713
+ _ref$hollowRadius = _ref.hollowRadius,
69714
+ hollowRadius = _ref$hollowRadius === void 0 ? 0 : _ref$hollowRadius,
69715
+ _ref$backside = _ref.backside,
69716
+ backside = _ref$backside === void 0 ? true : _ref$backside;
69717
+ _classCallCheck(this, GlowMesh);
69718
+ _this = _callSuper(this, GlowMesh);
69719
+ var glowGeometry = createGlowGeometry(geometry, size);
69720
+ var glowMaterial = createGlowMaterial(coefficient, color, power, hollowRadius);
69721
+ backside && (glowMaterial.side = THREE$h.BackSide);
69722
+ _this.geometry = glowGeometry;
69723
+ _this.material = glowMaterial;
69724
+ return _this;
69767
69725
  }
69768
- return new THREE$h.Mesh(glowGeometry, glowMaterial);
69769
- }
69726
+ _inherits(GlowMesh, _THREE$Mesh);
69727
+ return _createClass(GlowMesh);
69728
+ }(THREE$h.Mesh);
69770
69729
 
69771
69730
  var THREE$g = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
69772
69731
  : {
@@ -69900,13 +69859,12 @@ void main() {
69900
69859
  emptyObject(state.atmosphereObj);
69901
69860
  }
69902
69861
  if (state.atmosphereColor && state.atmosphereAltitude) {
69903
- var obj = state.atmosphereObj = createGlowMesh(state.globeObj.geometry, {
69904
- backside: true,
69862
+ var obj = state.atmosphereObj = new GlowMesh(state.globeObj.geometry, {
69905
69863
  color: state.atmosphereColor,
69906
69864
  size: GLOBE_RADIUS * state.atmosphereAltitude,
69907
- power: 3.5,
69908
- // dispersion
69909
- coefficient: 0.1
69865
+ hollowRadius: GLOBE_RADIUS,
69866
+ coefficient: 0.1,
69867
+ power: 3.5 // dispersion
69910
69868
  });
69911
69869
  obj.visible = !!state.showAtmosphere;
69912
69870
  obj.__globeObjType = 'atmosphere'; // Add object type
@@ -69984,28 +69942,70 @@ void main() {
69984
69942
  return res;
69985
69943
  }
69986
69944
 
69987
- function threeDigest(data, scene) {
69988
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
69989
- var _ref = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {},
69990
- _ref$removeDelay = _ref.removeDelay,
69991
- removeDelay = _ref$removeDelay === void 0 ? 0 : _ref$removeDelay;
69992
- return viewDigest(data, scene.children, function (obj) {
69993
- return scene.add(obj);
69994
- }, function (obj) {
69995
- var removeFn = function removeFn() {
69996
- scene.remove(obj);
69997
- emptyObject(obj);
69998
- obj && obj.hasOwnProperty('__data') && delete obj.__data.__currentTargetD;
69999
- };
70000
- removeDelay ? setTimeout(removeFn, removeDelay) : removeFn();
70001
- }, _objectSpread2({
70002
- objBindAttr: '__threeObj'
70003
- }, options));
70004
- }
69945
+ var _dataBindAttr = /*#__PURE__*/new WeakMap();
69946
+ var _objBindAttr = /*#__PURE__*/new WeakMap();
69947
+ var _removeDelay = /*#__PURE__*/new WeakMap();
69948
+ var ThreeDigest = /*#__PURE__*/function (_DataBindMapper) {
69949
+ function ThreeDigest(scene) {
69950
+ var _this;
69951
+ var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
69952
+ _ref$dataBindAttr = _ref.dataBindAttr,
69953
+ dataBindAttr = _ref$dataBindAttr === void 0 ? '__data' : _ref$dataBindAttr,
69954
+ _ref$objBindAttr = _ref.objBindAttr,
69955
+ objBindAttr = _ref$objBindAttr === void 0 ? '__threeObj' : _ref$objBindAttr,
69956
+ _ref$removeDelay = _ref.removeDelay,
69957
+ removeDelay = _ref$removeDelay === void 0 ? 0 : _ref$removeDelay;
69958
+ _classCallCheck(this, ThreeDigest);
69959
+ _this = _callSuper(this, ThreeDigest);
69960
+ _defineProperty$1(_this, "scene", void 0);
69961
+ _classPrivateFieldInitSpec(_this, _dataBindAttr, void 0);
69962
+ _classPrivateFieldInitSpec(_this, _objBindAttr, void 0);
69963
+ _classPrivateFieldInitSpec(_this, _removeDelay, void 0);
69964
+ _this.scene = scene;
69965
+ _classPrivateFieldSet2(_dataBindAttr, _this, dataBindAttr);
69966
+ _classPrivateFieldSet2(_objBindAttr, _this, objBindAttr);
69967
+ _classPrivateFieldSet2(_removeDelay, _this, removeDelay);
69968
+ _this.onRemoveObj(function () {});
69969
+ return _this;
69970
+ }
69971
+ _inherits(ThreeDigest, _DataBindMapper);
69972
+ return _createClass(ThreeDigest, [{
69973
+ key: "onCreateObj",
69974
+ value: function onCreateObj(fn) {
69975
+ var _this2 = this;
69976
+ _superPropGet(ThreeDigest, "onCreateObj", this)([function (d) {
69977
+ var obj = fn(d);
69978
+ d[_classPrivateFieldGet2(_objBindAttr, _this2)] = obj;
69979
+ obj[_classPrivateFieldGet2(_dataBindAttr, _this2)] = d;
69980
+ _this2.scene.add(obj);
69981
+ return obj;
69982
+ }]);
69983
+ return this;
69984
+ }
69985
+ }, {
69986
+ key: "onRemoveObj",
69987
+ value: function onRemoveObj(fn) {
69988
+ var _this3 = this;
69989
+ _superPropGet(ThreeDigest, "onRemoveObj", this)([function (obj, dId) {
69990
+ var d = _superPropGet(ThreeDigest, "getData", _this3)([obj]);
69991
+ fn(obj, dId);
69992
+ var removeFn = function removeFn() {
69993
+ _this3.scene.remove(obj);
69994
+ emptyObject(obj);
69995
+ delete d[_classPrivateFieldGet2(_objBindAttr, _this3)];
69996
+ delete d.__currentTargetD;
69997
+ };
69998
+ _classPrivateFieldGet2(_removeDelay, _this3) ? setTimeout(removeFn, _classPrivateFieldGet2(_removeDelay, _this3)) : removeFn();
69999
+ }]);
70000
+ return this;
70001
+ }
70002
+ }]);
70003
+ }(DataBindMapper);
70005
70004
 
70006
70005
  var THREE$e = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
70007
70006
  : {
70008
70007
  BufferGeometry: BufferGeometry,
70008
+ Color: Color$1,
70009
70009
  CylinderGeometry: CylinderGeometry,
70010
70010
  Matrix4: Matrix4,
70011
70011
  Mesh: Mesh,
@@ -70064,8 +70064,11 @@ void main() {
70064
70064
  // Main three object to manipulate
70065
70065
  state.scene = threeObj;
70066
70066
  state.tweenGroup = tweenGroup;
70067
+ state.dataMapper = new ThreeDigest(threeObj, {
70068
+ objBindAttr: '__threeObjPoint'
70069
+ });
70067
70070
  },
70068
- update: function update(state) {
70071
+ update: function update(state, changedProps) {
70069
70072
  // Data accessors
70070
70073
  var latAccessor = index$1(state.pointLat);
70071
70074
  var lngAccessor = index$1(state.pointLng);
@@ -70080,18 +70083,16 @@ void main() {
70080
70083
  var pxPerDeg = 2 * Math.PI * GLOBE_RADIUS / 360;
70081
70084
  var pointMaterials = {}; // indexed by color
70082
70085
 
70083
- var scene = state.pointsMerge ? new THREE$e.Object3D() : state.scene; // use fake scene if merging points
70086
+ if (!state.pointsMerge && changedProps.hasOwnProperty('pointsMerge')) {
70087
+ emptyObject(state.scene); // Empty trailing merged objects
70088
+ }
70089
+ state.dataMapper.scene = state.pointsMerge ? new THREE$e.Object3D() : state.scene; // use fake scene if merging points
70084
70090
 
70085
- threeDigest(state.pointsData, scene, {
70086
- createObj: createObj,
70087
- updateObj: updateObj
70088
- });
70091
+ state.dataMapper.onCreateObj(createObj).onUpdateObj(updateObj).digest(state.pointsData);
70089
70092
  if (state.pointsMerge) {
70090
70093
  // merge points into a single mesh
70091
70094
  var pointsGeometry = !state.pointsData.length ? new THREE$e.BufferGeometry() : (BufferGeometryUtils$2.mergeGeometries || BufferGeometryUtils$2.mergeBufferGeometries)(state.pointsData.map(function (d) {
70092
- var obj = d.__threeObj;
70093
- d.__threeObj = undefined; // unbind merged points
70094
-
70095
+ var obj = state.dataMapper.getObj(d);
70095
70096
  var geom = obj.geometry.clone();
70096
70097
 
70097
70098
  // apply mesh world transform to vertices
@@ -70111,6 +70112,7 @@ void main() {
70111
70112
  points.__globeObjType = 'points'; // Add object type
70112
70113
  points.__data = state.pointsData; // Attach obj data
70113
70114
 
70115
+ state.dataMapper.clear(); // Unbind merged points
70114
70116
  emptyObject(state.scene);
70115
70117
  state.scene.add(points);
70116
70118
  }
@@ -70250,6 +70252,7 @@ void main() {
70250
70252
  Line: Line,
70251
70253
  Mesh: Mesh,
70252
70254
  NormalBlending: NormalBlending,
70255
+ QuadraticBezierCurve3: QuadraticBezierCurve3,
70253
70256
  ShaderMaterial: ShaderMaterial,
70254
70257
  TubeGeometry: TubeGeometry,
70255
70258
  Vector3: Vector3
@@ -70329,25 +70332,46 @@ void main() {
70329
70332
  },
70330
70333
  _destructor: function _destructor(state) {
70331
70334
  var _state$ticker3;
70335
+ state.sharedMaterial.dispose();
70332
70336
  (_state$ticker3 = state.ticker) === null || _state$ticker3 === void 0 || _state$ticker3.dispose();
70333
70337
  }
70334
70338
  },
70335
- init: function init(threeObj, state, _ref) {
70339
+ stateInit: function stateInit(_ref) {
70336
70340
  var tweenGroup = _ref.tweenGroup;
70341
+ return {
70342
+ tweenGroup: tweenGroup,
70343
+ ticker: new FrameTicker$2(),
70344
+ sharedMaterial: new THREE$d.ShaderMaterial(_objectSpread2(_objectSpread2({}, dashedLineShaders()), {}, {
70345
+ transparent: true,
70346
+ blending: THREE$d.NormalBlending
70347
+ }))
70348
+ };
70349
+ },
70350
+ init: function init(threeObj, state) {
70337
70351
  // Clear the scene
70338
70352
  emptyObject(threeObj);
70339
70353
 
70340
70354
  // Main three object to manipulate
70341
70355
  state.scene = threeObj;
70342
- state.tweenGroup = tweenGroup;
70356
+ state.dataMapper = new ThreeDigest(threeObj, {
70357
+ objBindAttr: '__threeObjArc'
70358
+ }).onCreateObj(function () {
70359
+ var obj = new THREE$d.Group(); // populated in updateObj
70360
+
70361
+ obj.__globeObjType = 'arc'; // Add object type
70362
+ return obj;
70363
+ });
70343
70364
 
70344
70365
  // Kick-off dash animations
70345
- state.ticker = new FrameTicker$2();
70346
70366
  state.ticker.onTick.add(function (_, timeDelta) {
70347
- state.arcsData.filter(function (d) {
70348
- return d.__threeObj && d.__threeObj.children.length && d.__threeObj.children[0].material && d.__threeObj.children[0].__dashAnimateStep;
70349
- }).forEach(function (d) {
70350
- var obj = d.__threeObj.children[0];
70367
+ state.dataMapper.entries().map(function (_ref2) {
70368
+ var _ref3 = _slicedToArray$1(_ref2, 2),
70369
+ obj = _ref3[1];
70370
+ return obj;
70371
+ }).filter(function (o) {
70372
+ return o.children.length && o.children[0].material && o.children[0].__dashAnimateStep;
70373
+ }).forEach(function (o) {
70374
+ var obj = o.children[0];
70351
70375
  var step = obj.__dashAnimateStep * timeDelta;
70352
70376
  var curTranslate = obj.material.uniforms.dashTranslate.value % 1e9; // reset after 1B loops
70353
70377
  obj.material.uniforms.dashTranslate.value = curTranslate + step;
@@ -70368,118 +70392,106 @@ void main() {
70368
70392
  var dashGapAccessor = index$1(state.arcDashGap);
70369
70393
  var dashInitialGapAccessor = index$1(state.arcDashInitialGap);
70370
70394
  var dashAnimateTimeAccessor = index$1(state.arcDashAnimateTime);
70371
- var sharedMaterial = new THREE$d.ShaderMaterial(_objectSpread2(_objectSpread2({}, dashedLineShaders()), {}, {
70372
- transparent: true,
70373
- blending: THREE$d.NormalBlending
70374
- }));
70375
- threeDigest(state.arcsData, state.scene, {
70376
- createObj: function createObj() {
70377
- var obj = new THREE$d.Group(); // populated in updateObj
70395
+ state.dataMapper.onUpdateObj(function (group, arc) {
70396
+ var stroke = strokeAccessor(arc);
70397
+ var useTube = stroke !== null && stroke !== undefined;
70398
+ if (!group.children.length || useTube !== (group.children[0].type === 'Mesh')) {
70399
+ // create or swap object types
70400
+ emptyObject(group);
70401
+ var _obj = useTube ? new THREE$d.Mesh() : new THREE$d.Line(new THREE$d.BufferGeometry());
70402
+ _obj.material = state.sharedMaterial.clone(); // Separate material instance per object to have dedicated uniforms (but shared shaders)
70403
+
70404
+ group.add(_obj);
70405
+ }
70406
+ var obj = group.children[0];
70378
70407
 
70379
- obj.__globeObjType = 'arc'; // Add object type
70380
- return obj;
70381
- },
70382
- updateObj: function updateObj(group, arc) {
70383
- var stroke = strokeAccessor(arc);
70384
- var useTube = stroke !== null && stroke !== undefined;
70385
- if (!group.children.length || useTube !== (group.children[0].type === 'Mesh')) {
70386
- // create or swap object types
70387
- emptyObject(group);
70388
- var _obj = useTube ? new THREE$d.Mesh() : new THREE$d.Line(new THREE$d.BufferGeometry());
70389
- _obj.material = sharedMaterial.clone(); // Separate material instance per object to have dedicated uniforms (but shared shaders)
70390
-
70391
- group.add(_obj);
70408
+ // set dash uniforms
70409
+ Object.assign(obj.material.uniforms, {
70410
+ dashSize: {
70411
+ value: dashLengthAccessor(arc)
70412
+ },
70413
+ gapSize: {
70414
+ value: dashGapAccessor(arc)
70415
+ },
70416
+ dashOffset: {
70417
+ value: dashInitialGapAccessor(arc)
70392
70418
  }
70393
- var obj = group.children[0];
70394
-
70395
- // set dash uniforms
70396
- Object.assign(obj.material.uniforms, {
70397
- dashSize: {
70398
- value: dashLengthAccessor(arc)
70399
- },
70400
- gapSize: {
70401
- value: dashGapAccessor(arc)
70402
- },
70403
- dashOffset: {
70404
- value: dashInitialGapAccessor(arc)
70405
- }
70406
- });
70419
+ });
70407
70420
 
70408
- // set dash animation step
70409
- var dashAnimateTime = dashAnimateTimeAccessor(arc);
70410
- obj.__dashAnimateStep = dashAnimateTime > 0 ? 1000 / dashAnimateTime : 0; // per second
70421
+ // set dash animation step
70422
+ var dashAnimateTime = dashAnimateTimeAccessor(arc);
70423
+ obj.__dashAnimateStep = dashAnimateTime > 0 ? 1000 / dashAnimateTime : 0; // per second
70411
70424
 
70412
- // calculate vertex colors (to create gradient)
70413
- var vertexColorArray = calcColorVertexArray(colorAccessor(arc),
70414
- // single, array of colors or interpolator
70415
- state.arcCurveResolution,
70416
- // numSegments
70417
- useTube ? state.arcCircularResolution + 1 : 1 // num vertices per segment
70418
- );
70425
+ // calculate vertex colors (to create gradient)
70426
+ var vertexColorArray = calcColorVertexArray(colorAccessor(arc),
70427
+ // single, array of colors or interpolator
70428
+ state.arcCurveResolution,
70429
+ // numSegments
70430
+ useTube ? state.arcCircularResolution + 1 : 1 // num vertices per segment
70431
+ );
70419
70432
 
70420
- // calculate vertex relative distances (for dashed lines)
70421
- var vertexRelDistanceArray = calcVertexRelDistances(state.arcCurveResolution,
70422
- // numSegments
70423
- useTube ? state.arcCircularResolution + 1 : 1,
70424
- // num vertices per segment
70425
- true // run from end to start, to animate in the correct direction
70426
- );
70427
- obj.geometry.setAttribute('color', vertexColorArray);
70428
- obj.geometry.setAttribute('relDistance', vertexRelDistanceArray);
70429
- var applyUpdate = function applyUpdate(td) {
70430
- var _arc$__currentTargetD = arc.__currentTargetD = td,
70431
- stroke = _arc$__currentTargetD.stroke,
70432
- curveD = _objectWithoutProperties(_arc$__currentTargetD, _excluded$1);
70433
- var curve = calcCurve(curveD);
70434
- if (useTube) {
70435
- obj.geometry && obj.geometry.dispose();
70436
- obj.geometry = new THREE$d.TubeGeometry(curve, state.arcCurveResolution, stroke / 2, state.arcCircularResolution);
70437
- obj.geometry.setAttribute('color', vertexColorArray);
70438
- obj.geometry.setAttribute('relDistance', vertexRelDistanceArray);
70439
- } else {
70440
- obj.geometry.setFromPoints(curve.getPoints(state.arcCurveResolution));
70441
- }
70442
- };
70443
- var targetD = {
70444
- stroke: stroke,
70445
- alt: altitudeAccessor(arc),
70446
- altAutoScale: +altitudeAutoScaleAccessor(arc),
70447
- startLat: +startLatAccessor(arc),
70448
- startLng: +startLngAccessor(arc),
70449
- endLat: +endLatAccessor(arc),
70450
- endLng: +endLngAccessor(arc)
70451
- };
70452
- var currentTargetD = arc.__currentTargetD || Object.assign({}, targetD, {
70453
- altAutoScale: -1e-3
70454
- });
70455
- if (Object.keys(targetD).some(function (k) {
70456
- return currentTargetD[k] !== targetD[k];
70457
- })) {
70458
- if (!state.arcsTransitionDuration || state.arcsTransitionDuration < 0) {
70459
- // set final position
70460
- applyUpdate(targetD);
70461
- } else {
70462
- // animate
70463
- state.tweenGroup.add(new Tween(currentTargetD).to(targetD, state.arcsTransitionDuration).easing(Easing.Quadratic.InOut).onUpdate(applyUpdate).start());
70464
- }
70433
+ // calculate vertex relative distances (for dashed lines)
70434
+ var vertexRelDistanceArray = calcVertexRelDistances(state.arcCurveResolution,
70435
+ // numSegments
70436
+ useTube ? state.arcCircularResolution + 1 : 1,
70437
+ // num vertices per segment
70438
+ true // run from end to start, to animate in the correct direction
70439
+ );
70440
+ obj.geometry.setAttribute('color', vertexColorArray);
70441
+ obj.geometry.setAttribute('relDistance', vertexRelDistanceArray);
70442
+ var applyUpdate = function applyUpdate(td) {
70443
+ var _arc$__currentTargetD = arc.__currentTargetD = td,
70444
+ stroke = _arc$__currentTargetD.stroke,
70445
+ curveD = _objectWithoutProperties(_arc$__currentTargetD, _excluded$1);
70446
+ var curve = calcCurve(curveD);
70447
+ if (useTube) {
70448
+ obj.geometry && obj.geometry.dispose();
70449
+ obj.geometry = new THREE$d.TubeGeometry(curve, state.arcCurveResolution, stroke / 2, state.arcCircularResolution);
70450
+ obj.geometry.setAttribute('color', vertexColorArray);
70451
+ obj.geometry.setAttribute('relDistance', vertexRelDistanceArray);
70452
+ } else {
70453
+ obj.geometry.setFromPoints(curve.getPoints(state.arcCurveResolution));
70454
+ }
70455
+ };
70456
+ var targetD = {
70457
+ stroke: stroke,
70458
+ alt: altitudeAccessor(arc),
70459
+ altAutoScale: +altitudeAutoScaleAccessor(arc),
70460
+ startLat: +startLatAccessor(arc),
70461
+ startLng: +startLngAccessor(arc),
70462
+ endLat: +endLatAccessor(arc),
70463
+ endLng: +endLngAccessor(arc)
70464
+ };
70465
+ var currentTargetD = arc.__currentTargetD || Object.assign({}, targetD, {
70466
+ altAutoScale: -1e-3
70467
+ });
70468
+ if (Object.keys(targetD).some(function (k) {
70469
+ return currentTargetD[k] !== targetD[k];
70470
+ })) {
70471
+ if (!state.arcsTransitionDuration || state.arcsTransitionDuration < 0) {
70472
+ // set final position
70473
+ applyUpdate(targetD);
70474
+ } else {
70475
+ // animate
70476
+ state.tweenGroup.add(new Tween(currentTargetD).to(targetD, state.arcsTransitionDuration).easing(Easing.Quadratic.InOut).onUpdate(applyUpdate).start());
70465
70477
  }
70466
70478
  }
70467
- });
70479
+ }).digest(state.arcsData);
70468
70480
 
70469
70481
  //
70470
70482
 
70471
- function calcCurve(_ref2) {
70472
- var alt = _ref2.alt,
70473
- altAutoScale = _ref2.altAutoScale,
70474
- startLat = _ref2.startLat,
70475
- startLng = _ref2.startLng,
70476
- endLat = _ref2.endLat,
70477
- endLng = _ref2.endLng;
70478
- var getVec = function getVec(_ref3) {
70479
- var _ref4 = _slicedToArray$1(_ref3, 3),
70480
- lng = _ref4[0],
70481
- lat = _ref4[1],
70482
- alt = _ref4[2];
70483
+ function calcCurve(_ref4) {
70484
+ var alt = _ref4.alt,
70485
+ altAutoScale = _ref4.altAutoScale,
70486
+ startLat = _ref4.startLat,
70487
+ startLng = _ref4.startLng,
70488
+ endLat = _ref4.endLat,
70489
+ endLng = _ref4.endLng;
70490
+ var getVec = function getVec(_ref5) {
70491
+ var _ref6 = _slicedToArray$1(_ref5, 3),
70492
+ lng = _ref6[0],
70493
+ lat = _ref6[1],
70494
+ alt = _ref6[2];
70483
70495
  var _polar2Cartesian = polar2Cartesian(lat, lng, alt),
70484
70496
  x = _polar2Cartesian.x,
70485
70497
  y = _polar2Cartesian.y,
@@ -70581,6 +70593,7 @@ void main() {
70581
70593
  var THREE$c = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
70582
70594
  : {
70583
70595
  BufferGeometry: BufferGeometry,
70596
+ Color: Color$1,
70584
70597
  DoubleSide: DoubleSide,
70585
70598
  Mesh: Mesh,
70586
70599
  MeshLambertMaterial: MeshLambertMaterial,
@@ -70651,8 +70664,11 @@ void main() {
70651
70664
  // Main three object to manipulate
70652
70665
  state.scene = threeObj;
70653
70666
  state.tweenGroup = tweenGroup;
70667
+ state.dataMapper = new ThreeDigest(threeObj, {
70668
+ objBindAttr: '__threeObjHexbin'
70669
+ });
70654
70670
  },
70655
- update: function update(state) {
70671
+ update: function update(state, changedProps) {
70656
70672
  // Accessors
70657
70673
  var latAccessor = index$1(state.hexBinPointLat);
70658
70674
  var lngAccessor = index$1(state.hexBinPointLng);
@@ -70680,20 +70696,18 @@ void main() {
70680
70696
  });
70681
70697
  var hexMaterials = {}; // indexed by color
70682
70698
 
70683
- var scene = state.hexBinMerge ? new THREE$c.Object3D() : state.scene; // use fake scene if merging hex points
70699
+ if (!state.hexBinMerge && changedProps.hasOwnProperty('hexBinMerge')) {
70700
+ emptyObject(state.scene); // Empty trailing merged objects
70701
+ }
70702
+ state.dataMapper.scene = state.hexBinMerge ? new THREE$c.Object3D() : state.scene; // use fake scene if merging hex points
70684
70703
 
70685
- threeDigest(hexBins, scene, {
70686
- createObj: createObj,
70687
- updateObj: updateObj,
70688
- idAccessor: function idAccessor(d) {
70689
- return d.h3Idx;
70690
- }
70691
- });
70704
+ state.dataMapper.id(function (d) {
70705
+ return d.h3Idx;
70706
+ }).onCreateObj(createObj).onUpdateObj(updateObj).digest(hexBins);
70692
70707
  if (state.hexBinMerge) {
70693
70708
  // merge points into a single mesh
70694
70709
  var hexPointsGeometry = !hexBins.length ? new THREE$c.BufferGeometry() : (BufferGeometryUtils$1.mergeGeometries || BufferGeometryUtils$1.mergeBufferGeometries)(hexBins.map(function (d) {
70695
- var obj = d.__threeObj;
70696
- d.__threeObj = undefined; // unbind merged points
70710
+ var obj = state.dataMapper.getObj(d);
70697
70711
 
70698
70712
  // use non-indexed geometry so that groups can be colored separately, otherwise different groups share vertices
70699
70713
  var geom = obj.geometry.toNonIndexed();
@@ -70712,15 +70726,20 @@ void main() {
70712
70726
  }), 4));
70713
70727
  return geom;
70714
70728
  }));
70715
- var hexPoints = new THREE$c.Mesh(hexPointsGeometry, applyShaderExtensionToMaterial(new THREE$c.MeshLambertMaterial({
70729
+ var hexMaterial = new THREE$c.MeshLambertMaterial({
70716
70730
  color: 0xffffff,
70717
70731
  transparent: true,
70718
70732
  vertexColors: true,
70719
70733
  side: THREE$c.DoubleSide
70720
- }), invisibleUndergroundShaderExtend));
70734
+ });
70735
+ hexMaterial.onBeforeCompile = function (shader) {
70736
+ hexMaterial.userData.shader = invisibleUndergroundShaderExtend(shader);
70737
+ };
70738
+ var hexPoints = new THREE$c.Mesh(hexPointsGeometry, hexMaterial);
70721
70739
  hexPoints.__globeObjType = 'hexBinPoints'; // Add object type
70722
70740
  hexPoints.__data = hexBins; // Attach obj data
70723
70741
 
70742
+ state.dataMapper.clear(); // Unbind merged points
70724
70743
  emptyObject(state.scene);
70725
70744
  state.scene.add(hexPoints);
70726
70745
  }
@@ -70766,7 +70785,7 @@ void main() {
70766
70785
  });
70767
70786
  var topCurvatureResolution = state.hexTopCurvatureResolution;
70768
70787
  obj.geometry && obj.geometry.dispose();
70769
- obj.geometry = new ConicPolygonBufferGeometry([geoJson], 0, GLOBE_RADIUS, false, true, true, topCurvatureResolution);
70788
+ obj.geometry = new ConicPolygonGeometry([geoJson], 0, GLOBE_RADIUS, false, true, true, topCurvatureResolution);
70770
70789
  var targetD = {
70771
70790
  alt: +altitudeAccessor(d)
70772
70791
  };
@@ -70974,6 +70993,16 @@ void main() {
70974
70993
  // Main three object to manipulate
70975
70994
  state.scene = threeObj;
70976
70995
  state.tweenGroup = tweenGroup;
70996
+ state.dataMapper = new ThreeDigest(threeObj, {
70997
+ objBindAttr: '__threeObjHeatmap'
70998
+ }).onCreateObj(function () {
70999
+ var obj = new THREE$b.Mesh(new THREE$b.SphereGeometry(GLOBE_RADIUS), applyShaderExtensionToMaterial(new THREE$b.MeshLambertMaterial({
71000
+ vertexColors: true,
71001
+ transparent: true
71002
+ }), setRadiusShaderExtend));
71003
+ obj.__globeObjType = 'heatmap'; // Add object type
71004
+ return obj;
71005
+ });
70977
71006
  },
70978
71007
  update: function update(state) {
70979
71008
  // Accessors
@@ -70986,133 +71015,123 @@ void main() {
70986
71015
  var saturationAccessor = index$1(state.heatmapColorSaturation);
70987
71016
  var baseAltitudeAccessor = index$1(state.heatmapBaseAltitude);
70988
71017
  var topAltitudeAccessor = index$1(state.heatmapTopAltitude);
70989
- threeDigest(state.heatmapsData, state.scene, {
70990
- createObj: function createObj() {
70991
- var obj = new THREE$b.Mesh(new THREE$b.SphereGeometry(GLOBE_RADIUS), applyShaderExtensionToMaterial(new THREE$b.MeshLambertMaterial({
70992
- vertexColors: true,
70993
- transparent: true
70994
- }), setRadiusShaderExtend));
70995
- obj.__globeObjType = 'heatmap'; // Add object type
70996
- return obj;
70997
- },
70998
- updateObj: function updateObj(obj, d) {
70999
- // Accessors
71000
- var bandwidth = bandwidthAccessor(d);
71001
- var colorFn = colorFnAccessor(d);
71002
- var saturation = saturationAccessor(d);
71003
- var baseAlt = baseAltitudeAccessor(d);
71004
- var topAlt = topAltitudeAccessor(d);
71005
- var pnts = pointsAccessor(d).map(function (pnt) {
71006
- var lat = latPntAccessor(pnt);
71007
- var lng = lngPntAccessor(pnt);
71008
- var _polar2Cartesian = polar2Cartesian(lat, lng),
71009
- x = _polar2Cartesian.x,
71010
- y = _polar2Cartesian.y,
71011
- z = _polar2Cartesian.z;
71012
- return {
71018
+ state.dataMapper.onUpdateObj(function (obj, d) {
71019
+ // Accessors
71020
+ var bandwidth = bandwidthAccessor(d);
71021
+ var colorFn = colorFnAccessor(d);
71022
+ var saturation = saturationAccessor(d);
71023
+ var baseAlt = baseAltitudeAccessor(d);
71024
+ var topAlt = topAltitudeAccessor(d);
71025
+ var pnts = pointsAccessor(d).map(function (pnt) {
71026
+ var lat = latPntAccessor(pnt);
71027
+ var lng = lngPntAccessor(pnt);
71028
+ var _polar2Cartesian = polar2Cartesian(lat, lng),
71029
+ x = _polar2Cartesian.x,
71030
+ y = _polar2Cartesian.y,
71031
+ z = _polar2Cartesian.z;
71032
+ return {
71033
+ x: x,
71034
+ y: y,
71035
+ z: z,
71036
+ lat: lat,
71037
+ lng: lng,
71038
+ weight: weightPntAccessor(pnt)
71039
+ };
71040
+ });
71041
+
71042
+ // Check resolution
71043
+ var resolution = Math.max(MIN_RESOLUTION, bandwidth / RES_BW_FACTOR);
71044
+ var equatorNumSegments = Math.ceil(360 / (resolution || -1));
71045
+ if (obj.geometry.parameters.widthSegments !== equatorNumSegments) {
71046
+ obj.geometry.dispose();
71047
+ obj.geometry = new THREE$b.SphereGeometry(GLOBE_RADIUS, equatorNumSegments, equatorNumSegments / 2);
71048
+ }
71049
+
71050
+ // Get vertex polar coordinates
71051
+ var vertexCoords = bufferAttr2Array(obj.geometry.getAttribute('position'));
71052
+ var vertexGeoCoords = vertexCoords.map(function (_ref2) {
71053
+ var _ref3 = _slicedToArray$1(_ref2, 3),
71054
+ x = _ref3[0],
71055
+ y = _ref3[1],
71056
+ z = _ref3[2];
71057
+ var _cartesian2Polar = cartesian2Polar({
71013
71058
  x: x,
71014
71059
  y: y,
71015
- z: z,
71016
- lat: lat,
71017
- lng: lng,
71018
- weight: weightPntAccessor(pnt)
71019
- };
71020
- });
71021
-
71022
- // Check resolution
71023
- var resolution = Math.max(MIN_RESOLUTION, bandwidth / RES_BW_FACTOR);
71024
- var equatorNumSegments = Math.ceil(360 / (resolution || -1));
71025
- if (obj.geometry.parameters.widthSegments !== equatorNumSegments) {
71026
- obj.geometry.dispose();
71027
- obj.geometry = new THREE$b.SphereGeometry(GLOBE_RADIUS, equatorNumSegments, equatorNumSegments / 2);
71028
- }
71060
+ z: z
71061
+ }),
71062
+ lng = _cartesian2Polar.lng,
71063
+ lat = _cartesian2Polar.lat;
71064
+ return [lng, lat];
71065
+ });
71029
71066
 
71030
- // Get vertex polar coordinates
71031
- var vertexCoords = bufferAttr2Array(obj.geometry.getAttribute('position'));
71032
- var vertexGeoCoords = vertexCoords.map(function (_ref2) {
71033
- var _ref3 = _slicedToArray$1(_ref2, 3),
71034
- x = _ref3[0],
71035
- y = _ref3[1],
71036
- z = _ref3[2];
71037
- var _cartesian2Polar = cartesian2Polar({
71038
- x: x,
71039
- y: y,
71040
- z: z
71041
- }),
71042
- lng = _cartesian2Polar.lng,
71043
- lat = _cartesian2Polar.lat;
71044
- return [lng, lat];
71067
+ // Compute KDE
71068
+ var pntsOctree = new PointsOctree(pnts, bandwidth * BW_RADIUS_INFLUENCE);
71069
+ var kdeVals = vertexGeoCoords.map(function (vxCoords, idx) {
71070
+ var _vertexCoords$idx = _slicedToArray$1(vertexCoords[idx], 3),
71071
+ x = _vertexCoords$idx[0],
71072
+ y = _vertexCoords$idx[1],
71073
+ z = _vertexCoords$idx[2];
71074
+ return getGeoKDE(vxCoords, pntsOctree.getNearPoints(x, y, z), {
71075
+ latAccessor: function latAccessor(d) {
71076
+ return d.lat;
71077
+ },
71078
+ lngAccessor: function lngAccessor(d) {
71079
+ return d.lng;
71080
+ },
71081
+ weightAccessor: function weightAccessor(d) {
71082
+ return d.weight;
71083
+ },
71084
+ bandwidth: bandwidth
71045
71085
  });
71086
+ });
71046
71087
 
71047
- // Compute KDE
71048
- var pntsOctree = new PointsOctree(pnts, bandwidth * BW_RADIUS_INFLUENCE);
71049
- var kdeVals = vertexGeoCoords.map(function (vxCoords, idx) {
71050
- var _vertexCoords$idx = _slicedToArray$1(vertexCoords[idx], 3),
71051
- x = _vertexCoords$idx[0],
71052
- y = _vertexCoords$idx[1],
71053
- z = _vertexCoords$idx[2];
71054
- return getGeoKDE(vxCoords, pntsOctree.getNearPoints(x, y, z), {
71055
- latAccessor: function latAccessor(d) {
71056
- return d.lat;
71057
- },
71058
- lngAccessor: function lngAccessor(d) {
71059
- return d.lng;
71060
- },
71061
- weightAccessor: function weightAccessor(d) {
71062
- return d.weight;
71063
- },
71064
- bandwidth: bandwidth
71065
- });
71066
- });
71088
+ // Animations
71089
+ var colors = _toConsumableArray$1(new Array(NUM_COLORS)).map(function (_, idx) {
71090
+ return color2ShaderArr(colorFn(idx / (NUM_COLORS - 1)));
71091
+ });
71092
+ var applyUpdate = function applyUpdate(td) {
71093
+ var _obj$__currentTargetD = obj.__currentTargetD = td,
71094
+ kdeVals = _obj$__currentTargetD.kdeVals,
71095
+ topAlt = _obj$__currentTargetD.topAlt,
71096
+ saturation = _obj$__currentTargetD.saturation;
71097
+ var maxVal = max$2(kdeVals.map(Math.abs)) || 1e-15;
71098
+
71099
+ // Set vertex colors
71100
+ var colorScale = quantize([0, maxVal / saturation], colors);
71101
+ obj.geometry.setAttribute('color', array2BufferAttr(kdeVals.map(function (v) {
71102
+ return colorScale(Math.abs(v));
71103
+ }), 4));
71067
71104
 
71068
- // Animations
71069
- var colors = _toConsumableArray$1(new Array(NUM_COLORS)).map(function (_, idx) {
71070
- return color2ShaderArr(colorFn(idx / (NUM_COLORS - 1)));
71071
- });
71072
- var applyUpdate = function applyUpdate(td) {
71073
- var _obj$__currentTargetD = obj.__currentTargetD = td,
71074
- kdeVals = _obj$__currentTargetD.kdeVals,
71075
- topAlt = _obj$__currentTargetD.topAlt,
71076
- saturation = _obj$__currentTargetD.saturation;
71077
- var maxVal = max$2(kdeVals.map(Math.abs)) || 1e-15;
71078
-
71079
- // Set vertex colors
71080
- var colorScale = quantize([0, maxVal / saturation], colors);
71081
- obj.geometry.setAttribute('color', array2BufferAttr(kdeVals.map(function (v) {
71082
- return colorScale(Math.abs(v));
71083
- }), 4));
71084
-
71085
- // Set altitudes
71086
- var rScale = linear([0, maxVal], [GLOBE_RADIUS * (1 + baseAlt), GLOBE_RADIUS * (1 + (topAlt || baseAlt))]);
71087
- obj.geometry.setAttribute('r', array2BufferAttr(kdeVals.map(rScale)));
71088
- };
71089
- var targetD = {
71090
- kdeVals: kdeVals,
71091
- topAlt: topAlt,
71092
- saturation: saturation
71093
- };
71094
- var currentTargetD = obj.__currentTargetD || Object.assign({}, targetD, {
71095
- kdeVals: kdeVals.map(function () {
71096
- return 0;
71097
- }),
71098
- topAlt: !topAlt ? topAlt : baseAlt,
71099
- saturation: 0.5
71100
- });
71101
- // do not interpolate between different length arrays
71102
- currentTargetD.kdeVals.length !== kdeVals.length && (currentTargetD.kdeVals = kdeVals.slice());
71103
- if (Object.keys(targetD).some(function (k) {
71104
- return currentTargetD[k] !== targetD[k];
71105
- })) {
71106
- if (!state.heatmapsTransitionDuration || state.heatmapsTransitionDuration < 0) {
71107
- // set final position
71108
- applyUpdate(targetD);
71109
- } else {
71110
- // animate
71111
- state.tweenGroup.add(new Tween(currentTargetD).to(targetD, state.heatmapsTransitionDuration).easing(Easing.Quadratic.InOut).onUpdate(applyUpdate).start());
71112
- }
71105
+ // Set altitudes
71106
+ var rScale = linear([0, maxVal], [GLOBE_RADIUS * (1 + baseAlt), GLOBE_RADIUS * (1 + (topAlt || baseAlt))]);
71107
+ obj.geometry.setAttribute('r', array2BufferAttr(kdeVals.map(rScale)));
71108
+ };
71109
+ var targetD = {
71110
+ kdeVals: kdeVals,
71111
+ topAlt: topAlt,
71112
+ saturation: saturation
71113
+ };
71114
+ var currentTargetD = obj.__currentTargetD || Object.assign({}, targetD, {
71115
+ kdeVals: kdeVals.map(function () {
71116
+ return 0;
71117
+ }),
71118
+ topAlt: !topAlt ? topAlt : baseAlt,
71119
+ saturation: 0.5
71120
+ });
71121
+ // do not interpolate between different length arrays
71122
+ currentTargetD.kdeVals.length !== kdeVals.length && (currentTargetD.kdeVals = kdeVals.slice());
71123
+ if (Object.keys(targetD).some(function (k) {
71124
+ return currentTargetD[k] !== targetD[k];
71125
+ })) {
71126
+ if (!state.heatmapsTransitionDuration || state.heatmapsTransitionDuration < 0) {
71127
+ // set final position
71128
+ applyUpdate(targetD);
71129
+ } else {
71130
+ // animate
71131
+ state.tweenGroup.add(new Tween(currentTargetD).to(targetD, state.heatmapsTransitionDuration).easing(Easing.Quadratic.InOut).onUpdate(applyUpdate).start());
71113
71132
  }
71114
71133
  }
71115
- });
71134
+ }).digest(state.heatmapsData);
71116
71135
  }
71117
71136
  });
71118
71137
 
@@ -71170,6 +71189,33 @@ void main() {
71170
71189
  // Main three object to manipulate
71171
71190
  state.scene = threeObj;
71172
71191
  state.tweenGroup = tweenGroup;
71192
+ state.dataMapper = new ThreeDigest(threeObj, {
71193
+ objBindAttr: '__threeObjPolygon'
71194
+ }).id(function (d) {
71195
+ return d.id;
71196
+ }).onCreateObj(function () {
71197
+ var obj = new THREE$a.Group();
71198
+ obj.__defaultSideMaterial = applyShaderExtensionToMaterial(new THREE$a.MeshBasicMaterial({
71199
+ side: THREE$a.DoubleSide,
71200
+ depthWrite: true
71201
+ }), invisibleUndergroundShaderExtend);
71202
+ obj.__defaultCapMaterial = new THREE$a.MeshBasicMaterial({
71203
+ side: THREE$a.DoubleSide,
71204
+ depthWrite: true
71205
+ });
71206
+
71207
+ // conic geometry
71208
+ obj.add(new THREE$a.Mesh(undefined, [obj.__defaultSideMaterial,
71209
+ // side material
71210
+ obj.__defaultCapMaterial // cap material
71211
+ ]));
71212
+
71213
+ // polygon stroke
71214
+ obj.add(new THREE$a.LineSegments(undefined, new THREE$a.LineBasicMaterial()));
71215
+ obj.__globeObjType = 'polygon'; // Add object type
71216
+
71217
+ return obj;
71218
+ });
71173
71219
  },
71174
71220
  update: function update(state) {
71175
71221
  // Data accessors
@@ -71212,117 +71258,89 @@ void main() {
71212
71258
  console.warn("Unsupported GeoJson geometry type: ".concat(geoJson.type, ". Skipping geometry..."));
71213
71259
  }
71214
71260
  });
71215
- threeDigest(singlePolygons, state.scene, {
71216
- idAccessor: function idAccessor(d) {
71217
- return d.id;
71218
- },
71219
- createObj: function createObj() {
71220
- var obj = new THREE$a.Group();
71221
- obj.__defaultSideMaterial = applyShaderExtensionToMaterial(new THREE$a.MeshBasicMaterial({
71222
- side: THREE$a.DoubleSide,
71223
- depthWrite: true
71224
- }), invisibleUndergroundShaderExtend);
71225
- obj.__defaultCapMaterial = new THREE$a.MeshBasicMaterial({
71226
- side: THREE$a.DoubleSide,
71227
- depthWrite: true
71228
- });
71229
-
71230
- // conic geometry
71231
- obj.add(new THREE$a.Mesh(undefined, [obj.__defaultSideMaterial,
71232
- // side material
71233
- obj.__defaultCapMaterial // cap material
71234
- ]));
71235
-
71236
- // polygon stroke
71237
- obj.add(new THREE$a.LineSegments(undefined, new THREE$a.LineBasicMaterial()));
71238
- obj.__globeObjType = 'polygon'; // Add object type
71239
-
71240
- return obj;
71241
- },
71242
- updateObj: function updateObj(obj, _ref2) {
71243
- var coords = _ref2.coords,
71244
- capColor = _ref2.capColor,
71245
- capMaterial = _ref2.capMaterial,
71246
- sideColor = _ref2.sideColor,
71247
- sideMaterial = _ref2.sideMaterial,
71248
- strokeColor = _ref2.strokeColor,
71249
- altitude = _ref2.altitude,
71250
- capCurvatureResolution = _ref2.capCurvatureResolution;
71251
- var _obj$children = _slicedToArray$1(obj.children, 2),
71252
- conicObj = _obj$children[0],
71253
- strokeObj = _obj$children[1];
71254
-
71255
- // hide stroke if no color set
71256
- var addStroke = !!strokeColor;
71257
- strokeObj.visible = addStroke;
71258
-
71259
- // regenerate geometries if needed
71260
- if (!objMatch(conicObj.geometry.parameters || {}, {
71261
- polygonGeoJson: coords,
71262
- curvatureResolution: capCurvatureResolution
71263
- })) {
71264
- conicObj.geometry && conicObj.geometry.dispose();
71265
- conicObj.geometry = new ConicPolygonBufferGeometry(coords, 0, GLOBE_RADIUS, false, true, true, capCurvatureResolution);
71266
- }
71267
- if (addStroke && (!strokeObj.geometry.parameters || strokeObj.geometry.parameters.geoJson.coordinates !== coords || strokeObj.geometry.parameters.resolution !== capCurvatureResolution)) {
71268
- strokeObj.geometry && strokeObj.geometry.dispose();
71269
- strokeObj.geometry = new GeoJsonGeometry({
71270
- type: 'Polygon',
71271
- coordinates: coords
71272
- }, GLOBE_RADIUS, capCurvatureResolution);
71273
- }
71261
+ state.dataMapper.onUpdateObj(function (obj, _ref2) {
71262
+ var coords = _ref2.coords,
71263
+ capColor = _ref2.capColor,
71264
+ capMaterial = _ref2.capMaterial,
71265
+ sideColor = _ref2.sideColor,
71266
+ sideMaterial = _ref2.sideMaterial,
71267
+ strokeColor = _ref2.strokeColor,
71268
+ altitude = _ref2.altitude,
71269
+ capCurvatureResolution = _ref2.capCurvatureResolution;
71270
+ var _obj$children = _slicedToArray$1(obj.children, 2),
71271
+ conicObj = _obj$children[0],
71272
+ strokeObj = _obj$children[1];
71273
+
71274
+ // hide stroke if no color set
71275
+ var addStroke = !!strokeColor;
71276
+ strokeObj.visible = addStroke;
71277
+
71278
+ // regenerate geometries if needed
71279
+ if (!objMatch(conicObj.geometry.parameters || {}, {
71280
+ polygonGeoJson: coords,
71281
+ curvatureResolution: capCurvatureResolution
71282
+ })) {
71283
+ conicObj.geometry && conicObj.geometry.dispose();
71284
+ conicObj.geometry = new ConicPolygonGeometry(coords, 0, GLOBE_RADIUS, false, true, true, capCurvatureResolution);
71285
+ }
71286
+ if (addStroke && (!strokeObj.geometry.parameters || strokeObj.geometry.parameters.geoJson.coordinates !== coords || strokeObj.geometry.parameters.resolution !== capCurvatureResolution)) {
71287
+ strokeObj.geometry && strokeObj.geometry.dispose();
71288
+ strokeObj.geometry = new GeoJsonGeometry({
71289
+ type: 'Polygon',
71290
+ coordinates: coords
71291
+ }, GLOBE_RADIUS, capCurvatureResolution);
71292
+ }
71274
71293
 
71275
- // replace side/cap materials if defined
71276
- conicObj.material[0] = sideMaterial || obj.__defaultSideMaterial;
71277
- conicObj.material[1] = capMaterial || obj.__defaultCapMaterial;
71294
+ // replace side/cap materials if defined
71295
+ conicObj.material[0] = sideMaterial || obj.__defaultSideMaterial;
71296
+ conicObj.material[1] = capMaterial || obj.__defaultCapMaterial;
71278
71297
 
71279
- // update default material colors
71280
- [!sideMaterial && sideColor, !capMaterial && capColor].forEach(function (color, materialIdx) {
71281
- if (!color) return; // skip custom materials
71298
+ // update default material colors
71299
+ [!sideMaterial && sideColor, !capMaterial && capColor].forEach(function (color, materialIdx) {
71300
+ if (!color) return; // skip custom materials
71282
71301
 
71283
- // conic object
71284
- var material = conicObj.material[materialIdx];
71285
- var opacity = colorAlpha(color);
71286
- material.color.set(colorStr2Hex(color));
71287
- material.transparent = opacity < 1;
71288
- material.opacity = opacity;
71289
- });
71290
- if (addStroke) {
71291
- // stroke object
71292
- var material = strokeObj.material;
71293
- var opacity = colorAlpha(strokeColor);
71294
- material.color.set(colorStr2Hex(strokeColor));
71295
- material.transparent = opacity < 1;
71296
- material.opacity = opacity;
71297
- }
71298
- var targetD = {
71299
- alt: altitude
71300
- };
71301
- var applyUpdate = function applyUpdate(td) {
71302
- var _obj$__currentTargetD = obj.__currentTargetD = td,
71303
- alt = _obj$__currentTargetD.alt;
71304
- conicObj.scale.x = conicObj.scale.y = conicObj.scale.z = 1 + alt;
71305
- addStroke && (strokeObj.scale.x = strokeObj.scale.y = strokeObj.scale.z = 1 + alt + 1e-4); // stroke slightly above the conic mesh
71306
- setExtendedMaterialUniforms(obj.__defaultSideMaterial, function (uniforms) {
71307
- return uniforms.surfaceRadius.value = GLOBE_RADIUS / (alt + 1);
71308
- }); // update side material scale uniform
71309
- };
71310
- var currentTargetD = obj.__currentTargetD || Object.assign({}, targetD, {
71311
- alt: -1e-3
71312
- });
71313
- if (Object.keys(targetD).some(function (k) {
71314
- return currentTargetD[k] !== targetD[k];
71315
- })) {
71316
- if (!state.polygonsTransitionDuration || state.polygonsTransitionDuration < 0 || currentTargetD.alt === targetD.alt) {
71317
- // set final position
71318
- applyUpdate(targetD);
71319
- } else {
71320
- // animate
71321
- state.tweenGroup.add(new Tween(currentTargetD).to(targetD, state.polygonsTransitionDuration).easing(Easing.Quadratic.InOut).onUpdate(applyUpdate).start());
71322
- }
71302
+ // conic object
71303
+ var material = conicObj.material[materialIdx];
71304
+ var opacity = colorAlpha(color);
71305
+ material.color.set(colorStr2Hex(color));
71306
+ material.transparent = opacity < 1;
71307
+ material.opacity = opacity;
71308
+ });
71309
+ if (addStroke) {
71310
+ // stroke object
71311
+ var material = strokeObj.material;
71312
+ var opacity = colorAlpha(strokeColor);
71313
+ material.color.set(colorStr2Hex(strokeColor));
71314
+ material.transparent = opacity < 1;
71315
+ material.opacity = opacity;
71316
+ }
71317
+ var targetD = {
71318
+ alt: altitude
71319
+ };
71320
+ var applyUpdate = function applyUpdate(td) {
71321
+ var _obj$__currentTargetD = obj.__currentTargetD = td,
71322
+ alt = _obj$__currentTargetD.alt;
71323
+ conicObj.scale.x = conicObj.scale.y = conicObj.scale.z = 1 + alt;
71324
+ addStroke && (strokeObj.scale.x = strokeObj.scale.y = strokeObj.scale.z = 1 + alt + 1e-4); // stroke slightly above the conic mesh
71325
+ setExtendedMaterialUniforms(obj.__defaultSideMaterial, function (uniforms) {
71326
+ return uniforms.surfaceRadius.value = GLOBE_RADIUS / (alt + 1);
71327
+ }); // update side material scale uniform
71328
+ };
71329
+ var currentTargetD = obj.__currentTargetD || Object.assign({}, targetD, {
71330
+ alt: -1e-3
71331
+ });
71332
+ if (Object.keys(targetD).some(function (k) {
71333
+ return currentTargetD[k] !== targetD[k];
71334
+ })) {
71335
+ if (!state.polygonsTransitionDuration || state.polygonsTransitionDuration < 0 || currentTargetD.alt === targetD.alt) {
71336
+ // set final position
71337
+ applyUpdate(targetD);
71338
+ } else {
71339
+ // animate
71340
+ state.tweenGroup.add(new Tween(currentTargetD).to(targetD, state.polygonsTransitionDuration).easing(Easing.Quadratic.InOut).onUpdate(applyUpdate).start());
71323
71341
  }
71324
71342
  }
71325
- });
71343
+ }).digest(singlePolygons);
71326
71344
  }
71327
71345
  });
71328
71346
  function objMatch(obj, attrs) {
@@ -71342,6 +71360,7 @@ void main() {
71342
71360
  var THREE$9 = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
71343
71361
  : {
71344
71362
  BufferGeometry: BufferGeometry,
71363
+ CircleGeometry: CircleGeometry,
71345
71364
  DoubleSide: DoubleSide,
71346
71365
  Mesh: Mesh,
71347
71366
  MeshLambertMaterial: MeshLambertMaterial,
@@ -71402,6 +71421,16 @@ void main() {
71402
71421
  // Main three object to manipulate
71403
71422
  state.scene = threeObj;
71404
71423
  state.tweenGroup = tweenGroup;
71424
+ state.dataMapper = new ThreeDigest(threeObj, {
71425
+ objBindAttr: '__threeObjHexPolygon'
71426
+ }).onCreateObj(function () {
71427
+ var obj = new THREE$9.Mesh(undefined, new THREE$9.MeshLambertMaterial({
71428
+ side: THREE$9.DoubleSide
71429
+ }));
71430
+ obj.__globeObjType = 'hexPolygon'; // Add object type
71431
+
71432
+ return obj;
71433
+ });
71405
71434
  },
71406
71435
  update: function update(state) {
71407
71436
  // Accessors
@@ -71413,132 +71442,122 @@ void main() {
71413
71442
  var useDotsAccessor = index$1(state.hexPolygonUseDots);
71414
71443
  var curvatureResolutionAccessor = index$1(state.hexPolygonCurvatureResolution);
71415
71444
  var dotResolutionAccessor = index$1(state.hexPolygonDotResolution);
71416
- threeDigest(state.hexPolygonsData, state.scene, {
71417
- createObj: function createObj(d) {
71418
- var obj = new THREE$9.Mesh(undefined, new THREE$9.MeshLambertMaterial({
71419
- side: THREE$9.DoubleSide
71420
- }));
71421
- obj.__globeObjType = 'hexPolygon'; // Add object type
71422
-
71423
- return obj;
71424
- },
71425
- updateObj: function updateObj(obj, d) {
71426
- var geoJson = geoJsonAccessor(d);
71427
- var h3Res = resolutionAccessor(d);
71428
- var alt = altitudeAccessor(d);
71429
- var margin = Math.max(0, Math.min(1, +marginAccessor(d)));
71430
- var useDots = useDotsAccessor(d);
71431
- var curvatureResolution = curvatureResolutionAccessor(d);
71432
- var dotResolution = dotResolutionAccessor(d);
71433
-
71434
- // update material
71435
- var color = colorAccessor(d);
71436
- var opacity = colorAlpha(color);
71437
- obj.material.color.set(colorStr2Hex(color));
71438
- obj.material.transparent = opacity < 1;
71439
- obj.material.opacity = opacity;
71440
- var targetD = {
71441
- alt: alt,
71442
- margin: margin,
71443
- curvatureResolution: curvatureResolution
71444
- };
71445
- var memD = {
71446
- geoJson: geoJson,
71447
- h3Res: h3Res
71448
- };
71449
- var currentTargetD = obj.__currentTargetD || Object.assign({}, targetD, {
71450
- alt: -1e-3
71451
- });
71452
- var currentMemD = obj.__currentMemD || memD;
71453
- if (Object.keys(targetD).some(function (k) {
71454
- return currentTargetD[k] !== targetD[k];
71455
- }) || Object.keys(memD).some(function (k) {
71456
- return currentMemD[k] !== memD[k];
71457
- })) {
71458
- obj.__currentMemD = memD;
71459
- var h3Idxs = [];
71460
- if (geoJson.type === 'Polygon') {
71461
- polygonToCells(geoJson.coordinates, h3Res, true).forEach(function (idx) {
71445
+ state.dataMapper.onUpdateObj(function (obj, d) {
71446
+ var geoJson = geoJsonAccessor(d);
71447
+ var h3Res = resolutionAccessor(d);
71448
+ var alt = altitudeAccessor(d);
71449
+ var margin = Math.max(0, Math.min(1, +marginAccessor(d)));
71450
+ var useDots = useDotsAccessor(d);
71451
+ var curvatureResolution = curvatureResolutionAccessor(d);
71452
+ var dotResolution = dotResolutionAccessor(d);
71453
+
71454
+ // update material
71455
+ var color = colorAccessor(d);
71456
+ var opacity = colorAlpha(color);
71457
+ obj.material.color.set(colorStr2Hex(color));
71458
+ obj.material.transparent = opacity < 1;
71459
+ obj.material.opacity = opacity;
71460
+ var targetD = {
71461
+ alt: alt,
71462
+ margin: margin,
71463
+ curvatureResolution: curvatureResolution
71464
+ };
71465
+ var memD = {
71466
+ geoJson: geoJson,
71467
+ h3Res: h3Res
71468
+ };
71469
+ var currentTargetD = obj.__currentTargetD || Object.assign({}, targetD, {
71470
+ alt: -1e-3
71471
+ });
71472
+ var currentMemD = obj.__currentMemD || memD;
71473
+ if (Object.keys(targetD).some(function (k) {
71474
+ return currentTargetD[k] !== targetD[k];
71475
+ }) || Object.keys(memD).some(function (k) {
71476
+ return currentMemD[k] !== memD[k];
71477
+ })) {
71478
+ obj.__currentMemD = memD;
71479
+ var h3Idxs = [];
71480
+ if (geoJson.type === 'Polygon') {
71481
+ polygonToCells(geoJson.coordinates, h3Res, true).forEach(function (idx) {
71482
+ return h3Idxs.push(idx);
71483
+ });
71484
+ } else if (geoJson.type === 'MultiPolygon') {
71485
+ geoJson.coordinates.forEach(function (coords) {
71486
+ return polygonToCells(coords, h3Res, true).forEach(function (idx) {
71462
71487
  return h3Idxs.push(idx);
71463
71488
  });
71464
- } else if (geoJson.type === 'MultiPolygon') {
71465
- geoJson.coordinates.forEach(function (coords) {
71466
- return polygonToCells(coords, h3Res, true).forEach(function (idx) {
71467
- return h3Idxs.push(idx);
71468
- });
71469
- });
71470
- } else {
71471
- console.warn("Unsupported GeoJson geometry type: ".concat(geoJson.type, ". Skipping geometry..."));
71472
- }
71473
- var hexBins = h3Idxs.map(function (h3Idx) {
71474
- var hexCenter = cellToLatLng(h3Idx);
71475
- var hexGeoJson = cellToBoundary(h3Idx, true).reverse(); // correct polygon winding
71476
-
71477
- // stitch longitudes at the anti-meridian
71478
- var centerLng = hexCenter[1];
71479
- hexGeoJson.forEach(function (d) {
71480
- var edgeLng = d[0];
71481
- if (Math.abs(centerLng - edgeLng) > 170) {
71482
- // normalize large lng distances
71483
- d[0] += centerLng > edgeLng ? 360 : -360;
71484
- }
71485
- });
71486
- return {
71487
- h3Idx: h3Idx,
71488
- hexCenter: hexCenter,
71489
- hexGeoJson: hexGeoJson
71490
- };
71491
71489
  });
71492
- var applyUpdate = function applyUpdate(td) {
71493
- var _obj$__currentTargetD = obj.__currentTargetD = td,
71494
- alt = _obj$__currentTargetD.alt,
71495
- margin = _obj$__currentTargetD.margin,
71496
- curvatureResolution = _obj$__currentTargetD.curvatureResolution;
71497
- obj.geometry && obj.geometry.dispose();
71498
- obj.geometry = !hexBins.length ? new THREE$9.BufferGeometry() : (BufferGeometryUtils.mergeGeometries || BufferGeometryUtils.mergeBufferGeometries)(hexBins.map(function (h) {
71499
- var _h$hexCenter = _slicedToArray$1(h.hexCenter, 2),
71500
- clat = _h$hexCenter[0],
71501
- clng = _h$hexCenter[1];
71502
- if (useDots) {
71503
- var centerPos = polar2Cartesian(clat, clng, alt);
71504
- var edgePos = polar2Cartesian(h.hexGeoJson[0][1], h.hexGeoJson[0][0], alt);
71505
- var r = 0.85 * (1 - margin) * new THREE$9.Vector3(centerPos.x, centerPos.y, centerPos.z).distanceTo(new THREE$9.Vector3(edgePos.x, edgePos.y, edgePos.z));
71506
- var geometry = new CircleGeometry(r, dotResolution);
71507
- geometry.rotateX(deg2Rad$1(-clat));
71508
- geometry.rotateY(deg2Rad$1(clng));
71509
- geometry.translate(centerPos.x, centerPos.y, centerPos.z);
71510
- return geometry;
71511
- } else {
71512
- var relNum = function relNum(st, end, rat) {
71513
- return st - (st - end) * rat;
71514
- };
71515
-
71516
- // compute new geojson with relative margin
71517
- var _geoJson = margin === 0 ? h.hexGeoJson : h.hexGeoJson.map(function (_ref2) {
71518
- var _ref3 = _slicedToArray$1(_ref2, 2),
71519
- elng = _ref3[0],
71520
- elat = _ref3[1];
71521
- return [[elng, clng], [elat, clat]].map(function (_ref4) {
71522
- var _ref5 = _slicedToArray$1(_ref4, 2),
71523
- st = _ref5[0],
71524
- end = _ref5[1];
71525
- return relNum(st, end, margin);
71526
- });
71527
- });
71528
- return new ConicPolygonBufferGeometry([_geoJson], GLOBE_RADIUS, GLOBE_RADIUS * (1 + alt), false, true, false, curvatureResolution);
71529
- }
71530
- }));
71490
+ } else {
71491
+ console.warn("Unsupported GeoJson geometry type: ".concat(geoJson.type, ". Skipping geometry..."));
71492
+ }
71493
+ var hexBins = h3Idxs.map(function (h3Idx) {
71494
+ var hexCenter = cellToLatLng(h3Idx);
71495
+ var hexGeoJson = cellToBoundary(h3Idx, true).reverse(); // correct polygon winding
71496
+
71497
+ // stitch longitudes at the anti-meridian
71498
+ var centerLng = hexCenter[1];
71499
+ hexGeoJson.forEach(function (d) {
71500
+ var edgeLng = d[0];
71501
+ if (Math.abs(centerLng - edgeLng) > 170) {
71502
+ // normalize large lng distances
71503
+ d[0] += centerLng > edgeLng ? 360 : -360;
71504
+ }
71505
+ });
71506
+ return {
71507
+ h3Idx: h3Idx,
71508
+ hexCenter: hexCenter,
71509
+ hexGeoJson: hexGeoJson
71531
71510
  };
71532
- if (!state.hexPolygonsTransitionDuration || state.hexPolygonsTransitionDuration < 0) {
71533
- // set final position
71534
- applyUpdate(targetD);
71535
- } else {
71536
- // animate
71537
- state.tweenGroup.add(new Tween(currentTargetD).to(targetD, state.hexPolygonsTransitionDuration).easing(Easing.Quadratic.InOut).onUpdate(applyUpdate).start());
71538
- }
71511
+ });
71512
+ var applyUpdate = function applyUpdate(td) {
71513
+ var _obj$__currentTargetD = obj.__currentTargetD = td,
71514
+ alt = _obj$__currentTargetD.alt,
71515
+ margin = _obj$__currentTargetD.margin,
71516
+ curvatureResolution = _obj$__currentTargetD.curvatureResolution;
71517
+ obj.geometry && obj.geometry.dispose();
71518
+ obj.geometry = !hexBins.length ? new THREE$9.BufferGeometry() : (BufferGeometryUtils.mergeGeometries || BufferGeometryUtils.mergeBufferGeometries)(hexBins.map(function (h) {
71519
+ var _h$hexCenter = _slicedToArray$1(h.hexCenter, 2),
71520
+ clat = _h$hexCenter[0],
71521
+ clng = _h$hexCenter[1];
71522
+ if (useDots) {
71523
+ var centerPos = polar2Cartesian(clat, clng, alt);
71524
+ var edgePos = polar2Cartesian(h.hexGeoJson[0][1], h.hexGeoJson[0][0], alt);
71525
+ var r = 0.85 * (1 - margin) * new THREE$9.Vector3(centerPos.x, centerPos.y, centerPos.z).distanceTo(new THREE$9.Vector3(edgePos.x, edgePos.y, edgePos.z));
71526
+ var geometry = new CircleGeometry(r, dotResolution);
71527
+ geometry.rotateX(deg2Rad$1(-clat));
71528
+ geometry.rotateY(deg2Rad$1(clng));
71529
+ geometry.translate(centerPos.x, centerPos.y, centerPos.z);
71530
+ return geometry;
71531
+ } else {
71532
+ var relNum = function relNum(st, end, rat) {
71533
+ return st - (st - end) * rat;
71534
+ };
71535
+
71536
+ // compute new geojson with relative margin
71537
+ var _geoJson = margin === 0 ? h.hexGeoJson : h.hexGeoJson.map(function (_ref2) {
71538
+ var _ref3 = _slicedToArray$1(_ref2, 2),
71539
+ elng = _ref3[0],
71540
+ elat = _ref3[1];
71541
+ return [[elng, clng], [elat, clat]].map(function (_ref4) {
71542
+ var _ref5 = _slicedToArray$1(_ref4, 2),
71543
+ st = _ref5[0],
71544
+ end = _ref5[1];
71545
+ return relNum(st, end, margin);
71546
+ });
71547
+ });
71548
+ return new ConicPolygonGeometry([_geoJson], GLOBE_RADIUS, GLOBE_RADIUS * (1 + alt), false, true, false, curvatureResolution);
71549
+ }
71550
+ }));
71551
+ };
71552
+ if (!state.hexPolygonsTransitionDuration || state.hexPolygonsTransitionDuration < 0) {
71553
+ // set final position
71554
+ applyUpdate(targetD);
71555
+ } else {
71556
+ // animate
71557
+ state.tweenGroup.add(new Tween(currentTargetD).to(targetD, state.hexPolygonsTransitionDuration).easing(Easing.Quadratic.InOut).onUpdate(applyUpdate).start());
71539
71558
  }
71540
71559
  }
71541
- });
71560
+ }).digest(state.hexPolygonsData);
71542
71561
  }
71543
71562
  });
71544
71563
 
@@ -71657,22 +71676,42 @@ void main() {
71657
71676
  (_state$ticker3 = state.ticker) === null || _state$ticker3 === void 0 || _state$ticker3.dispose();
71658
71677
  }
71659
71678
  },
71660
- init: function init(threeObj, state, _ref) {
71679
+ stateInit: function stateInit(_ref) {
71661
71680
  var tweenGroup = _ref.tweenGroup;
71681
+ return {
71682
+ tweenGroup: tweenGroup,
71683
+ ticker: new FrameTicker$1(),
71684
+ sharedMaterial: new THREE$7.ShaderMaterial(_objectSpread2(_objectSpread2({}, dashedLineShaders()), {}, {
71685
+ transparent: true,
71686
+ blending: THREE$7.NormalBlending
71687
+ }))
71688
+ };
71689
+ },
71690
+ init: function init(threeObj, state) {
71662
71691
  // Clear the scene
71663
71692
  emptyObject(threeObj);
71664
71693
 
71665
71694
  // Main three object to manipulate
71666
71695
  state.scene = threeObj;
71667
- state.tweenGroup = tweenGroup;
71696
+ state.dataMapper = new ThreeDigest(threeObj, {
71697
+ objBindAttr: '__threeObjPath'
71698
+ }).onCreateObj(function () {
71699
+ var obj = new THREE$7.Group(); // populated in updateObj
71700
+
71701
+ obj.__globeObjType = 'path'; // Add object type
71702
+ return obj;
71703
+ });
71668
71704
 
71669
71705
  // Kick-off dash animations
71670
- state.ticker = new FrameTicker$1();
71671
71706
  state.ticker.onTick.add(function (_, timeDelta) {
71672
- state.pathsData.filter(function (d) {
71673
- return d.__threeObj && d.__threeObj.children.length && d.__threeObj.children[0].material && d.__threeObj.children[0].__dashAnimateStep;
71674
- }).forEach(function (d) {
71675
- var obj = d.__threeObj.children[0];
71707
+ state.dataMapper.entries().map(function (_ref2) {
71708
+ var _ref3 = _slicedToArray$1(_ref2, 2),
71709
+ obj = _ref3[1];
71710
+ return obj;
71711
+ }).filter(function (o) {
71712
+ return o.children.length && o.children[0].material && o.children[0].__dashAnimateStep;
71713
+ }).forEach(function (o) {
71714
+ var obj = o.children[0];
71676
71715
  var step = obj.__dashAnimateStep * timeDelta;
71677
71716
  if (obj.type === 'Line') {
71678
71717
  var curTranslate = obj.material.uniforms.dashTranslate.value % 1e9; // reset after 1B loops
@@ -71699,154 +71738,142 @@ void main() {
71699
71738
  var dashGapAccessor = index$1(state.pathDashGap);
71700
71739
  var dashInitialGapAccessor = index$1(state.pathDashInitialGap);
71701
71740
  var dashAnimateTimeAccessor = index$1(state.pathDashAnimateTime);
71702
- var sharedShaderMaterial = new THREE$7.ShaderMaterial(_objectSpread2(_objectSpread2({}, dashedLineShaders()), {}, {
71703
- transparent: true,
71704
- blending: THREE$7.NormalBlending
71705
- }));
71706
- threeDigest(state.pathsData, state.scene, {
71707
- createObj: function createObj() {
71708
- var obj = new THREE$7.Group(); // populated in updateObj
71741
+ state.dataMapper.onUpdateObj(function (group, path) {
71742
+ var stroke = strokeAccessor(path);
71743
+ var useFatLine = stroke !== null && stroke !== undefined;
71744
+ if (!group.children.length || useFatLine === (group.children[0].type === 'Line')) {
71745
+ // create or swap object types
71746
+ emptyObject(group);
71747
+ var _obj = useFatLine ? new Line2(new LineGeometry(), new LineMaterial()) : new THREE$7.Line(new THREE$7.BufferGeometry(), state.sharedMaterial.clone() // Separate material instance per object to have dedicated uniforms (but shared shaders)
71748
+ );
71749
+ group.add(_obj);
71750
+ }
71751
+ var obj = group.children[0];
71752
+ var points = calcPath(pointsAccessor(path), pointLatAccessor, pointLngAccessor, pointAltAccessor, state.pathResolution);
71709
71753
 
71710
- obj.__globeObjType = 'path'; // Add object type
71711
- return obj;
71712
- },
71713
- updateObj: function updateObj(group, path) {
71714
- var stroke = strokeAccessor(path);
71715
- var useFatLine = stroke !== null && stroke !== undefined;
71716
- if (!group.children.length || useFatLine === (group.children[0].type === 'Line')) {
71717
- // create or swap object types
71718
- emptyObject(group);
71719
- var _obj = useFatLine ? new Line2(new LineGeometry(), new LineMaterial()) : new THREE$7.Line(new THREE$7.BufferGeometry(), sharedShaderMaterial.clone() // Separate material instance per object to have dedicated uniforms (but shared shaders)
71720
- );
71721
- group.add(_obj);
71722
- }
71723
- var obj = group.children[0];
71724
- var points = calcPath(pointsAccessor(path), pointLatAccessor, pointLngAccessor, pointAltAccessor, state.pathResolution);
71725
-
71726
- // set dash animation step
71727
- var dashAnimateTime = dashAnimateTimeAccessor(path);
71728
- obj.__dashAnimateStep = dashAnimateTime > 0 ? 1000 / dashAnimateTime : 0; // per second
71729
-
71730
- if (!useFatLine) {
71731
- // set dash uniforms
71732
- Object.assign(obj.material.uniforms, {
71733
- dashSize: {
71734
- value: dashLengthAccessor(path)
71735
- },
71736
- gapSize: {
71737
- value: dashGapAccessor(path)
71738
- },
71739
- dashOffset: {
71740
- value: dashInitialGapAccessor(path)
71741
- }
71742
- });
71754
+ // set dash animation step
71755
+ var dashAnimateTime = dashAnimateTimeAccessor(path);
71756
+ obj.__dashAnimateStep = dashAnimateTime > 0 ? 1000 / dashAnimateTime : 0; // per second
71743
71757
 
71744
- // calculate vertex colors (to create gradient)
71745
- var vertexColorArray = calcColorVertexArray(colorAccessor(path),
71746
- // single, array of colors or interpolator
71747
- points.length // numSegments
71748
- );
71749
-
71750
- // calculate vertex relative distances (for dashed lines)
71751
- var vertexRelDistanceArray = calcVertexRelDistances(points.length,
71752
- // numSegments
71753
- 1,
71754
- // num vertices per segment
71755
- true // run from end to start, to animate in the correct direction
71756
- );
71757
- obj.geometry.setAttribute('color', vertexColorArray);
71758
- obj.geometry.setAttribute('relDistance', vertexRelDistanceArray);
71759
- } else {
71760
- // fat lines
71761
- obj.material.resolution = state.rendererSize;
71762
- {
71763
- // set dash styling
71764
- var dashLength = dashLengthAccessor(path);
71765
- var dashGap = dashGapAccessor(path);
71766
- var dashInitialGap = dashInitialGapAccessor(path);
71767
- obj.material.dashed = dashGap > 0;
71768
-
71769
- // temp hack to activate line dashes
71770
- obj.material.dashed ? obj.material.defines.USE_DASH = "" : delete obj.material.defines.USE_DASH;
71771
- if (obj.material.dashed) {
71772
- obj.material.dashScale = 1 / calcLineDistance(points); // dash sizes relative to full line length
71773
-
71774
- obj.material.dashSize = dashLength;
71775
- obj.material.gapSize = dashGap;
71776
- obj.material.dashOffset = -dashInitialGap;
71777
- }
71778
- }
71779
- {
71780
- // set line colors
71781
- var colors = colorAccessor(path);
71782
- if (colors instanceof Array) {
71783
- // calculate vertex colors (to create gradient)
71784
- var _vertexColorArray = calcColorVertexArray(colorAccessor(path),
71785
- // single, array of colors or interpolator
71786
- points.length - 1,
71787
- // numSegments
71788
- 1,
71789
- // num vertices per segment
71790
- false);
71791
- obj.geometry.setColors(_vertexColorArray.array);
71792
- obj.material.vertexColors = true;
71793
- } else {
71794
- // single color
71795
- var color = colors;
71796
- var opacity = colorAlpha(color);
71797
- obj.material.color = new THREE$7.Color(colorStr2Hex(color));
71798
- obj.material.transparent = opacity < 1;
71799
- obj.material.opacity = opacity;
71800
- obj.material.vertexColors = false;
71801
- }
71758
+ if (!useFatLine) {
71759
+ // set dash uniforms
71760
+ Object.assign(obj.material.uniforms, {
71761
+ dashSize: {
71762
+ value: dashLengthAccessor(path)
71763
+ },
71764
+ gapSize: {
71765
+ value: dashGapAccessor(path)
71766
+ },
71767
+ dashOffset: {
71768
+ value: dashInitialGapAccessor(path)
71802
71769
  }
71803
- obj.material.needsUpdate = true;
71804
- }
71770
+ });
71805
71771
 
71806
- // animate from start to finish by default
71807
- var pointsInterpolator = interpolateVectors(path.__currentTargetD && path.__currentTargetD.points || [points[0]], points);
71808
- var applyUpdate = function applyUpdate(td) {
71809
- var _path$__currentTarget = path.__currentTargetD = td,
71810
- stroke = _path$__currentTarget.stroke,
71811
- interpolK = _path$__currentTarget.interpolK;
71812
- var kPoints = path.__currentTargetD.points = pointsInterpolator(interpolK);
71813
- if (useFatLine) {
71814
- var _ref2;
71815
- obj.geometry.setPositions((_ref2 = []).concat.apply(_ref2, _toConsumableArray$1(kPoints.map(function (_ref3) {
71816
- var x = _ref3.x,
71817
- y = _ref3.y,
71818
- z = _ref3.z;
71819
- return [x, y, z];
71820
- }))));
71821
- obj.material.linewidth = stroke;
71822
-
71823
- // necessary for dashed lines
71824
- obj.material.dashed && obj.computeLineDistances();
71825
- } else {
71826
- obj.geometry.setFromPoints(kPoints);
71827
- obj.geometry.computeBoundingSphere();
71772
+ // calculate vertex colors (to create gradient)
71773
+ var vertexColorArray = calcColorVertexArray(colorAccessor(path),
71774
+ // single, array of colors or interpolator
71775
+ points.length // numSegments
71776
+ );
71777
+
71778
+ // calculate vertex relative distances (for dashed lines)
71779
+ var vertexRelDistanceArray = calcVertexRelDistances(points.length,
71780
+ // numSegments
71781
+ 1,
71782
+ // num vertices per segment
71783
+ true // run from end to start, to animate in the correct direction
71784
+ );
71785
+ obj.geometry.setAttribute('color', vertexColorArray);
71786
+ obj.geometry.setAttribute('relDistance', vertexRelDistanceArray);
71787
+ } else {
71788
+ // fat lines
71789
+ obj.material.resolution = state.rendererSize;
71790
+ {
71791
+ // set dash styling
71792
+ var dashLength = dashLengthAccessor(path);
71793
+ var dashGap = dashGapAccessor(path);
71794
+ var dashInitialGap = dashInitialGapAccessor(path);
71795
+ obj.material.dashed = dashGap > 0;
71796
+
71797
+ // temp hack to activate line dashes
71798
+ obj.material.dashed ? obj.material.defines.USE_DASH = "" : delete obj.material.defines.USE_DASH;
71799
+ if (obj.material.dashed) {
71800
+ obj.material.dashScale = 1 / calcLineDistance(points); // dash sizes relative to full line length
71801
+
71802
+ obj.material.dashSize = dashLength;
71803
+ obj.material.gapSize = dashGap;
71804
+ obj.material.dashOffset = -dashInitialGap;
71828
71805
  }
71829
- };
71830
- var targetD = {
71831
- stroke: stroke,
71832
- interpolK: 1
71833
- };
71834
- var currentTargetD = Object.assign({}, path.__currentTargetD || targetD, {
71835
- interpolK: 0
71836
- });
71837
- if (Object.keys(targetD).some(function (k) {
71838
- return currentTargetD[k] !== targetD[k];
71839
- })) {
71840
- if (!state.pathTransitionDuration || state.pathTransitionDuration < 0) {
71841
- // set final position
71842
- applyUpdate(targetD);
71806
+ }
71807
+ {
71808
+ // set line colors
71809
+ var colors = colorAccessor(path);
71810
+ if (colors instanceof Array) {
71811
+ // calculate vertex colors (to create gradient)
71812
+ var _vertexColorArray = calcColorVertexArray(colorAccessor(path),
71813
+ // single, array of colors or interpolator
71814
+ points.length - 1,
71815
+ // numSegments
71816
+ 1,
71817
+ // num vertices per segment
71818
+ false);
71819
+ obj.geometry.setColors(_vertexColorArray.array);
71820
+ obj.material.vertexColors = true;
71843
71821
  } else {
71844
- // animate
71845
- state.tweenGroup.add(new Tween(currentTargetD).to(targetD, state.pathTransitionDuration).easing(Easing.Quadratic.InOut).onUpdate(applyUpdate).start());
71822
+ // single color
71823
+ var color = colors;
71824
+ var opacity = colorAlpha(color);
71825
+ obj.material.color = new THREE$7.Color(colorStr2Hex(color));
71826
+ obj.material.transparent = opacity < 1;
71827
+ obj.material.opacity = opacity;
71828
+ obj.material.vertexColors = false;
71846
71829
  }
71847
71830
  }
71831
+ obj.material.needsUpdate = true;
71848
71832
  }
71849
- });
71833
+
71834
+ // animate from start to finish by default
71835
+ var pointsInterpolator = interpolateVectors(path.__currentTargetD && path.__currentTargetD.points || [points[0]], points);
71836
+ var applyUpdate = function applyUpdate(td) {
71837
+ var _path$__currentTarget = path.__currentTargetD = td,
71838
+ stroke = _path$__currentTarget.stroke,
71839
+ interpolK = _path$__currentTarget.interpolK;
71840
+ var kPoints = path.__currentTargetD.points = pointsInterpolator(interpolK);
71841
+ if (useFatLine) {
71842
+ var _ref4;
71843
+ obj.geometry.setPositions((_ref4 = []).concat.apply(_ref4, _toConsumableArray$1(kPoints.map(function (_ref5) {
71844
+ var x = _ref5.x,
71845
+ y = _ref5.y,
71846
+ z = _ref5.z;
71847
+ return [x, y, z];
71848
+ }))));
71849
+ obj.material.linewidth = stroke;
71850
+
71851
+ // necessary for dashed lines
71852
+ obj.material.dashed && obj.computeLineDistances();
71853
+ } else {
71854
+ obj.geometry.setFromPoints(kPoints);
71855
+ obj.geometry.computeBoundingSphere();
71856
+ }
71857
+ };
71858
+ var targetD = {
71859
+ stroke: stroke,
71860
+ interpolK: 1
71861
+ };
71862
+ var currentTargetD = Object.assign({}, path.__currentTargetD || targetD, {
71863
+ interpolK: 0
71864
+ });
71865
+ if (Object.keys(targetD).some(function (k) {
71866
+ return currentTargetD[k] !== targetD[k];
71867
+ })) {
71868
+ if (!state.pathTransitionDuration || state.pathTransitionDuration < 0) {
71869
+ // set final position
71870
+ applyUpdate(targetD);
71871
+ } else {
71872
+ // animate
71873
+ state.tweenGroup.add(new Tween(currentTargetD).to(targetD, state.pathTransitionDuration).easing(Easing.Quadratic.InOut).onUpdate(applyUpdate).start());
71874
+ }
71875
+ }
71876
+ }).digest(state.pathsData);
71850
71877
 
71851
71878
  //
71852
71879
 
@@ -71891,11 +71918,11 @@ void main() {
71891
71918
  });
71892
71919
  return result;
71893
71920
  };
71894
- var getVec = function getVec(_ref4) {
71895
- var _ref5 = _slicedToArray$1(_ref4, 3),
71896
- lat = _ref5[0],
71897
- lng = _ref5[1],
71898
- alt = _ref5[2];
71921
+ var getVec = function getVec(_ref6) {
71922
+ var _ref7 = _slicedToArray$1(_ref6, 3),
71923
+ lat = _ref7[0],
71924
+ lng = _ref7[1],
71925
+ alt = _ref7[2];
71899
71926
  var _polar2Cartesian = polar2Cartesian(lat, lng, alt),
71900
71927
  x = _polar2Cartesian.x,
71901
71928
  y = _polar2Cartesian.y,
@@ -72020,6 +72047,14 @@ void main() {
72020
72047
  // Main three object to manipulate
72021
72048
  state.scene = threeObj;
72022
72049
  state.tweenGroup = tweenGroup;
72050
+ state.dataMapper = new ThreeDigest(threeObj, {
72051
+ objBindAttr: '__threeObjTile'
72052
+ }).onCreateObj(function () {
72053
+ var obj = new THREE$6.Mesh();
72054
+ obj.__globeObjType = 'tile'; // Add object type
72055
+
72056
+ return obj;
72057
+ });
72023
72058
  },
72024
72059
  update: function update(state) {
72025
72060
  // Data accessors
@@ -72031,60 +72066,52 @@ void main() {
72031
72066
  var useGlobeProjectionAccessor = index$1(state.tileUseGlobeProjection);
72032
72067
  var materialAccessor = index$1(state.tileMaterial);
72033
72068
  var curvatureResolutionAccessor = index$1(state.tileCurvatureResolution);
72034
- threeDigest(state.tilesData, state.scene, {
72035
- createObj: function createObj() {
72036
- var obj = new THREE$6.Mesh();
72037
- obj.__globeObjType = 'tile'; // Add object type
72069
+ state.dataMapper.onUpdateObj(function (obj, d) {
72070
+ obj.material = materialAccessor(d); // set material
72038
72071
 
72039
- return obj;
72040
- },
72041
- updateObj: function updateObj(obj, d) {
72042
- obj.material = materialAccessor(d); // set material
72072
+ var useGlobeProjection = useGlobeProjectionAccessor(d);
72073
+ var curvatureResolution = curvatureResolutionAccessor(d);
72043
72074
 
72044
- var useGlobeProjection = useGlobeProjectionAccessor(d);
72045
- var curvatureResolution = curvatureResolutionAccessor(d);
72046
-
72047
- // animations
72048
- var applyPosition = function applyPosition(td) {
72049
- var _obj$__currentTargetD = obj.__currentTargetD = td,
72050
- lat = _obj$__currentTargetD.lat,
72051
- lng = _obj$__currentTargetD.lng,
72052
- alt = _obj$__currentTargetD.alt,
72053
- width = _obj$__currentTargetD.width,
72054
- height = _obj$__currentTargetD.height;
72055
- var rotLng = deg2Rad(lng);
72056
- var rotLat = deg2Rad(-lat);
72057
- obj.geometry && obj.geometry.dispose();
72058
- obj.geometry = new THREE$6.SphereGeometry(GLOBE_RADIUS * (1 + alt), Math.ceil(width / (curvatureResolution || -1)), Math.ceil(height / (curvatureResolution || -1)), deg2Rad(90 - width / 2) + (useGlobeProjection ? rotLng : 0), deg2Rad(width), deg2Rad(90 - height / 2) + (useGlobeProjection ? rotLat : 0), deg2Rad(height));
72059
- if (!useGlobeProjection) {
72060
- // rotate obj instead. order matters, rotate longitudinally first.
72061
- obj.setRotationFromEuler(new THREE$6.Euler(rotLat, rotLng, 0, 'YXZ'));
72062
- }
72063
- };
72064
- var targetD = {
72065
- lat: +latAccessor(d),
72066
- lng: +lngAccessor(d),
72067
- alt: +altitudeAccessor(d),
72068
- width: +widthAccessor(d),
72069
- height: +heightAccessor(d)
72070
- };
72071
- var currentTargetD = obj.__currentTargetD || Object.assign({}, targetD, {
72072
- width: 0,
72073
- height: 0
72074
- });
72075
- if (Object.keys(targetD).some(function (k) {
72076
- return currentTargetD[k] !== targetD[k];
72077
- })) {
72078
- if (!state.tilesTransitionDuration || state.tilesTransitionDuration < 0) {
72079
- // set final position
72080
- applyPosition(targetD);
72081
- } else {
72082
- // animate
72083
- state.tweenGroup.add(new Tween(currentTargetD).to(targetD, state.tilesTransitionDuration).easing(Easing.Quadratic.InOut).onUpdate(applyPosition).start());
72084
- }
72075
+ // animations
72076
+ var applyPosition = function applyPosition(td) {
72077
+ var _obj$__currentTargetD = obj.__currentTargetD = td,
72078
+ lat = _obj$__currentTargetD.lat,
72079
+ lng = _obj$__currentTargetD.lng,
72080
+ alt = _obj$__currentTargetD.alt,
72081
+ width = _obj$__currentTargetD.width,
72082
+ height = _obj$__currentTargetD.height;
72083
+ var rotLng = deg2Rad(lng);
72084
+ var rotLat = deg2Rad(-lat);
72085
+ obj.geometry && obj.geometry.dispose();
72086
+ obj.geometry = new THREE$6.SphereGeometry(GLOBE_RADIUS * (1 + alt), Math.ceil(width / (curvatureResolution || -1)), Math.ceil(height / (curvatureResolution || -1)), deg2Rad(90 - width / 2) + (useGlobeProjection ? rotLng : 0), deg2Rad(width), deg2Rad(90 - height / 2) + (useGlobeProjection ? rotLat : 0), deg2Rad(height));
72087
+ if (!useGlobeProjection) {
72088
+ // rotate obj instead. order matters, rotate longitudinally first.
72089
+ obj.setRotationFromEuler(new THREE$6.Euler(rotLat, rotLng, 0, 'YXZ'));
72090
+ }
72091
+ };
72092
+ var targetD = {
72093
+ lat: +latAccessor(d),
72094
+ lng: +lngAccessor(d),
72095
+ alt: +altitudeAccessor(d),
72096
+ width: +widthAccessor(d),
72097
+ height: +heightAccessor(d)
72098
+ };
72099
+ var currentTargetD = obj.__currentTargetD || Object.assign({}, targetD, {
72100
+ width: 0,
72101
+ height: 0
72102
+ });
72103
+ if (Object.keys(targetD).some(function (k) {
72104
+ return currentTargetD[k] !== targetD[k];
72105
+ })) {
72106
+ if (!state.tilesTransitionDuration || state.tilesTransitionDuration < 0) {
72107
+ // set final position
72108
+ applyPosition(targetD);
72109
+ } else {
72110
+ // animate
72111
+ state.tweenGroup.add(new Tween(currentTargetD).to(targetD, state.tilesTransitionDuration).easing(Easing.Quadratic.InOut).onUpdate(applyPosition).start());
72085
72112
  }
72086
72113
  }
72087
- });
72114
+ }).digest(state.tilesData);
72088
72115
  }
72089
72116
  });
72090
72117
  var deg2Rad = function deg2Rad(deg) {
@@ -72177,6 +72204,26 @@ void main() {
72177
72204
  // Main three object to manipulate
72178
72205
  state.scene = threeObj;
72179
72206
  state.tweenGroup = tweenGroup;
72207
+ var circleGeometry = new THREE$5.CircleGeometry(1, 32);
72208
+ state.dataMapper = new ThreeDigest(threeObj, {
72209
+ objBindAttr: '__threeObjLabel'
72210
+ }).onCreateObj(function () {
72211
+ var material = new THREE$5.MeshLambertMaterial();
72212
+ material.side = DoubleSide;
72213
+ var obj = new THREE$5.Group(); // container
72214
+
72215
+ obj.add(new THREE$5.Mesh(circleGeometry, material)); // dot
72216
+ var textObj = new THREE$5.Mesh(undefined, material);
72217
+ obj.add(textObj); // text
72218
+
72219
+ // text invisible bounding box (raycaster trap)
72220
+ var bbObj = new THREE$5.Mesh();
72221
+ bbObj.visible = false;
72222
+ textObj.add(bbObj);
72223
+ obj.__globeObjType = 'label'; // Add object type
72224
+
72225
+ return obj;
72226
+ });
72180
72227
  },
72181
72228
  update: function update(state) {
72182
72229
  // Data accessors
@@ -72192,123 +72239,103 @@ void main() {
72192
72239
  var dotOrientationAccessor = index$1(state.labelDotOrientation);
72193
72240
  var orientations = new Set(['right', 'top', 'bottom']);
72194
72241
  var pxPerDeg = 2 * Math.PI * GLOBE_RADIUS / 360;
72195
- var circleGeometry = new THREE$5.CircleGeometry(1, 32);
72196
- threeDigest(state.labelsData, state.scene, {
72197
- createObj: function createObj() {
72198
- var material = new THREE$5.MeshLambertMaterial();
72199
- material.side = DoubleSide;
72200
- var obj = new THREE$5.Group(); // container
72201
-
72202
- obj.add(new THREE$5.Mesh(circleGeometry, material)); // dot
72203
- var textObj = new THREE$5.Mesh(undefined, material);
72204
- obj.add(textObj); // text
72205
-
72206
- // text invisible bounding box (raycaster trap)
72207
- var bbObj = new THREE$5.Mesh();
72208
- bbObj.visible = false;
72209
- textObj.add(bbObj);
72210
- obj.__globeObjType = 'label'; // Add object type
72211
-
72212
- return obj;
72213
- },
72214
- updateObj: function updateObj(obj, d) {
72215
- var _obj$children = _slicedToArray$1(obj.children, 2),
72216
- dotObj = _obj$children[0],
72217
- textObj = _obj$children[1];
72218
- var _textObj$children = _slicedToArray$1(textObj.children, 1),
72219
- bbObj = _textObj$children[0];
72220
-
72221
- // update color
72222
- var color = colorAccessor(d);
72223
- var opacity = colorAlpha(color);
72224
- textObj.material.color.set(colorStr2Hex(color));
72225
- textObj.material.transparent = opacity < 1;
72226
- textObj.material.opacity = opacity;
72227
-
72228
- // update dot
72229
- var includeDot = includeDotAccessor(d);
72230
- var dotOrient = dotOrientationAccessor(d);
72231
- !includeDot || !orientations.has(dotOrient) && (dotOrient = 'bottom');
72232
-
72233
- // size dot
72234
- var dotR = includeDot ? +dotRadiusAccessor(d) * pxPerDeg : 1e-12;
72235
- dotObj.scale.x = dotObj.scale.y = dotR;
72236
-
72237
- // create text geometry
72238
- var textHeight = +sizeAccessor(d) * pxPerDeg;
72239
- textObj.geometry && textObj.geometry.dispose();
72240
- textObj.geometry = new THREE$5.TextGeometry(textAccessor(d), {
72241
- font: state.font,
72242
- size: textHeight,
72243
- depth: 0,
72244
- height: 0,
72245
- curveSegments: state.labelResolution
72246
- });
72242
+ state.dataMapper.onUpdateObj(function (obj, d) {
72243
+ var _obj$children = _slicedToArray$1(obj.children, 2),
72244
+ dotObj = _obj$children[0],
72245
+ textObj = _obj$children[1];
72246
+ var _textObj$children = _slicedToArray$1(textObj.children, 1),
72247
+ bbObj = _textObj$children[0];
72248
+
72249
+ // update color
72250
+ var color = colorAccessor(d);
72251
+ var opacity = colorAlpha(color);
72252
+ textObj.material.color.set(colorStr2Hex(color));
72253
+ textObj.material.transparent = opacity < 1;
72254
+ textObj.material.opacity = opacity;
72255
+
72256
+ // update dot
72257
+ var includeDot = includeDotAccessor(d);
72258
+ var dotOrient = dotOrientationAccessor(d);
72259
+ !includeDot || !orientations.has(dotOrient) && (dotOrient = 'bottom');
72260
+
72261
+ // size dot
72262
+ var dotR = includeDot ? +dotRadiusAccessor(d) * pxPerDeg : 1e-12;
72263
+ dotObj.scale.x = dotObj.scale.y = dotR;
72264
+
72265
+ // create text geometry
72266
+ var textHeight = +sizeAccessor(d) * pxPerDeg;
72267
+ textObj.geometry && textObj.geometry.dispose();
72268
+ textObj.geometry = new THREE$5.TextGeometry(textAccessor(d), {
72269
+ font: state.font,
72270
+ size: textHeight,
72271
+ depth: 0,
72272
+ height: 0,
72273
+ curveSegments: state.labelResolution
72274
+ });
72247
72275
 
72248
- // update text convex hull/bounding box
72249
- bbObj.geometry && bbObj.geometry.dispose();
72250
- textObj.geometry.computeBoundingBox();
72251
- bbObj.geometry = _construct$1(THREE$5.BoxGeometry, _toConsumableArray$1(new THREE$5.Vector3().subVectors(textObj.geometry.boundingBox.max, textObj.geometry.boundingBox.min).toArray()));
72252
-
72253
- // center text (otherwise anchor is on bottom-left)
72254
- dotOrient !== 'right' && textObj.geometry.center();
72255
- if (includeDot) {
72256
- // translate text
72257
- var padding = dotR + textHeight / 2;
72258
- dotOrient === 'right' && (textObj.position.x = padding);
72259
- textObj.position.y = {
72260
- right: -textHeight / 2,
72261
- // center vertically
72262
- top: padding + textHeight / 2,
72263
- bottom: -padding - textHeight / 2
72264
- }[dotOrient];
72265
- }
72276
+ // update text convex hull/bounding box
72277
+ bbObj.geometry && bbObj.geometry.dispose();
72278
+ textObj.geometry.computeBoundingBox();
72279
+ bbObj.geometry = _construct$1(THREE$5.BoxGeometry, _toConsumableArray$1(new THREE$5.Vector3().subVectors(textObj.geometry.boundingBox.max, textObj.geometry.boundingBox.min).toArray()));
72280
+
72281
+ // center text (otherwise anchor is on bottom-left)
72282
+ dotOrient !== 'right' && textObj.geometry.center();
72283
+ if (includeDot) {
72284
+ // translate text
72285
+ var padding = dotR + textHeight / 2;
72286
+ dotOrient === 'right' && (textObj.position.x = padding);
72287
+ textObj.position.y = {
72288
+ right: -textHeight / 2,
72289
+ // center vertically
72290
+ top: padding + textHeight / 2,
72291
+ bottom: -padding - textHeight / 2
72292
+ }[dotOrient];
72293
+ }
72266
72294
 
72267
- // animations
72268
- var applyPosition = function applyPosition(td) {
72269
- var _obj$__currentTargetD = obj.__currentTargetD = td,
72270
- lat = _obj$__currentTargetD.lat,
72271
- lng = _obj$__currentTargetD.lng,
72272
- alt = _obj$__currentTargetD.alt,
72273
- rot = _obj$__currentTargetD.rot,
72274
- scale = _obj$__currentTargetD.scale;
72295
+ // animations
72296
+ var applyPosition = function applyPosition(td) {
72297
+ var _obj$__currentTargetD = obj.__currentTargetD = td,
72298
+ lat = _obj$__currentTargetD.lat,
72299
+ lng = _obj$__currentTargetD.lng,
72300
+ alt = _obj$__currentTargetD.alt,
72301
+ rot = _obj$__currentTargetD.rot,
72302
+ scale = _obj$__currentTargetD.scale;
72275
72303
 
72276
- // position center
72277
- Object.assign(obj.position, polar2Cartesian(lat, lng, alt));
72304
+ // position center
72305
+ Object.assign(obj.position, polar2Cartesian(lat, lng, alt));
72278
72306
 
72279
- // rotate
72280
- obj.lookAt(state.scene.localToWorld(new THREE$5.Vector3(0, 0, 0))); // face globe (local) center
72281
- obj.rotateY(Math.PI); // face outwards
72307
+ // rotate
72308
+ obj.lookAt(state.scene.localToWorld(new THREE$5.Vector3(0, 0, 0))); // face globe (local) center
72309
+ obj.rotateY(Math.PI); // face outwards
72282
72310
 
72283
- // rotate clockwise relative to lat parallel
72284
- obj.rotateZ(-rot * Math.PI / 180);
72311
+ // rotate clockwise relative to lat parallel
72312
+ obj.rotateZ(-rot * Math.PI / 180);
72285
72313
 
72286
- // scale it
72287
- obj.scale.x = obj.scale.y = obj.scale.z = scale;
72288
- };
72289
- var targetD = {
72290
- lat: +latAccessor(d),
72291
- lng: +lngAccessor(d),
72292
- alt: +altitudeAccessor(d),
72293
- rot: +rotationAccessor(d),
72294
- scale: 1
72295
- };
72296
- var currentTargetD = obj.__currentTargetD || Object.assign({}, targetD, {
72297
- scale: 1e-12
72298
- });
72299
- if (Object.keys(targetD).some(function (k) {
72300
- return currentTargetD[k] !== targetD[k];
72301
- })) {
72302
- if (!state.labelsTransitionDuration || state.labelsTransitionDuration < 0) {
72303
- // set final position
72304
- applyPosition(targetD);
72305
- } else {
72306
- // animate
72307
- state.tweenGroup.add(new Tween(currentTargetD).to(targetD, state.labelsTransitionDuration).easing(Easing.Quadratic.InOut).onUpdate(applyPosition).start());
72308
- }
72314
+ // scale it
72315
+ obj.scale.x = obj.scale.y = obj.scale.z = scale;
72316
+ };
72317
+ var targetD = {
72318
+ lat: +latAccessor(d),
72319
+ lng: +lngAccessor(d),
72320
+ alt: +altitudeAccessor(d),
72321
+ rot: +rotationAccessor(d),
72322
+ scale: 1
72323
+ };
72324
+ var currentTargetD = obj.__currentTargetD || Object.assign({}, targetD, {
72325
+ scale: 1e-12
72326
+ });
72327
+ if (Object.keys(targetD).some(function (k) {
72328
+ return currentTargetD[k] !== targetD[k];
72329
+ })) {
72330
+ if (!state.labelsTransitionDuration || state.labelsTransitionDuration < 0) {
72331
+ // set final position
72332
+ applyPosition(targetD);
72333
+ } else {
72334
+ // animate
72335
+ state.tweenGroup.add(new Tween(currentTargetD).to(targetD, state.labelsTransitionDuration).easing(Easing.Quadratic.InOut).onUpdate(applyPosition).start());
72309
72336
  }
72310
72337
  }
72311
- });
72338
+ }).digest(state.labelsData);
72312
72339
  }
72313
72340
  });
72314
72341
 
@@ -72416,6 +72443,14 @@ void main() {
72416
72443
  // Main three object to manipulate
72417
72444
  state.scene = threeObj;
72418
72445
  state.tweenGroup = tweenGroup;
72446
+ state.dataMapper = new ThreeDigest(threeObj, {
72447
+ objBindAttr: '__threeObjRing',
72448
+ removeDelay: 30000 // wait until all rings are gone
72449
+ }).onCreateObj(function () {
72450
+ var obj = new THREE$3.Group();
72451
+ obj.__globeObjType = 'ring'; // Add object type
72452
+ return obj;
72453
+ });
72419
72454
  state.ticker = new FrameTicker();
72420
72455
  state.ticker.onTick.add(function (time) {
72421
72456
  if (!state.ringsData.length) return;
@@ -72426,10 +72461,14 @@ void main() {
72426
72461
  var maxRadiusAccessor = index$1(state.ringMaxRadius);
72427
72462
  var propagationSpeedAccessor = index$1(state.ringPropagationSpeed);
72428
72463
  var repeatPeriodAccessor = index$1(state.ringRepeatPeriod);
72429
- state.ringsData.filter(function (d) {
72430
- return d.__threeObj;
72431
- }).forEach(function (d) {
72432
- var obj = d.__threeObj;
72464
+ state.dataMapper.entries().filter(function (_ref2) {
72465
+ var _ref3 = _slicedToArray$1(_ref2, 2),
72466
+ o = _ref3[1];
72467
+ return o;
72468
+ }).forEach(function (_ref4) {
72469
+ var _ref5 = _slicedToArray$1(_ref4, 2),
72470
+ d = _ref5[0],
72471
+ obj = _ref5[1];
72433
72472
  if ((obj.__nextRingTime || 0) <= time) {
72434
72473
  // time to add a new ring
72435
72474
  var periodSecs = repeatPeriodAccessor(d) / 1000;
@@ -72461,8 +72500,8 @@ void main() {
72461
72500
  var maxAngle = maxRadius * Math.PI / 180; // in radians
72462
72501
  var propagationSpeed = propagationSpeedAccessor(d);
72463
72502
  var isReverse = propagationSpeed <= 0;
72464
- var updateFn = function updateFn(_ref2) {
72465
- var t = _ref2.t;
72503
+ var updateFn = function updateFn(_ref6) {
72504
+ var t = _ref6.t;
72466
72505
  var ang = (isReverse ? 1 - t : t) * maxAngle;
72467
72506
  circleObj.scale.x = circleObj.scale.y = curveR * Math.sin(ang);
72468
72507
  circleObj.position.z = curveR * (1 - Math.cos(ang));
@@ -72499,27 +72538,16 @@ void main() {
72499
72538
  var latAccessor = index$1(state.ringLat);
72500
72539
  var lngAccessor = index$1(state.ringLng);
72501
72540
  var altitudeAccessor = index$1(state.ringAltitude);
72502
- var globeCenter = state.scene.localToWorld(new THREE$3.Vector3(0, 0, 0)); // translate from local to world coords
72503
-
72504
- threeDigest(state.ringsData, state.scene, {
72505
- createObj: function createObj() {
72506
- var obj = new THREE$3.Group();
72507
- obj.__globeObjType = 'ring'; // Add object type
72508
- return obj;
72509
- },
72510
- updateObj: function updateObj(obj, d) {
72511
- var lat = latAccessor(d);
72512
- var lng = lngAccessor(d);
72513
- var alt = altitudeAccessor(d);
72514
-
72515
- // position & orientate inwards
72516
- Object.assign(obj.position, polar2Cartesian(lat, lng, alt));
72517
- obj.lookAt(globeCenter);
72518
- }
72519
- }, {
72520
- removeDelay: 30000
72521
- } // wait until all rings are gone
72522
- );
72541
+ var globeCenter = new THREE$3.Vector3(0, 0, 0);
72542
+ state.dataMapper.onUpdateObj(function (obj, d) {
72543
+ var lat = latAccessor(d);
72544
+ var lng = lngAccessor(d);
72545
+ var alt = altitudeAccessor(d);
72546
+
72547
+ // position & orientate inwards
72548
+ Object.assign(obj.position, polar2Cartesian(lat, lng, alt));
72549
+ obj.lookAt(globeCenter);
72550
+ }).digest(state.ringsData);
72523
72551
  }
72524
72552
  });
72525
72553
 
@@ -72560,9 +72588,12 @@ void main() {
72560
72588
  },
72561
72589
  methods: {
72562
72590
  updateObjVisibility: function updateObjVisibility(state, obj) {
72591
+ if (!state.dataMapper) return;
72563
72592
  // default to all if no obj specified
72564
- var objs = obj ? [obj] : state.htmlElementsData.map(function (d) {
72565
- return d.__threeObj;
72593
+ var objs = obj ? [obj] : state.dataMapper.entries().map(function (_ref) {
72594
+ var _ref2 = _slicedToArray$1(_ref, 2),
72595
+ o = _ref2[1];
72596
+ return o;
72566
72597
  }).filter(function (d) {
72567
72598
  return d;
72568
72599
  });
@@ -72572,14 +72603,23 @@ void main() {
72572
72603
  });
72573
72604
  }
72574
72605
  },
72575
- init: function init(threeObj, state, _ref) {
72576
- var tweenGroup = _ref.tweenGroup;
72606
+ init: function init(threeObj, state, _ref3) {
72607
+ var tweenGroup = _ref3.tweenGroup;
72577
72608
  // Clear the scene
72578
72609
  emptyObject(threeObj);
72579
72610
 
72580
72611
  // Main three object to manipulate
72581
72612
  state.scene = threeObj;
72582
72613
  state.tweenGroup = tweenGroup;
72614
+ state.dataMapper = new ThreeDigest(threeObj, {
72615
+ objBindAttr: '__threeObjHtml'
72616
+ }).onCreateObj(function (d) {
72617
+ var elem = index$1(state.htmlElement)(d);
72618
+ var obj = new THREE$2.CSS2DObject(elem);
72619
+ obj.__globeObjType = 'html'; // Add object type
72620
+
72621
+ return obj;
72622
+ });
72583
72623
  },
72584
72624
  update: function update(state, changedProps) {
72585
72625
  var _this = this;
@@ -72587,45 +72627,37 @@ void main() {
72587
72627
  var latAccessor = index$1(state.htmlLat);
72588
72628
  var lngAccessor = index$1(state.htmlLng);
72589
72629
  var altitudeAccessor = index$1(state.htmlAltitude);
72590
- var elemAccessor = index$1(state.htmlElement);
72591
- threeDigest(state.htmlElementsData, state.scene, {
72592
- // objs need to be recreated if this prop has changed
72593
- purge: changedProps.hasOwnProperty('htmlElement'),
72594
- createObj: function createObj(d) {
72595
- var elem = elemAccessor(d);
72596
- var obj = new THREE$2.CSS2DObject(elem);
72597
- obj.__globeObjType = 'html'; // Add object type
72598
72630
 
72599
- return obj;
72600
- },
72601
- updateObj: function updateObj(obj, d) {
72602
- var applyUpdate = function applyUpdate(td) {
72603
- var _obj$__currentTargetD = obj.__currentTargetD = td,
72604
- alt = _obj$__currentTargetD.alt,
72605
- lat = _obj$__currentTargetD.lat,
72606
- lng = _obj$__currentTargetD.lng;
72607
- Object.assign(obj.position, polar2Cartesian(lat, lng, alt));
72608
- _this.updateObjVisibility(obj);
72609
- };
72610
- var targetD = {
72611
- lat: +latAccessor(d),
72612
- lng: +lngAccessor(d),
72613
- alt: +altitudeAccessor(d)
72614
- };
72615
- if (!state.htmlTransitionDuration || state.htmlTransitionDuration < 0 || !obj.__currentTargetD) {
72616
- // set final position
72617
- applyUpdate(targetD);
72618
- } else {
72619
- // animate
72620
- state.tweenGroup.add(new Tween(obj.__currentTargetD).to(targetD, state.htmlTransitionDuration).easing(Easing.Quadratic.InOut).onUpdate(applyUpdate).start());
72621
- }
72631
+ // objs need to be recreated if this prop has changed
72632
+ changedProps.hasOwnProperty('htmlElement') && state.dataMapper.clear();
72633
+ state.dataMapper.onUpdateObj(function (obj, d) {
72634
+ var applyUpdate = function applyUpdate(td) {
72635
+ var _obj$__currentTargetD = obj.__currentTargetD = td,
72636
+ alt = _obj$__currentTargetD.alt,
72637
+ lat = _obj$__currentTargetD.lat,
72638
+ lng = _obj$__currentTargetD.lng;
72639
+ Object.assign(obj.position, polar2Cartesian(lat, lng, alt));
72640
+ _this.updateObjVisibility(obj);
72641
+ };
72642
+ var targetD = {
72643
+ lat: +latAccessor(d),
72644
+ lng: +lngAccessor(d),
72645
+ alt: +altitudeAccessor(d)
72646
+ };
72647
+ if (!state.htmlTransitionDuration || state.htmlTransitionDuration < 0 || !obj.__currentTargetD) {
72648
+ // set final position
72649
+ applyUpdate(targetD);
72650
+ } else {
72651
+ // animate
72652
+ state.tweenGroup.add(new Tween(obj.__currentTargetD).to(targetD, state.htmlTransitionDuration).easing(Easing.Quadratic.InOut).onUpdate(applyUpdate).start());
72622
72653
  }
72623
- });
72654
+ }).digest(state.htmlElementsData);
72624
72655
  }
72625
72656
  });
72626
72657
 
72627
72658
  var THREE$1 = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
72628
72659
  : {
72660
+ Euler: Euler,
72629
72661
  Group: Group$1,
72630
72662
  Mesh: Mesh,
72631
72663
  MeshLambertMaterial: MeshLambertMaterial,
@@ -72669,6 +72701,20 @@ void main() {
72669
72701
 
72670
72702
  // Main three object to manipulate
72671
72703
  state.scene = threeObj;
72704
+ state.dataMapper = new ThreeDigest(threeObj, {
72705
+ objBindAttr: '__threeObjObject'
72706
+ }).onCreateObj(function (d) {
72707
+ var obj = index$1(state.objectThreeObject)(d);
72708
+ if (state.objectThreeObject === obj) {
72709
+ // clone object if it's a shared object among all points
72710
+ obj = obj.clone();
72711
+ }
72712
+ var g = new THREE$1.Group();
72713
+ g.add(obj);
72714
+ g.__globeObjType = 'object'; // Add object type
72715
+
72716
+ return g;
72717
+ });
72672
72718
  },
72673
72719
  update: function update(state, changedProps) {
72674
72720
  // Data accessors
@@ -72677,33 +72723,19 @@ void main() {
72677
72723
  var altitudeAccessor = index$1(state.objectAltitude);
72678
72724
  var parallelAccessor = index$1(state.objectFacesSurface);
72679
72725
  var rotationAccessor = index$1(state.objectRotation);
72680
- var threeObjAccessor = index$1(state.objectThreeObject);
72681
- threeDigest(state.objectsData, state.scene, {
72682
- // objs need to be recreated if this prop has changed
72683
- purge: changedProps.hasOwnProperty('objectThreeObject'),
72684
- createObj: function createObj(d) {
72685
- var obj = threeObjAccessor(d);
72686
- if (state.objectThreeObject === obj) {
72687
- // clone object if it's a shared object among all points
72688
- obj = obj.clone();
72689
- }
72690
- var g = new THREE$1.Group();
72691
- g.add(obj);
72692
- g.__globeObjType = 'object'; // Add object type
72693
72726
 
72694
- return g;
72695
- },
72696
- updateObj: function updateObj(objG, d) {
72697
- var lat = +latAccessor(d);
72698
- var lng = +lngAccessor(d);
72699
- var alt = +altitudeAccessor(d);
72700
- Object.assign(objG.position, polar2Cartesian(lat, lng, alt));
72701
- parallelAccessor(d) ? objG.setRotationFromEuler(new Euler(deg2Rad$1(-lat), deg2Rad$1(lng), 0, 'YXZ')) : objG.rotation.set(0, 0, 0);
72702
- var obj = objG.children[0];
72703
- var rot = rotationAccessor(d);
72704
- rot && obj.setRotationFromEuler(new Euler(deg2Rad$1(rot.x || 0), deg2Rad$1(rot.y || 0), deg2Rad$1(rot.z || 0)));
72705
- }
72706
- });
72727
+ // objs need to be recreated if this prop has changed
72728
+ changedProps.hasOwnProperty('objectThreeObject') && state.dataMapper.clear();
72729
+ state.dataMapper.onUpdateObj(function (objG, d) {
72730
+ var lat = +latAccessor(d);
72731
+ var lng = +lngAccessor(d);
72732
+ var alt = +altitudeAccessor(d);
72733
+ Object.assign(objG.position, polar2Cartesian(lat, lng, alt));
72734
+ parallelAccessor(d) ? objG.setRotationFromEuler(new Euler(deg2Rad$1(-lat), deg2Rad$1(lng), 0, 'YXZ')) : objG.rotation.set(0, 0, 0);
72735
+ var obj = objG.children[0];
72736
+ var rot = rotationAccessor(d);
72737
+ rot && obj.setRotationFromEuler(new Euler(deg2Rad$1(rot.x || 0), deg2Rad$1(rot.y || 0), deg2Rad$1(rot.z || 0)));
72738
+ }).digest(state.objectsData);
72707
72739
  }
72708
72740
  });
72709
72741
 
@@ -72725,32 +72757,32 @@ void main() {
72725
72757
 
72726
72758
  // Main three object to manipulate
72727
72759
  state.scene = threeObj;
72760
+ state.dataMapper = new ThreeDigest(threeObj, {
72761
+ objBindAttr: '__threeObjCustom'
72762
+ }).onCreateObj(function (d) {
72763
+ var obj = index$1(state.customThreeObject)(d, GLOBE_RADIUS);
72764
+ if (obj) {
72765
+ if (state.customThreeObject === obj) {
72766
+ // clone object if it's a shared object among all points
72767
+ obj = obj.clone();
72768
+ }
72769
+ obj.__globeObjType = 'custom'; // Add object type
72770
+ }
72771
+ return obj;
72772
+ });
72728
72773
  },
72729
72774
  update: function update(state, changedProps) {
72730
72775
  if (!state.customThreeObjectUpdate) {
72731
72776
  emptyObject(state.scene);
72732
72777
  } // Clear the existing objects to create all new, if there's no update method (brute-force)
72733
72778
 
72734
- var customObjectAccessor = index$1(state.customThreeObject);
72735
72779
  var customObjectUpdateAccessor = index$1(state.customThreeObjectUpdate);
72736
- threeDigest(state.customLayerData, state.scene, {
72737
- // objs need to be recreated if this prop has changed
72738
- purge: changedProps.hasOwnProperty('customThreeObject'),
72739
- createObj: function createObj(d) {
72740
- var obj = customObjectAccessor(d, GLOBE_RADIUS);
72741
- if (obj) {
72742
- if (state.customThreeObject === obj) {
72743
- // clone object if it's a shared object among all points
72744
- obj = obj.clone();
72745
- }
72746
- obj.__globeObjType = 'custom'; // Add object type
72747
- }
72748
- return obj;
72749
- },
72750
- updateObj: function updateObj(obj, d) {
72751
- return customObjectUpdateAccessor(obj, d, GLOBE_RADIUS);
72752
- }
72753
- });
72780
+
72781
+ // objs need to be recreated if this prop has changed
72782
+ changedProps.hasOwnProperty('customThreeObject') && state.dataMapper.clear();
72783
+ state.dataMapper.onUpdateObj(function (obj, d) {
72784
+ return customObjectUpdateAccessor(obj, d, GLOBE_RADIUS);
72785
+ }).digest(state.customLayerData);
72754
72786
  }
72755
72787
  });
72756
72788
 
@@ -115142,7 +115174,7 @@ var<${access}> ${name} : ${structName};`;
115142
115174
  }
115143
115175
 
115144
115176
  var _excluded = ["rendererConfig", "waitForGlobeReady"];
115145
- var THREE = _objectSpread2$2(_objectSpread2$2({}, window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
115177
+ var THREE = _objectSpread2$1(_objectSpread2$1({}, window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
115146
115178
  : {
115147
115179
  AmbientLight: AmbientLight,
115148
115180
  DirectionalLight: DirectionalLight,
@@ -115157,25 +115189,25 @@ var<${access}> ${name} : ${structName};`;
115157
115189
  // Expose config from ThreeGlobe
115158
115190
  var bindGlobe = linkKapsule('globe', threeGlobe);
115159
115191
  var linkedGlobeProps = Object.assign.apply(Object, _toConsumableArray$5(['globeImageUrl', 'bumpImageUrl', 'showGlobe', 'showGraticules', 'showAtmosphere', 'atmosphereColor', 'atmosphereAltitude', 'onGlobeReady', 'pointsData', 'pointLat', 'pointLng', 'pointColor', 'pointAltitude', 'pointRadius', 'pointResolution', 'pointsMerge', 'pointsTransitionDuration', 'arcsData', 'arcStartLat', 'arcStartLng', 'arcEndLat', 'arcEndLng', 'arcColor', 'arcAltitude', 'arcAltitudeAutoScale', 'arcStroke', 'arcCurveResolution', 'arcCircularResolution', 'arcDashLength', 'arcDashGap', 'arcDashInitialGap', 'arcDashAnimateTime', 'arcsTransitionDuration', 'polygonsData', 'polygonGeoJsonGeometry', 'polygonCapColor', 'polygonCapMaterial', 'polygonSideColor', 'polygonSideMaterial', 'polygonStrokeColor', 'polygonAltitude', 'polygonCapCurvatureResolution', 'polygonsTransitionDuration', 'pathsData', 'pathPoints', 'pathPointLat', 'pathPointLng', 'pathPointAlt', 'pathResolution', 'pathColor', 'pathStroke', 'pathDashLength', 'pathDashGap', 'pathDashInitialGap', 'pathDashAnimateTime', 'pathTransitionDuration', 'heatmapsData', 'heatmapPoints', 'heatmapPointLat', 'heatmapPointLng', 'heatmapPointWeight', 'heatmapBandwidth', 'heatmapColorFn', 'heatmapColorSaturation', 'heatmapBaseAltitude', 'heatmapTopAltitude', 'heatmapsTransitionDuration', 'hexBinPointsData', 'hexBinPointLat', 'hexBinPointLng', 'hexBinPointWeight', 'hexBinResolution', 'hexMargin', 'hexTopCurvatureResolution', 'hexTopColor', 'hexSideColor', 'hexAltitude', 'hexBinMerge', 'hexTransitionDuration', 'hexPolygonsData', 'hexPolygonGeoJsonGeometry', 'hexPolygonColor', 'hexPolygonAltitude', 'hexPolygonResolution', 'hexPolygonMargin', 'hexPolygonUseDots', 'hexPolygonCurvatureResolution', 'hexPolygonDotResolution', 'hexPolygonsTransitionDuration', 'tilesData', 'tileLat', 'tileLng', 'tileAltitude', 'tileWidth', 'tileHeight', 'tileUseGlobeProjection', 'tileMaterial', 'tileCurvatureResolution', 'tilesTransitionDuration', 'ringsData', 'ringLat', 'ringLng', 'ringAltitude', 'ringColor', 'ringResolution', 'ringMaxRadius', 'ringPropagationSpeed', 'ringRepeatPeriod', 'labelsData', 'labelLat', 'labelLng', 'labelAltitude', 'labelRotation', 'labelText', 'labelSize', 'labelTypeFace', 'labelColor', 'labelResolution', 'labelIncludeDot', 'labelDotRadius', 'labelDotOrientation', 'labelsTransitionDuration', 'htmlElementsData', 'htmlLat', 'htmlLng', 'htmlAltitude', 'htmlElement', 'htmlTransitionDuration', 'objectsData', 'objectLat', 'objectLng', 'objectAltitude', 'objectRotation', 'objectFacesSurface', 'objectThreeObject', 'customLayerData', 'customThreeObject', 'customThreeObjectUpdate'].map(function (p) {
115160
- return _defineProperty$3({}, p, bindGlobe.linkProp(p));
115192
+ return _defineProperty$2({}, p, bindGlobe.linkProp(p));
115161
115193
  })));
115162
115194
  var linkedGlobeMethods = Object.assign.apply(Object, _toConsumableArray$5(['globeMaterial', 'getGlobeRadius', 'getCoords', 'toGeoCoords'].map(function (p) {
115163
- return _defineProperty$3({}, p, bindGlobe.linkMethod(p));
115195
+ return _defineProperty$2({}, p, bindGlobe.linkMethod(p));
115164
115196
  })));
115165
115197
 
115166
115198
  // Expose config from renderObjs
115167
115199
  var bindRenderObjs = linkKapsule('renderObjs', threeRenderObjects);
115168
115200
  var linkedRenderObjsProps = Object.assign.apply(Object, _toConsumableArray$5(['width', 'height', 'backgroundColor', 'backgroundImageUrl', 'enablePointerInteraction'].map(function (p) {
115169
- return _defineProperty$3({}, p, bindRenderObjs.linkProp(p));
115201
+ return _defineProperty$2({}, p, bindRenderObjs.linkProp(p));
115170
115202
  })));
115171
115203
  var linkedRenderObjsMethods = Object.assign.apply(Object, _toConsumableArray$5(['lights', 'postProcessingComposer'].map(function (p) {
115172
- return _defineProperty$3({}, p, bindRenderObjs.linkMethod(p));
115204
+ return _defineProperty$2({}, p, bindRenderObjs.linkMethod(p));
115173
115205
  })));
115174
115206
 
115175
115207
  //
115176
115208
 
115177
115209
  var globe = index$2({
115178
- props: _objectSpread2$2(_objectSpread2$2({
115210
+ props: _objectSpread2$1(_objectSpread2$1({
115179
115211
  onZoom: {
115180
115212
  triggerUpdate: false
115181
115213
  },
@@ -115340,7 +115372,7 @@ var<${access}> ${name} : ${structName};`;
115340
115372
  }
115341
115373
  }
115342
115374
  }, linkedGlobeProps), linkedRenderObjsProps),
115343
- methods: _objectSpread2$2(_objectSpread2$2({
115375
+ methods: _objectSpread2$1(_objectSpread2$1({
115344
115376
  pauseAnimation: function pauseAnimation(state) {
115345
115377
  var _state$globe;
115346
115378
  if (state.animationFrameRequestId !== null) {
@@ -115462,8 +115494,8 @@ var<${access}> ${name} : ${structName};`;
115462
115494
  var rendererConfig = _ref6.rendererConfig,
115463
115495
  _ref6$waitForGlobeRea = _ref6.waitForGlobeReady,
115464
115496
  waitForGlobeReady = _ref6$waitForGlobeRea === void 0 ? true : _ref6$waitForGlobeRea,
115465
- globeInitConfig = _objectWithoutProperties$3(_ref6, _excluded);
115466
- var globe = new threeGlobe(_objectSpread2$2({
115497
+ globeInitConfig = _objectWithoutProperties$2(_ref6, _excluded);
115498
+ var globe = new threeGlobe(_objectSpread2$1({
115467
115499
  waitForGlobeReady: waitForGlobeReady
115468
115500
  }, globeInitConfig));
115469
115501
  return {