hilbert-chart-3d 0.3.1 → 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). | `orbit` |
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
 
@@ -1,4 +1,4 @@
1
- // Version 0.3.1 hilbert-chart-3d - https://github.com/vasturiano/hilbert-chart-3d
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 && state.controls.update(Math.min(1, state.timer.update().getDelta())); // timedelta is required for fly controls
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]];
@@ -148806,14 +148807,15 @@ var<${access}> ${ name } : ${ structName };`;
148806
148807
  }
148807
148808
  },
148808
148809
  stateInit({
148809
- controlType = 'orbit'
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