three-render-objects 1.28.4 → 1.28.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.
@@ -1,4 +1,4 @@
1
- // Version 1.28.4 three-render-objects - https://github.com/vasturiano/three-render-objects
1
+ // Version 1.28.6 three-render-objects - https://github.com/vasturiano/three-render-objects
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('three')) :
4
4
  typeof define === 'function' && define.amd ? define(['three'], factory) :
@@ -32,7 +32,7 @@
32
32
  }
33
33
  }
34
34
 
35
- var css_248z = ".scene-nav-info {\n bottom: 5px;\n width: 100%;\n text-align: center;\n color: slategrey;\n opacity: 0.7;\n font-size: 10px;\n}\n\n.scene-tooltip {\n top: 0;\n color: lavender;\n font-size: 15px;\n}\n\n.scene-nav-info, .scene-tooltip {\n position: absolute;\n font-family: sans-serif;\n pointer-events: none;\n}\n\n.scene-container canvas:focus {\n outline: none;\n}";
35
+ var css_248z = ".scene-nav-info {\n bottom: 5px;\n width: 100%;\n text-align: center;\n color: slategrey;\n opacity: 0.7;\n font-size: 10px;\n}\n\n.scene-tooltip {\n top: 0;\n color: lavender;\n font-size: 15px;\n}\n\n.scene-nav-info, .scene-tooltip {\n position: absolute;\n font-family: sans-serif;\n pointer-events: none;\n user-select: none;\n}\n\n.scene-container canvas:focus {\n outline: none;\n}";
36
36
  styleInject(css_248z);
37
37
 
38
38
  function _iterableToArrayLimit$1(arr, i) {
@@ -1100,6 +1100,7 @@
1100
1100
 
1101
1101
  const lastPosition = new three$1.Vector3();
1102
1102
  const lastQuaternion = new three$1.Quaternion();
1103
+ const lastTargetPosition = new three$1.Vector3();
1103
1104
 
1104
1105
  const twoPI = 2 * Math.PI;
1105
1106
 
@@ -1213,12 +1214,15 @@
1213
1214
 
1214
1215
  if ( zoomChanged ||
1215
1216
  lastPosition.distanceToSquared( scope.object.position ) > EPS ||
1216
- 8 * ( 1 - lastQuaternion.dot( scope.object.quaternion ) ) > EPS ) {
1217
+ 8 * ( 1 - lastQuaternion.dot( scope.object.quaternion ) ) > EPS ||
1218
+ lastTargetPosition.distanceToSquared( scope.target ) > 0 ) {
1217
1219
 
1218
1220
  scope.dispatchEvent( _changeEvent$1 );
1219
1221
 
1220
1222
  lastPosition.copy( scope.object.position );
1221
1223
  lastQuaternion.copy( scope.object.quaternion );
1224
+ lastTargetPosition.copy( scope.target );
1225
+
1222
1226
  zoomChanged = false;
1223
1227
 
1224
1228
  return true;
@@ -2207,6 +2211,9 @@
2207
2211
 
2208
2212
  // API
2209
2213
 
2214
+ // Set to false to disable this control
2215
+ this.enabled = true;
2216
+
2210
2217
  this.movementSpeed = 1.0;
2211
2218
  this.rollSpeed = 0.005;
2212
2219
 
@@ -2234,7 +2241,7 @@
2234
2241
 
2235
2242
  this.keydown = function ( event ) {
2236
2243
 
2237
- if ( event.altKey ) {
2244
+ if ( event.altKey || this.enabled === false ) {
2238
2245
 
2239
2246
  return;
2240
2247
 
@@ -2272,6 +2279,8 @@
2272
2279
 
2273
2280
  this.keyup = function ( event ) {
2274
2281
 
2282
+ if ( this.enabled === false ) return;
2283
+
2275
2284
  switch ( event.code ) {
2276
2285
 
2277
2286
  case 'ShiftLeft':
@@ -2304,6 +2313,8 @@
2304
2313
 
2305
2314
  this.pointerdown = function ( event ) {
2306
2315
 
2316
+ if ( this.enabled === false ) return;
2317
+
2307
2318
  if ( this.dragToLook ) {
2308
2319
 
2309
2320
  this.status ++;
@@ -2325,6 +2336,8 @@
2325
2336
 
2326
2337
  this.pointermove = function ( event ) {
2327
2338
 
2339
+ if ( this.enabled === false ) return;
2340
+
2328
2341
  if ( ! this.dragToLook || this.status > 0 ) {
2329
2342
 
2330
2343
  const container = this.getContainerDimensions();
@@ -2342,6 +2355,8 @@
2342
2355
 
2343
2356
  this.pointerup = function ( event ) {
2344
2357
 
2358
+ if ( this.enabled === false ) return;
2359
+
2345
2360
  if ( this.dragToLook ) {
2346
2361
 
2347
2362
  this.status --;
@@ -2365,8 +2380,18 @@
2365
2380
 
2366
2381
  };
2367
2382
 
2383
+ this.contextMenu = function ( event ) {
2384
+
2385
+ if ( this.enabled === false ) return;
2386
+
2387
+ event.preventDefault();
2388
+
2389
+ };
2390
+
2368
2391
  this.update = function ( delta ) {
2369
2392
 
2393
+ if ( this.enabled === false ) return;
2394
+
2370
2395
  const moveMult = delta * scope.movementSpeed;
2371
2396
  const rotMult = delta * scope.rollSpeed;
2372
2397
 
@@ -2434,7 +2459,7 @@
2434
2459
 
2435
2460
  this.dispose = function () {
2436
2461
 
2437
- this.domElement.removeEventListener( 'contextmenu', contextmenu );
2462
+ this.domElement.removeEventListener( 'contextmenu', _contextmenu );
2438
2463
  this.domElement.removeEventListener( 'pointerdown', _pointerdown );
2439
2464
  this.domElement.removeEventListener( 'pointermove', _pointermove );
2440
2465
  this.domElement.removeEventListener( 'pointerup', _pointerup );
@@ -2444,13 +2469,14 @@
2444
2469
 
2445
2470
  };
2446
2471
 
2472
+ const _contextmenu = this.contextMenu.bind( this );
2447
2473
  const _pointermove = this.pointermove.bind( this );
2448
2474
  const _pointerdown = this.pointerdown.bind( this );
2449
2475
  const _pointerup = this.pointerup.bind( this );
2450
2476
  const _keydown = this.keydown.bind( this );
2451
2477
  const _keyup = this.keyup.bind( this );
2452
2478
 
2453
- this.domElement.addEventListener( 'contextmenu', contextmenu );
2479
+ this.domElement.addEventListener( 'contextmenu', _contextmenu );
2454
2480
  this.domElement.addEventListener( 'pointerdown', _pointerdown );
2455
2481
  this.domElement.addEventListener( 'pointermove', _pointermove );
2456
2482
  this.domElement.addEventListener( 'pointerup', _pointerup );
@@ -2465,18 +2491,14 @@
2465
2491
 
2466
2492
  }
2467
2493
 
2468
- function contextmenu( event ) {
2469
-
2470
- event.preventDefault();
2471
-
2472
- }
2473
-
2474
2494
  /**
2475
2495
  * Full-screen textured quad shader
2476
2496
  */
2477
2497
 
2478
2498
  const CopyShader = {
2479
2499
 
2500
+ name: 'CopyShader',
2501
+
2480
2502
  uniforms: {
2481
2503
 
2482
2504
  'tDiffuse': { value: null },
@@ -2505,8 +2527,8 @@
2505
2527
 
2506
2528
  void main() {
2507
2529
 
2508
- gl_FragColor = texture2D( tDiffuse, vUv );
2509
- gl_FragColor.a *= opacity;
2530
+ vec4 texel = texture2D( tDiffuse, vUv );
2531
+ gl_FragColor = opacity * texel;
2510
2532
 
2511
2533
 
2512
2534
  }`
@@ -2609,6 +2631,7 @@
2609
2631
 
2610
2632
  this.material = new three$1.ShaderMaterial( {
2611
2633
 
2634
+ name: ( shader.name !== undefined ) ? shader.name : 'unspecified',
2612
2635
  defines: Object.assign( {}, shader.defines ),
2613
2636
  uniforms: this.uniforms,
2614
2637
  vertexShader: shader.vertexShader,
@@ -2770,7 +2793,7 @@
2770
2793
  this._width = size.width;
2771
2794
  this._height = size.height;
2772
2795
 
2773
- renderTarget = new three$1.WebGLRenderTarget( this._width * this._pixelRatio, this._height * this._pixelRatio );
2796
+ renderTarget = new three$1.WebGLRenderTarget( this._width * this._pixelRatio, this._height * this._pixelRatio, { type: three$1.HalfFloatType } );
2774
2797
  renderTarget.texture.name = 'EffectComposer.rt1';
2775
2798
 
2776
2799
  } else {
@@ -2792,6 +2815,7 @@
2792
2815
  this.passes = [];
2793
2816
 
2794
2817
  this.copyPass = new ShaderPass( CopyShader );
2818
+ this.copyPass.material.blending = three$1.NoBlending;
2795
2819
 
2796
2820
  this.clock = new three$1.Clock();
2797
2821
 
@@ -4615,18 +4639,6 @@
4615
4639
  };
4616
4640
  return Tween;
4617
4641
  }());
4618
-
4619
- var VERSION = '20.0.3';
4620
-
4621
- /**
4622
- * Tween.js - Licensed under the MIT license
4623
- * https://github.com/tweenjs/tween.js
4624
- * ----------------------------------------------
4625
- *
4626
- * See https://github.com/tweenjs/tween.js/graphs/contributors for the full list of contributors.
4627
- * Thank you all, you're awesome!
4628
- */
4629
- var nextId = Sequence.nextId;
4630
4642
  /**
4631
4643
  * Controlling groups of tweens
4632
4644
  *
@@ -4638,29 +4650,14 @@
4638
4650
  // Modules and CommonJS, without build hacks, and so as not to break the
4639
4651
  // existing API.
4640
4652
  // https://github.com/rollup/rollup/issues/1961#issuecomment-423037881
4641
- var getAll = TWEEN.getAll.bind(TWEEN);
4642
- var removeAll = TWEEN.removeAll.bind(TWEEN);
4643
- var add = TWEEN.add.bind(TWEEN);
4644
- var remove = TWEEN.remove.bind(TWEEN);
4653
+ TWEEN.getAll.bind(TWEEN);
4654
+ TWEEN.removeAll.bind(TWEEN);
4655
+ TWEEN.add.bind(TWEEN);
4656
+ TWEEN.remove.bind(TWEEN);
4645
4657
  var update = TWEEN.update.bind(TWEEN);
4646
- var exports$1 = {
4647
- Easing: Easing,
4648
- Group: Group,
4649
- Interpolation: Interpolation,
4650
- now: now$2,
4651
- Sequence: Sequence,
4652
- nextId: nextId,
4653
- Tween: Tween,
4654
- VERSION: VERSION,
4655
- getAll: getAll,
4656
- removeAll: removeAll,
4657
- add: add,
4658
- remove: remove,
4659
- update: update,
4660
- };
4661
4658
 
4662
4659
  var index$1 = (function (p) {
4663
- return p instanceof Function ? p // fn
4660
+ return typeof p === 'function' ? p // fn
4664
4661
  : typeof p === 'string' ? function (obj) {
4665
4662
  return obj[p];
4666
4663
  } // property name
@@ -5502,7 +5499,7 @@
5502
5499
  state.hoverObj = topObject;
5503
5500
  }
5504
5501
  }
5505
- exports$1.update(); // update camera animation tweens
5502
+ update(); // update camera animation tweens
5506
5503
  }
5507
5504
 
5508
5505
  return this;
@@ -5534,10 +5531,10 @@
5534
5531
  } else {
5535
5532
  var camPos = Object.assign({}, camera.position);
5536
5533
  var camLookAt = getLookAt();
5537
- new exports$1.Tween(camPos).to(finalPos, transitionDuration).easing(exports$1.Easing.Quadratic.Out).onUpdate(setCameraPos).start();
5534
+ new Tween(camPos).to(finalPos, transitionDuration).easing(Easing.Quadratic.Out).onUpdate(setCameraPos).start();
5538
5535
 
5539
5536
  // Face direction in 1/3rd of time
5540
- new exports$1.Tween(camLookAt).to(finalLookAt, transitionDuration / 3).easing(exports$1.Easing.Quadratic.Out).onUpdate(setLookAt).start();
5537
+ new Tween(camLookAt).to(finalLookAt, transitionDuration / 3).easing(Easing.Quadratic.Out).onUpdate(setLookAt).start();
5541
5538
  }
5542
5539
  return this;
5543
5540
  }