hilbert-chart-3d 0.2.0 → 0.2.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/dist/hilbert-chart-3d.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Version 0.2.
|
|
1
|
+
// Version 0.2.1 hilbert-chart-3d - https://github.com/vasturiano/hilbert-chart-3d
|
|
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) :
|
|
@@ -143749,7 +143749,7 @@ var<${access}> ${ name } : ${ structName };`;
|
|
|
143749
143749
|
Q(reactElement2VNode(jsx), domEl);
|
|
143750
143750
|
};
|
|
143751
143751
|
|
|
143752
|
-
function styleInject$
|
|
143752
|
+
function styleInject$2(css, ref) {
|
|
143753
143753
|
if (ref === void 0) ref = {};
|
|
143754
143754
|
var insertAt = ref.insertAt;
|
|
143755
143755
|
if (typeof document === 'undefined') {
|
|
@@ -143774,8 +143774,8 @@ var<${access}> ${ name } : ${ structName };`;
|
|
|
143774
143774
|
}
|
|
143775
143775
|
}
|
|
143776
143776
|
|
|
143777
|
-
var css_248z$
|
|
143778
|
-
styleInject$
|
|
143777
|
+
var css_248z$2 = ".float-tooltip-kap {\n position: absolute;\n width: max-content; /* prevent shrinking near right edge */\n max-width: max(50%, 150px);\n padding: 3px 5px;\n border-radius: 3px;\n font: 12px sans-serif;\n color: #eee;\n background: rgba(0,0,0,0.6);\n pointer-events: none;\n}\n";
|
|
143778
|
+
styleInject$2(css_248z$2);
|
|
143779
143779
|
|
|
143780
143780
|
var index$2 = index$4({
|
|
143781
143781
|
props: {
|
|
@@ -143853,7 +143853,7 @@ var<${access}> ${ name } : ${ structName };`;
|
|
|
143853
143853
|
}
|
|
143854
143854
|
});
|
|
143855
143855
|
|
|
143856
|
-
function styleInject(css, ref) {
|
|
143856
|
+
function styleInject$1(css, ref) {
|
|
143857
143857
|
if (ref === void 0) ref = {};
|
|
143858
143858
|
var insertAt = ref.insertAt;
|
|
143859
143859
|
if (typeof document === 'undefined') {
|
|
@@ -143878,8 +143878,8 @@ var<${access}> ${ name } : ${ structName };`;
|
|
|
143878
143878
|
}
|
|
143879
143879
|
}
|
|
143880
143880
|
|
|
143881
|
-
var css_248z = ".scene-nav-info {\n position: absolute;\n bottom: 5px;\n width: 100%;\n text-align: center;\n color: slategrey;\n opacity: 0.7;\n font-size: 10px;\n font-family: sans-serif;\n pointer-events: none;\n user-select: none;\n}\n\n.scene-container canvas:focus {\n outline: none;\n}";
|
|
143882
|
-
styleInject(css_248z);
|
|
143881
|
+
var css_248z$1 = ".scene-nav-info {\n position: absolute;\n bottom: 5px;\n width: 100%;\n text-align: center;\n color: slategrey;\n opacity: 0.7;\n font-size: 10px;\n font-family: sans-serif;\n pointer-events: none;\n user-select: none;\n}\n\n.scene-container canvas:focus {\n outline: none;\n}";
|
|
143882
|
+
styleInject$1(css_248z$1);
|
|
143883
143883
|
|
|
143884
143884
|
const materialDispose$1 = material => {
|
|
143885
143885
|
if (material instanceof Array) {
|
|
@@ -144349,6 +144349,7 @@ var<${access}> ${ name } : ${ structName };`;
|
|
|
144349
144349
|
state.controlsEngaged = false;
|
|
144350
144350
|
state.controlsDragging = false;
|
|
144351
144351
|
});
|
|
144352
|
+
state.renderer.domElement.style.cursor = null; // remove cursor: auto property on canvas
|
|
144352
144353
|
}
|
|
144353
144354
|
[state.renderer, state.postProcessingComposer, ...state.extraRenderers].forEach(r => r.setSize(state.width, state.height));
|
|
144354
144355
|
state.camera.aspect = state.width / state.height;
|
|
@@ -147897,8 +147898,9 @@ var<${access}> ${ name } : ${ structName };`;
|
|
|
147897
147898
|
let first = isBigInt ? start : Math.round(start);
|
|
147898
147899
|
let pointCount = isBigInt ? length : Math.round(length);
|
|
147899
147900
|
const unit = isBigInt ? 8n : 8;
|
|
147901
|
+
const zero = isBigInt ? 0n : 0;
|
|
147900
147902
|
if (simplifyCurves) {
|
|
147901
|
-
while (pointOrder > 0 && first % unit ===
|
|
147903
|
+
while (pointOrder > 0 && first % unit === zero && pointCount % unit === zero) {
|
|
147902
147904
|
first /= unit;
|
|
147903
147905
|
pointCount /= unit;
|
|
147904
147906
|
pointOrder--;
|
|
@@ -148120,6 +148122,36 @@ var<${access}> ${ name } : ${ structName };`;
|
|
|
148120
148122
|
|
|
148121
148123
|
var index$1 = fromKapsule(ThreeHilbert, Group$1, true);
|
|
148122
148124
|
|
|
148125
|
+
function styleInject(css, ref) {
|
|
148126
|
+
if ( ref === void 0 ) ref = {};
|
|
148127
|
+
var insertAt = ref.insertAt;
|
|
148128
|
+
|
|
148129
|
+
if (typeof document === 'undefined') { return; }
|
|
148130
|
+
|
|
148131
|
+
var head = document.head || document.getElementsByTagName('head')[0];
|
|
148132
|
+
var style = document.createElement('style');
|
|
148133
|
+
style.type = 'text/css';
|
|
148134
|
+
|
|
148135
|
+
if (insertAt === 'top') {
|
|
148136
|
+
if (head.firstChild) {
|
|
148137
|
+
head.insertBefore(style, head.firstChild);
|
|
148138
|
+
} else {
|
|
148139
|
+
head.appendChild(style);
|
|
148140
|
+
}
|
|
148141
|
+
} else {
|
|
148142
|
+
head.appendChild(style);
|
|
148143
|
+
}
|
|
148144
|
+
|
|
148145
|
+
if (style.styleSheet) {
|
|
148146
|
+
style.styleSheet.cssText = css;
|
|
148147
|
+
} else {
|
|
148148
|
+
style.appendChild(document.createTextNode(css));
|
|
148149
|
+
}
|
|
148150
|
+
}
|
|
148151
|
+
|
|
148152
|
+
var css_248z = ".hilbert-scene-container .clickable {\n cursor: pointer;\n}";
|
|
148153
|
+
styleInject(css_248z);
|
|
148154
|
+
|
|
148123
148155
|
var index = index$4({
|
|
148124
148156
|
props: {
|
|
148125
148157
|
width: {
|
|
@@ -148263,36 +148295,44 @@ var<${access}> ${ name } : ${ structName };`;
|
|
|
148263
148295
|
|
|
148264
148296
|
// Add renderObjs
|
|
148265
148297
|
const roDomNode = document.createElement('div');
|
|
148298
|
+
roDomNode.className = 'hilbert-scene-container';
|
|
148266
148299
|
el.appendChild(roDomNode);
|
|
148267
|
-
const
|
|
148268
|
-
|
|
148269
|
-
|
|
148270
|
-
|
|
148271
|
-
|
|
148300
|
+
const getHilbertObjData = (obj, intersection) => {
|
|
148301
|
+
if (!obj) return null;
|
|
148302
|
+
if (intersection && obj.isInstancedMesh) {
|
|
148303
|
+
return obj.userData.data?.[intersection.instanceId] || null;
|
|
148304
|
+
}
|
|
148305
|
+
const hilbertObj = getHilbertObj(obj);
|
|
148306
|
+
return hilbertObj?.__data || null;
|
|
148307
|
+
function getHilbertObj(object) {
|
|
148308
|
+
let obj = object;
|
|
148309
|
+
// recurse up object chain until finding the globe object
|
|
148310
|
+
while (obj && !obj.hasOwnProperty('__data')) {
|
|
148311
|
+
obj = obj.parent;
|
|
148312
|
+
}
|
|
148313
|
+
return obj;
|
|
148272
148314
|
}
|
|
148273
|
-
return obj;
|
|
148274
148315
|
};
|
|
148275
|
-
state.renderObjs(roDomNode).tooltipContent(obj => {
|
|
148276
|
-
const
|
|
148277
|
-
return !
|
|
148316
|
+
state.renderObjs(roDomNode).tooltipContent((obj, intersection) => {
|
|
148317
|
+
const d = getHilbertObjData(obj, intersection);
|
|
148318
|
+
return !d ? '' : state.tooltipContent ? index$3(state.tooltipContent)(d) || '' : (() => {
|
|
148278
148319
|
// default content
|
|
148279
|
-
const d = o.__data;
|
|
148280
148320
|
const label = index$3(state.label)(d);
|
|
148281
148321
|
return `${label ? `<b>${label}</b>: ` : ''}${state.valFormatter(d.start) + (d.length > 1 ? ' - ' + state.valFormatter(d.start + d.length - (typeof d.start === 'bigint' ? 1n : 1)) : '')}`;
|
|
148282
148322
|
})();
|
|
148283
|
-
}).onHover(obj => {
|
|
148323
|
+
}).onHover((obj, _, intersection) => {
|
|
148284
148324
|
// Update tooltip and trigger onHover events
|
|
148285
|
-
const
|
|
148286
|
-
if (
|
|
148287
|
-
state.onHover?.(
|
|
148325
|
+
const hoverD = getHilbertObjData(obj, intersection);
|
|
148326
|
+
if (hoverD !== state.hoverD) {
|
|
148327
|
+
state.onHover?.(hoverD, state.hoverD || null);
|
|
148288
148328
|
|
|
148289
148329
|
// set pointer if hovered object is clickable
|
|
148290
|
-
state.renderObjs.renderer().domElement.classList[
|
|
148291
|
-
state.
|
|
148330
|
+
state.renderObjs.renderer().domElement.classList[hoverD && state.onClick || !hoverD && state.onBackgroundClick ? 'add' : 'remove']('clickable');
|
|
148331
|
+
state.hoverD = hoverD;
|
|
148292
148332
|
}
|
|
148293
|
-
}).onClick((obj, ev) => {
|
|
148294
|
-
const
|
|
148295
|
-
|
|
148333
|
+
}).onClick((obj, ev, intersection) => {
|
|
148334
|
+
const d = getHilbertObjData(obj, intersection);
|
|
148335
|
+
d ? state.onClick?.(d, ev) : state.onBackgroundClick?.(ev);
|
|
148296
148336
|
});
|
|
148297
148337
|
state.renderObjs.camera().position.z = 500;
|
|
148298
148338
|
|