hilbert-chart-3d 0.5.0 → 0.6.0

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.
@@ -175,6 +175,29 @@ var index = Kapsule({
175
175
  // Expose renderer
176
176
  controls: state => state.renderObjs.controls(),
177
177
  // Expose controls
178
+ hoverOrderComparator: function (state, dataComp) {
179
+ state.renderObjs.hoverOrderComparator((_a, _b, a, b) => {
180
+ const [da, db] = [a, b].map(i => getHilbertObjData(i?.object, i));
181
+ if (!da) return 1;
182
+ if (!db) return -1;
183
+ return dataComp(da, db);
184
+ });
185
+ return this;
186
+ function getHilbertObjData(obj, intersection) {
187
+ if (!obj) return null;
188
+ const hilbertObj = getHilbertObj(obj);
189
+ const d = hilbertObj?.__data || null;
190
+ return intersection && hilbertObj.isInstancedMesh ? d?.[intersection.instanceId] : d;
191
+ function getHilbertObj(object) {
192
+ let obj = object;
193
+ // recurse up object chain until finding the hilbert object
194
+ while (obj && !obj.hasOwnProperty('__data')) {
195
+ obj = obj.parent;
196
+ }
197
+ return obj;
198
+ }
199
+ }
200
+ },
178
201
  _destructor: function (state) {
179
202
  cancelAnimationFrame(state.animationFrameRequestId);
180
203
  this.data([]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hilbert-chart-3d",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "A 3d hilbert space-filling curve D3 chart for representing one-dimensional lengths on a three-dimensional space.",
5
5
  "type": "module",
6
6
  "jsdelivr": "dist/hilbert-chart-3d.min.js",
@@ -46,7 +46,7 @@
46
46
  "kapsule": "^1.16",
47
47
  "three": ">=0.179 <1",
48
48
  "three-hilbert": "1",
49
- "three-render-objects": "^1.44"
49
+ "three-render-objects": "^1.45"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@babel/core": "^8.1.0",