@needle-tools/three 0.169.5 → 0.169.6

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.
@@ -21,6 +21,15 @@ import {
21
21
  const _changeEvent = { type: 'change' };
22
22
  const _startEvent = { type: 'start' };
23
23
  const _endEvent = { type: 'end' };
24
+
25
+ /**
26
+ * Fires when all adjustments have finished (including damping).
27
+ *
28
+ * @event OrbitControls#endDamping
29
+ * @type {Object}
30
+ */
31
+ const _endDampingEvent = { type: 'endDamping' };
32
+
24
33
  const _ray = new Ray();
25
34
  const _plane = new Plane();
26
35
  const _TILT_LIMIT = Math.cos( 70 * MathUtils.DEG2RAD );
@@ -161,6 +170,8 @@ class OrbitControls extends Controls {
161
170
  this._pointerPositions = {};
162
171
 
163
172
  this._controlActive = false;
173
+ this._lastIsDamping = false;
174
+ this._isDamping = false;
164
175
 
165
176
  // event listeners
166
177
 
@@ -288,11 +299,15 @@ class OrbitControls extends Controls {
288
299
  this.update();
289
300
 
290
301
  this.state = _STATE.NONE;
302
+ this._isDamping = false;
291
303
 
292
304
  }
293
305
 
294
306
  update( deltaTime = null ) {
295
307
 
308
+ // Needle: if damping is enabled, update is managed externally, so we don't want to do it here.
309
+ if ( this.enableDamping && deltaTime === null ) return;
310
+
296
311
  const position = this.object.getWorldPosition( this.object.position );
297
312
 
298
313
  _v.copy( position ).sub( this.target );
@@ -391,7 +406,7 @@ class OrbitControls extends Controls {
391
406
 
392
407
  const prevRadius = this._spherical.radius;
393
408
  this._spherical.radius = this._clampDistance( this._spherical.radius * this._currentScale );
394
- zoomChanged = prevRadius != this._spherical.radius;
409
+ zoomChanged = Math.abs( prevRadius - this._spherical.radius ) > _EPS * 100;
395
410
 
396
411
  }
397
412
 
@@ -435,7 +450,7 @@ class OrbitControls extends Controls {
435
450
  this.object.position.addScaledVector( this._dollyDirection, radiusDelta );
436
451
  this.object.updateMatrixWorld();
437
452
 
438
- zoomChanged = !! radiusDelta;
453
+ zoomChanged = Math.abs( radiusDelta ) > _EPS;
439
454
 
440
455
  } else if ( this.object.isOrthographicCamera ) {
441
456
 
@@ -447,7 +462,7 @@ class OrbitControls extends Controls {
447
462
  this.object.zoom = Math.max( this.minZoom, Math.min( this.maxZoom, this.object.zoom / this._currentScale ) );
448
463
  this.object.updateProjectionMatrix();
449
464
 
450
- zoomChanged = prevZoom !== this.object.zoom;
465
+ zoomChanged = Math.abs( prevZoom - this.object.zoom ) > _EPS;
451
466
 
452
467
  const mouseAfter = new Vector3( this._mouse.x, this._mouse.y, 0 );
453
468
  mouseAfter.unproject( this.object );
@@ -503,7 +518,7 @@ class OrbitControls extends Controls {
503
518
  const prevZoom = this.object.zoom;
504
519
  this.object.zoom = Math.max( this.minZoom, Math.min( this.maxZoom, this.object.zoom / this._scale ) );
505
520
 
506
- if ( prevZoom !== this.object.zoom ) {
521
+ if ( Math.abs( prevZoom - this.object.zoom ) > _EPS ) {
507
522
 
508
523
  this.object.updateProjectionMatrix();
509
524
  zoomChanged = true;
@@ -529,13 +544,32 @@ class OrbitControls extends Controls {
529
544
  this._lastQuaternion.copy( this.object.quaternion );
530
545
  this._lastTargetPosition.copy( this.target );
531
546
 
547
+ this._lastIsDamping = true;
548
+ this._isDamping = true;
549
+
532
550
  return true;
533
551
 
552
+ } else {
553
+
554
+ this._lastPosition.copy( this.object.position );
555
+ this._lastQuaternion.copy( this.object.quaternion );
556
+ this._lastTargetPosition.copy( this.target );
557
+
558
+ this._lastIsDamping = this._isDamping;
559
+ this._isDamping = false;
560
+
534
561
  }
535
562
 
563
+ if ( this._lastIsDamping && ! this._isDamping ) {
564
+
565
+ this._isDamping = false;
566
+ this._lastIsDamping = false;
567
+ this.dispatchEvent( _endDampingEvent );
568
+
569
+ }
536
570
 
537
571
  this._performCursorZoom = false;
538
-
572
+
539
573
  return false;
540
574
 
541
575
  }
@@ -2109,6 +2109,11 @@ class GeometryParser {
2109
2109
  // so that we don't end up with an array of 0 triangles for the faces not participating in morph.
2110
2110
  triangles = ShapeUtils.triangulateShape( triangulationInput, [] );
2111
2111
 
2112
+ } else if ( faceLength === 2 ) {
2113
+
2114
+ console.warn( 'THREE.FBXLoader: Edge topology detected. This is currently not supported. The resulting mesh will not be correct.' );
2115
+ triangles = [[ 0, 1, 2 ]];
2116
+
2112
2117
  } else {
2113
2118
 
2114
2119
  // Regular triangle, skip earcut triangulation step
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@needle-tools/three",
3
- "version": "0.169.5",
3
+ "version": "0.169.6",
4
4
  "description": "JavaScript 3D library",
5
5
  "type": "module",
6
6
  "main": "./build/three.cjs",