three-render-objects 1.26.7 → 1.27.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.
@@ -46,7 +46,7 @@ function styleInject(css, ref) {
46
46
  }
47
47
  }
48
48
 
49
- 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 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}";
49
+ 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}";
50
50
  styleInject(css_248z);
51
51
 
52
52
  function _defineProperty(obj, key, value) {
@@ -502,8 +502,10 @@ var threeRenderObjects = Kapsule__default["default"]({
502
502
  state.pointerPos.y = ev.pageY - offset.top; // Move tooltip
503
503
 
504
504
  state.toolTipElem.style.top = "".concat(state.pointerPos.y, "px");
505
- state.toolTipElem.style.left = "".concat(state.pointerPos.x, "px");
506
- state.toolTipElem.style.transform = "translate(-".concat(state.pointerPos.x / state.width * 100, "%, 21px)"); // adjust horizontal position to not exceed canvas boundaries
505
+ state.toolTipElem.style.left = "".concat(state.pointerPos.x, "px"); // adjust horizontal position to not exceed canvas boundaries
506
+
507
+ state.toolTipElem.style.transform = "translate(-".concat(state.pointerPos.x / state.width * 100, "%, ").concat( // flip to above if near bottom
508
+ state.height - state.pointerPos.y < 100 ? 'calc(-100% - 8px)' : '21px', ")");
507
509
  }
508
510
 
509
511
  function getOffset(el) {
@@ -1,40 +1,10 @@
1
- // Version 1.26.7 three-render-objects - https://github.com/vasturiano/three-render-objects
1
+ // Version 1.27.1 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) :
5
5
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.ThreeRenderObjects = factory(global.THREE));
6
6
  })(this, (function (three$1) { 'use strict';
7
7
 
8
- function styleInject(css, ref) {
9
- if ( ref === void 0 ) ref = {};
10
- var insertAt = ref.insertAt;
11
-
12
- if (!css || typeof document === 'undefined') { return; }
13
-
14
- var head = document.head || document.getElementsByTagName('head')[0];
15
- var style = document.createElement('style');
16
- style.type = 'text/css';
17
-
18
- if (insertAt === 'top') {
19
- if (head.firstChild) {
20
- head.insertBefore(style, head.firstChild);
21
- } else {
22
- head.appendChild(style);
23
- }
24
- } else {
25
- head.appendChild(style);
26
- }
27
-
28
- if (style.styleSheet) {
29
- style.styleSheet.cssText = css;
30
- } else {
31
- style.appendChild(document.createTextNode(css));
32
- }
33
- }
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 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}";
36
- styleInject(css_248z);
37
-
38
8
  function _defineProperty(obj, key, value) {
39
9
  if (key in obj) {
40
10
  Object.defineProperty(obj, key, {
@@ -660,9 +630,6 @@
660
630
  _state = STATE.PAN;
661
631
  break;
662
632
 
663
- default:
664
- _state = STATE.NONE;
665
-
666
633
  }
667
634
 
668
635
  }
@@ -825,7 +792,7 @@
825
792
 
826
793
  case 2:
827
794
  _state = STATE.TOUCH_ZOOM_PAN;
828
- _moveCurr.copy( getMouseOnCircle( event.pageX - _movePrev.pageX, event.pageY - _movePrev.pageY ) );
795
+ _moveCurr.copy( getMouseOnCircle( event.pageX - _movePrev.x, event.pageY - _movePrev.y ) );
829
796
  _movePrev.copy( _moveCurr );
830
797
  break;
831
798
 
@@ -1876,8 +1843,6 @@
1876
1843
 
1877
1844
  function onMouseMove( event ) {
1878
1845
 
1879
- if ( scope.enabled === false ) return;
1880
-
1881
1846
  switch ( state ) {
1882
1847
 
1883
1848
  case STATE.ROTATE:
@@ -2427,7 +2392,7 @@
2427
2392
  * Full-screen textured quad shader
2428
2393
  */
2429
2394
 
2430
- var CopyShader = {
2395
+ const CopyShader = {
2431
2396
 
2432
2397
  uniforms: {
2433
2398
 
@@ -2457,8 +2422,9 @@
2457
2422
 
2458
2423
  void main() {
2459
2424
 
2460
- vec4 texel = texture2D( tDiffuse, vUv );
2461
- gl_FragColor = opacity * texel;
2425
+ gl_FragColor = texture2D( tDiffuse, vUv );
2426
+ gl_FragColor.a *= opacity;
2427
+
2462
2428
 
2463
2429
  }`
2464
2430
 
@@ -2703,18 +2669,12 @@
2703
2669
 
2704
2670
  if ( renderTarget === undefined ) {
2705
2671
 
2706
- const parameters = {
2707
- minFilter: three$1.LinearFilter,
2708
- magFilter: three$1.LinearFilter,
2709
- format: three$1.RGBAFormat
2710
- };
2711
-
2712
2672
  const size = renderer.getSize( new three$1.Vector2() );
2713
2673
  this._pixelRatio = renderer.getPixelRatio();
2714
2674
  this._width = size.width;
2715
2675
  this._height = size.height;
2716
2676
 
2717
- renderTarget = new three$1.WebGLRenderTarget( this._width * this._pixelRatio, this._height * this._pixelRatio, parameters );
2677
+ renderTarget = new three$1.WebGLRenderTarget( this._width * this._pixelRatio, this._height * this._pixelRatio );
2718
2678
  renderTarget.texture.name = 'EffectComposer.rt1';
2719
2679
 
2720
2680
  } else {
@@ -3009,7 +2969,7 @@
3009
2969
  }
3010
2970
 
3011
2971
  function _extends() {
3012
- _extends = Object.assign || function (target) {
2972
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
3013
2973
  for (var i = 1; i < arguments.length; i++) {
3014
2974
  var source = arguments[i];
3015
2975
 
@@ -3022,7 +2982,6 @@
3022
2982
 
3023
2983
  return target;
3024
2984
  };
3025
-
3026
2985
  return _extends.apply(this, arguments);
3027
2986
  }
3028
2987
 
@@ -3035,11 +2994,10 @@
3035
2994
  }
3036
2995
 
3037
2996
  function _setPrototypeOf(o, p) {
3038
- _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
2997
+ _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
3039
2998
  o.__proto__ = p;
3040
2999
  return o;
3041
3000
  };
3042
-
3043
3001
  return _setPrototypeOf(o, p);
3044
3002
  }
3045
3003
 
@@ -3050,7 +3008,7 @@
3050
3008
  }
3051
3009
 
3052
3010
  function _getPrototypeOf(o) {
3053
- _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
3011
+ _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
3054
3012
  return o.__proto__ || Object.getPrototypeOf(o);
3055
3013
  };
3056
3014
  return _getPrototypeOf(o);
@@ -3075,7 +3033,7 @@
3075
3033
 
3076
3034
  function _construct(Parent, args, Class) {
3077
3035
  if (_isNativeReflectConstruct()) {
3078
- _construct = Reflect.construct;
3036
+ _construct = Reflect.construct.bind();
3079
3037
  } else {
3080
3038
  _construct = function _construct(Parent, args, Class) {
3081
3039
  var a = [null];
@@ -3480,10 +3438,10 @@
3480
3438
  var hexRgbaRegex = /^#[a-fA-F0-9]{8}$/;
3481
3439
  var reducedHexRegex = /^#[a-fA-F0-9]{3}$/;
3482
3440
  var reducedRgbaHexRegex = /^#[a-fA-F0-9]{4}$/;
3483
- var rgbRegex = /^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i;
3484
- var rgbaRegex = /^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*([-+]?[0-9]*[.]?[0-9]+)\s*\)$/i;
3485
- var hslRegex = /^hsl\(\s*(\d{0,3}[.]?[0-9]+)\s*,\s*(\d{1,3}[.]?[0-9]?)%\s*,\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i;
3486
- var hslaRegex = /^hsla\(\s*(\d{0,3}[.]?[0-9]+)\s*,\s*(\d{1,3}[.]?[0-9]?)%\s*,\s*(\d{1,3}[.]?[0-9]?)%\s*,\s*([-+]?[0-9]*[.]?[0-9]+)\s*\)$/i;
3441
+ var rgbRegex = /^rgb\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*\)$/i;
3442
+ var rgbaRegex = /^rgb(?:a)?\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i;
3443
+ var hslRegex = /^hsl\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i;
3444
+ var hslaRegex = /^hsl(?:a)?\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i;
3487
3445
  /**
3488
3446
  * Returns an RgbColor or RgbaColor object. This utility function is only useful
3489
3447
  * if want to extract a color component. With the color util `toColorString` you
@@ -3557,7 +3515,7 @@
3557
3515
  red: parseInt("" + rgbaMatched[1], 10),
3558
3516
  green: parseInt("" + rgbaMatched[2], 10),
3559
3517
  blue: parseInt("" + rgbaMatched[3], 10),
3560
- alpha: parseFloat("" + rgbaMatched[4])
3518
+ alpha: parseFloat("" + rgbaMatched[4]) > 1 ? parseFloat("" + rgbaMatched[4]) / 100 : parseFloat("" + rgbaMatched[4])
3561
3519
  };
3562
3520
  }
3563
3521
 
@@ -3602,7 +3560,7 @@
3602
3560
  red: parseInt("" + _hslRgbMatched[1], 10),
3603
3561
  green: parseInt("" + _hslRgbMatched[2], 10),
3604
3562
  blue: parseInt("" + _hslRgbMatched[3], 10),
3605
- alpha: parseFloat("" + hslaMatched[4])
3563
+ alpha: parseFloat("" + hslaMatched[4]) > 1 ? parseFloat("" + hslaMatched[4]) / 100 : parseFloat("" + hslaMatched[4])
3606
3564
  };
3607
3565
  }
3608
3566
 
@@ -5240,8 +5198,10 @@
5240
5198
  state.pointerPos.y = ev.pageY - offset.top; // Move tooltip
5241
5199
 
5242
5200
  state.toolTipElem.style.top = "".concat(state.pointerPos.y, "px");
5243
- state.toolTipElem.style.left = "".concat(state.pointerPos.x, "px");
5244
- state.toolTipElem.style.transform = "translate(-".concat(state.pointerPos.x / state.width * 100, "%, 21px)"); // adjust horizontal position to not exceed canvas boundaries
5201
+ state.toolTipElem.style.left = "".concat(state.pointerPos.x, "px"); // adjust horizontal position to not exceed canvas boundaries
5202
+
5203
+ state.toolTipElem.style.transform = "translate(-".concat(state.pointerPos.x / state.width * 100, "%, ").concat( // flip to above if near bottom
5204
+ state.height - state.pointerPos.y < 100 ? 'calc(-100% - 8px)' : '21px', ")");
5245
5205
  }
5246
5206
 
5247
5207
  function getOffset(el) {