hilbert-chart-3d 0.3.0 → 0.4.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.
package/README.md
CHANGED
|
@@ -42,7 +42,7 @@ new HilbertChart3D(<domElement>, { configOptions })
|
|
|
42
42
|
|
|
43
43
|
| Config options | Description | Default |
|
|
44
44
|
| --- | --- | :--: |
|
|
45
|
-
| <b>controlType</b>: <i>str</i> | Which type of control to use to control the camera. Choice between [trackball](https://threejs.org/examples/misc_controls_trackball.html), [orbit](https://threejs.org/examples/#misc_controls_orbit) or [fly](https://threejs.org/examples/misc_controls_fly.html). | `
|
|
45
|
+
| <b>controlType</b>: <i>str</i> | Which type of control to use to control the camera. Choice between [trackball](https://threejs.org/examples/misc_controls_trackball.html), [orbit](https://threejs.org/examples/#misc_controls_orbit) or [fly](https://threejs.org/examples/misc_controls_fly.html). | `arcball` |
|
|
46
46
|
|
|
47
47
|
### Methods
|
|
48
48
|
|
|
@@ -54,7 +54,7 @@ new HilbertChart3D(<domElement>, { configOptions })
|
|
|
54
54
|
| <b>data</b>([<i>array</i>]) | Getter/setter for the list of ranges to render. Each range object should follow the minimum syntax of `{start: <number or bigint>, length: <number or bigint>}`. | `[]` |
|
|
55
55
|
| <b>color</b>([<i>string</i> or <i>fn</i>]) | Getter/setter for the range object color accessor function (`fn(range)`) or attribute. | (cycle through d3.schemeCategory20 for unique labels) |
|
|
56
56
|
| <b>label</b>([<i>string</i> or <i>fn</i>]) | Getter/setter for the range object label accessor function (`fn(range)`) or attribute. | `name` |
|
|
57
|
-
| <b>labelColor</b>([<i>string</i> or <i>fn</i>]) | Getter/setter for the range object label color accessor function (`fn(range)`) or attribute. | `() => 'white'` |
|
|
57
|
+
| <b>labelColor</b>([<i>string</i> or <i>fn</i>]) | Getter/setter for the range object label color accessor function (`fn(range)`) or attribute. A falsy value disables the label. | `() => 'white'` |
|
|
58
58
|
| <b>padding</b>([<i>number</i>, <i>string</i> or <i>fn</i>]) | Getter/setter for the range object padding ratio accessor function (`fn(range)`), attribute or a constant number for all ranges. The padding ratio should be a number between `0` and `1` representing the proportional size of the padding space compared to the width of the path. | 0 |
|
|
59
59
|
| <b>paddingAbsolute</b>([<i>number</i>, <i>string</i> or <i>fn</i>]) | Getter/setter for the range object absolute padding accessor function (`fn(range)`), attribute or a constant number for all ranges. The value represents the absolute padding size as a fraction of the full Hilbert width. | 0 |
|
|
60
60
|
| <b>valFormatter</b>([<i>fn</i>]) | Getter/setter for the value formatting function (`fn(value)`), in default tooltips. Values may be Numbers or BigInts; should return a string. | `d => d` |
|
package/dist/hilbert-chart-3d.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Version 0.
|
|
1
|
+
// Version 0.4.0 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) :
|
|
@@ -144063,7 +144063,7 @@ var<${access}> ${ name } : ${ structName };`;
|
|
|
144063
144063
|
methods: {
|
|
144064
144064
|
tick: function (state) {
|
|
144065
144065
|
if (state.initialised) {
|
|
144066
|
-
state.controls.enabled && state.controls.update
|
|
144066
|
+
state.controls.enabled && state.controls.update?.(Math.min(1, state.timer.update().getDelta())); // timedelta is required for fly controls
|
|
144067
144067
|
|
|
144068
144068
|
state.postProcessingComposer ? state.postProcessingComposer.render() // if using postprocessing, switch the output to it
|
|
144069
144069
|
: state.renderer.render(state.scene, state.camera);
|
|
@@ -144239,8 +144239,6 @@ var<${access}> ${ name } : ${ structName };`;
|
|
|
144239
144239
|
camera: state => state.camera,
|
|
144240
144240
|
postProcessingComposer: state => state.postProcessingComposer,
|
|
144241
144241
|
controls: state => state.controls,
|
|
144242
|
-
tbControls: state => state.controls,
|
|
144243
|
-
// to be deprecated
|
|
144244
144242
|
_destructor: function (state) {
|
|
144245
144243
|
emptyObject$1(state.scene);
|
|
144246
144244
|
state.controls?.dispose();
|
|
@@ -144366,11 +144364,11 @@ var<${access}> ${ name } : ${ structName };`;
|
|
|
144366
144364
|
state.postProcessingComposer.addPass(new RenderPass(state.scene, state.camera)); // render scene as first pass
|
|
144367
144365
|
|
|
144368
144366
|
// configure controls
|
|
144369
|
-
state.controls = new {
|
|
144367
|
+
state.controls = new (isClass(controlType) ? controlType : {
|
|
144370
144368
|
trackball: TrackballControls,
|
|
144371
144369
|
orbit: OrbitControls,
|
|
144372
144370
|
fly: FlyControls
|
|
144373
|
-
}[controlType](state.camera, state.renderer.domElement);
|
|
144371
|
+
}[controlType])(state.camera, state.renderer.domElement);
|
|
144374
144372
|
if (controlType === 'fly') {
|
|
144375
144373
|
state.controls.movementSpeed = 300;
|
|
144376
144374
|
state.controls.rollSpeed = Math.PI / 6;
|
|
@@ -144471,6 +144469,9 @@ var<${access}> ${ name } : ${ structName };`;
|
|
|
144471
144469
|
}
|
|
144472
144470
|
}
|
|
144473
144471
|
});
|
|
144472
|
+
function isClass(value) {
|
|
144473
|
+
return typeof value === 'function' && Function.prototype.toString.call(value).startsWith('class');
|
|
144474
|
+
}
|
|
144474
144475
|
|
|
144475
144476
|
const CHILD_PERMUTATIONS$1 = [[0, 3, 4, 7, 6, 5, 2, 1], [0, 7, 6, 1, 2, 5, 4, 3], [0, 7, 6, 1, 2, 5, 4, 3], [2, 3, 0, 1, 6, 7, 4, 5], [2, 3, 0, 1, 6, 7, 4, 5], [4, 3, 2, 5, 6, 1, 0, 7], [4, 3, 2, 5, 6, 1, 0, 7], [6, 5, 2, 1, 0, 3, 4, 7]];
|
|
144476
144477
|
const ORIENTATIONS = [[0, 1, 2, 3, 4, 5, 6, 7]];
|
|
@@ -148732,7 +148733,7 @@ var<${access}> ${ name } : ${ structName };`;
|
|
|
148732
148733
|
triggerUpdate: false
|
|
148733
148734
|
},
|
|
148734
148735
|
labelColor: {
|
|
148735
|
-
default: () => '
|
|
148736
|
+
default: () => 'lavender',
|
|
148736
148737
|
onChange(v, state) {
|
|
148737
148738
|
state.hilbert.labelColor(v);
|
|
148738
148739
|
},
|
|
@@ -148806,14 +148807,15 @@ var<${access}> ${ name } : ${ structName };`;
|
|
|
148806
148807
|
}
|
|
148807
148808
|
},
|
|
148808
148809
|
stateInit({
|
|
148809
|
-
controlType = '
|
|
148810
|
+
controlType = 'arcball'
|
|
148810
148811
|
}) {
|
|
148811
148812
|
const hilbert = new index$1();
|
|
148812
148813
|
return {
|
|
148813
148814
|
hilbert,
|
|
148814
148815
|
renderObjs: threeRenderObjects({
|
|
148815
148816
|
controlType
|
|
148816
|
-
}).objects([hilbert]).lights([new AmbientLight(0xcccccc, Math.PI), new DirectionalLight(0xffffff, 0.6 * Math.PI)])
|
|
148817
|
+
}).objects([hilbert]).lights([new AmbientLight(0xcccccc, Math.PI), new DirectionalLight(0xffffff, 0.6 * Math.PI)]),
|
|
148818
|
+
controlType
|
|
148817
148819
|
};
|
|
148818
148820
|
},
|
|
148819
148821
|
init: function (el, state) {
|
|
@@ -148863,6 +148865,7 @@ var<${access}> ${ name } : ${ structName };`;
|
|
|
148863
148865
|
d ? state.onClick?.(d, ev) : state.onBackgroundClick?.(ev);
|
|
148864
148866
|
});
|
|
148865
148867
|
state.renderObjs.camera().position.z = 500;
|
|
148868
|
+
state.controlType === 'fly' && (state.renderObjs.controls().movementSpeed = 100);
|
|
148866
148869
|
|
|
148867
148870
|
//
|
|
148868
148871
|
|