hilbert-chart-3d 0.5.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.
- package/README.md +1 -0
- package/dist/hilbert-chart-3d.d.ts +4 -0
- package/dist/hilbert-chart-3d.js +23 -16
- package/dist/hilbert-chart-3d.js.map +1 -1
- package/dist/hilbert-chart-3d.min.js +3 -3
- package/dist/hilbert-chart-3d.mjs +21 -14
- package/package.json +2 -2
|
@@ -175,6 +175,13 @@ 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(dataComp && ((_a, _b, a, b) => {
|
|
180
|
+
const [da, db] = [a, b].map(i => getHilbertObjData(i?.object, i));
|
|
181
|
+
return !da - !db || dataComp(da, db) || a.distance - b.distance;
|
|
182
|
+
}));
|
|
183
|
+
return this;
|
|
184
|
+
},
|
|
178
185
|
_destructor: function (state) {
|
|
179
186
|
cancelAnimationFrame(state.animationFrameRequestId);
|
|
180
187
|
this.data([]);
|
|
@@ -203,20 +210,6 @@ var index = Kapsule({
|
|
|
203
210
|
const roDomNode = document.createElement('div');
|
|
204
211
|
roDomNode.className = 'hilbert-scene-container';
|
|
205
212
|
el.appendChild(roDomNode);
|
|
206
|
-
const getHilbertObjData = (obj, intersection) => {
|
|
207
|
-
if (!obj) return null;
|
|
208
|
-
const hilbertObj = getHilbertObj(obj);
|
|
209
|
-
const d = hilbertObj?.__data || null;
|
|
210
|
-
return intersection && hilbertObj.isInstancedMesh ? d?.[intersection.instanceId] : d;
|
|
211
|
-
function getHilbertObj(object) {
|
|
212
|
-
let obj = object;
|
|
213
|
-
// recurse up object chain until finding the hilbert object
|
|
214
|
-
while (obj && !obj.hasOwnProperty('__data')) {
|
|
215
|
-
obj = obj.parent;
|
|
216
|
-
}
|
|
217
|
-
return obj;
|
|
218
|
-
}
|
|
219
|
-
};
|
|
220
213
|
state.renderObjs(roDomNode).tooltipContent((obj, intersection) => {
|
|
221
214
|
const d = getHilbertObjData(obj, intersection);
|
|
222
215
|
return !d ? '' : state.tooltipContent ? accessorFn(state.tooltipContent)(d) || '' : (() => {
|
|
@@ -247,5 +240,19 @@ var index = Kapsule({
|
|
|
247
240
|
this._animationCycle();
|
|
248
241
|
}
|
|
249
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
|
+
}
|
|
250
257
|
|
|
251
258
|
export { index as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hilbert-chart-3d",
|
|
3
|
-
"version": "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",
|
|
@@ -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.
|
|
49
|
+
"three-render-objects": "^1.45"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@babel/core": "^8.1.0",
|