hilbert-chart-3d 0.6.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -176,27 +176,11 @@ var index = Kapsule({
176
176
  controls: state => state.renderObjs.controls(),
177
177
  // Expose controls
178
178
  hoverOrderComparator: function (state, dataComp) {
179
- state.renderObjs.hoverOrderComparator((_a, _b, a, b) => {
179
+ state.renderObjs.hoverOrderComparator(dataComp && ((_a, _b, a, b) => {
180
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
- });
181
+ return !da - !db || dataComp(da, db) || a.distance - b.distance;
182
+ }));
185
183
  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
184
  },
201
185
  _destructor: function (state) {
202
186
  cancelAnimationFrame(state.animationFrameRequestId);
@@ -226,20 +210,6 @@ var index = Kapsule({
226
210
  const roDomNode = document.createElement('div');
227
211
  roDomNode.className = 'hilbert-scene-container';
228
212
  el.appendChild(roDomNode);
229
- const getHilbertObjData = (obj, intersection) => {
230
- if (!obj) return null;
231
- const hilbertObj = getHilbertObj(obj);
232
- const d = hilbertObj?.__data || null;
233
- return intersection && hilbertObj.isInstancedMesh ? d?.[intersection.instanceId] : d;
234
- function getHilbertObj(object) {
235
- let obj = object;
236
- // recurse up object chain until finding the hilbert object
237
- while (obj && !obj.hasOwnProperty('__data')) {
238
- obj = obj.parent;
239
- }
240
- return obj;
241
- }
242
- };
243
213
  state.renderObjs(roDomNode).tooltipContent((obj, intersection) => {
244
214
  const d = getHilbertObjData(obj, intersection);
245
215
  return !d ? '' : state.tooltipContent ? accessorFn(state.tooltipContent)(d) || '' : (() => {
@@ -270,5 +240,19 @@ var index = Kapsule({
270
240
  this._animationCycle();
271
241
  }
272
242
  });
243
+ function getHilbertObjData(obj, intersection) {
244
+ if (!obj) return null;
245
+ const hilbertObj = getHilbertObj(obj);
246
+ const d = hilbertObj?.__data || null;
247
+ return intersection && hilbertObj.isInstancedMesh ? d?.[intersection.instanceId] : d;
248
+ function getHilbertObj(object) {
249
+ let obj = object;
250
+ // recurse up object chain until finding the hilbert object
251
+ while (obj && !obj.hasOwnProperty('__data')) {
252
+ obj = obj.parent;
253
+ }
254
+ return obj;
255
+ }
256
+ }
273
257
 
274
258
  export { index as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hilbert-chart-3d",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
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",