uil 4.0.0 → 4.0.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.
- package/README.md +1 -1
- package/package.json +2 -5
- package/examples/js/BufferGeometryUtils.js +0 -921
- package/examples/js/SimplexNoise.js +0 -324
- package/examples/js/controls/OrbitControls.js +0 -1215
- package/examples/js/controls/OrbitControls_.js +0 -1042
- package/examples/js/libs/sea3d.min.js +0 -373
- package/examples/js/libs/three.min.js +0 -6
- package/examples/js/math.js +0 -447
- package/examples/js/objects/Landscape.js +0 -778
- package/examples/js/objects/Lensflare.js +0 -372
- package/examples/js/objects/SuperSky.js +0 -297
- package/examples/js/objects/Water.js +0 -329
- package/src/Uil.js +0 -6
- package/src/Uil_dev.js +0 -15
- package/src/core/Gui.js +0 -807
- package/src/core/Proto.js +0 -679
- package/src/core/Roots.js +0 -864
- package/src/core/Tools.js +0 -830
- package/src/core/V2.js +0 -131
- package/src/core/add.js +0 -85
- package/src/polyfills.js +0 -85
- package/src/proto/Bool.js +0 -147
- package/src/proto/Button.js +0 -357
- package/src/proto/Circular.js +0 -230
- package/src/proto/Color.js +0 -411
- package/src/proto/Empty.js +0 -15
- package/src/proto/Fps.js +0 -327
- package/src/proto/Graph.js +0 -310
- package/src/proto/Grid.js +0 -297
- package/src/proto/Group.js +0 -430
- package/src/proto/Item.js +0 -120
- package/src/proto/Joystick.js +0 -241
- package/src/proto/Knob.js +0 -262
- package/src/proto/List.js +0 -789
- package/src/proto/Numeric.js +0 -417
- package/src/proto/Pad2D.js +0 -268
- package/src/proto/Rubric.js +0 -0
- package/src/proto/Select.js +0 -178
- package/src/proto/Selector.js +0 -13
- package/src/proto/Slide.js +0 -267
- package/src/proto/TextInput.js +0 -181
- package/src/proto/Title.js +0 -61
package/src/core/V2.js
DELETED
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
export class V2 {
|
|
2
|
-
|
|
3
|
-
constructor( x = 0, y = 0 ) {
|
|
4
|
-
|
|
5
|
-
this.x = x;
|
|
6
|
-
this.y = y;
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
set ( x, y ) {
|
|
11
|
-
|
|
12
|
-
this.x = x;
|
|
13
|
-
this.y = y;
|
|
14
|
-
return this;
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
divide ( v ) {
|
|
19
|
-
|
|
20
|
-
this.x /= v.x;
|
|
21
|
-
this.y /= v.y;
|
|
22
|
-
return this;
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
multiply ( v ) {
|
|
27
|
-
|
|
28
|
-
this.x *= v.x;
|
|
29
|
-
this.y *= v.y;
|
|
30
|
-
return this;
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
multiplyScalar ( scalar ) {
|
|
35
|
-
|
|
36
|
-
this.x *= scalar;
|
|
37
|
-
this.y *= scalar;
|
|
38
|
-
return this;
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
divideScalar ( scalar ) {
|
|
43
|
-
|
|
44
|
-
return this.multiplyScalar( 1 / scalar );
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
length () {
|
|
49
|
-
|
|
50
|
-
return Math.sqrt( this.x * this.x + this.y * this.y );
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
angle () {
|
|
55
|
-
|
|
56
|
-
// computes the angle in radians with respect to the positive x-axis
|
|
57
|
-
|
|
58
|
-
var angle = Math.atan2( this.y, this.x );
|
|
59
|
-
|
|
60
|
-
if ( angle < 0 ) angle += 2 * Math.PI;
|
|
61
|
-
|
|
62
|
-
return angle;
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
addScalar ( s ) {
|
|
67
|
-
|
|
68
|
-
this.x += s;
|
|
69
|
-
this.y += s;
|
|
70
|
-
return this;
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
negate () {
|
|
75
|
-
|
|
76
|
-
this.x *= -1;
|
|
77
|
-
this.y *= -1;
|
|
78
|
-
return this;
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
neg () {
|
|
83
|
-
|
|
84
|
-
this.x = -1;
|
|
85
|
-
this.y = -1;
|
|
86
|
-
return this;
|
|
87
|
-
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
isZero () {
|
|
91
|
-
|
|
92
|
-
return ( this.x === 0 && this.y === 0 );
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
copy ( v ) {
|
|
97
|
-
|
|
98
|
-
this.x = v.x;
|
|
99
|
-
this.y = v.y;
|
|
100
|
-
|
|
101
|
-
return this;
|
|
102
|
-
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
equals ( v ) {
|
|
106
|
-
|
|
107
|
-
return ( ( v.x === this.x ) && ( v.y === this.y ) );
|
|
108
|
-
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
nearEquals ( v, n ) {
|
|
112
|
-
|
|
113
|
-
return ( ( v.x.toFixed(n) === this.x.toFixed(n) ) && ( v.y.toFixed(n) === this.y.toFixed(n) ) );
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
lerp ( v, alpha ) {
|
|
118
|
-
|
|
119
|
-
if( v === null ){
|
|
120
|
-
this.x -= this.x * alpha;
|
|
121
|
-
this.y -= this.y * alpha;
|
|
122
|
-
} else {
|
|
123
|
-
this.x += ( v.x - this.x ) * alpha;
|
|
124
|
-
this.y += ( v.y - this.y ) * alpha;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
return this;
|
|
128
|
-
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
}
|
package/src/core/add.js
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { Bool } from '../proto/Bool.js';
|
|
3
|
-
import { Button } from '../proto/Button.js';
|
|
4
|
-
import { Circular } from '../proto/Circular.js';
|
|
5
|
-
import { Color } from '../proto/Color.js';
|
|
6
|
-
import { Fps } from '../proto/Fps.js';
|
|
7
|
-
import { Graph } from '../proto/Graph.js';
|
|
8
|
-
import { Group } from '../proto/Group.js';
|
|
9
|
-
import { Joystick } from '../proto/Joystick.js';
|
|
10
|
-
import { Knob } from '../proto/Knob.js';
|
|
11
|
-
import { List } from '../proto/List.js';
|
|
12
|
-
import { Numeric } from '../proto/Numeric.js';
|
|
13
|
-
import { Slide } from '../proto/Slide.js';
|
|
14
|
-
import { TextInput } from '../proto/TextInput.js';
|
|
15
|
-
import { Title } from '../proto/Title.js';
|
|
16
|
-
import { Select } from '../proto/Select.js';
|
|
17
|
-
import { Selector } from '../proto/Selector.js';
|
|
18
|
-
import { Empty } from '../proto/Empty.js';
|
|
19
|
-
import { Item } from '../proto/Item.js';
|
|
20
|
-
import { Grid } from '../proto/Grid.js';
|
|
21
|
-
import { Pad2D } from '../proto/Pad2D.js';
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
export const add = function () {
|
|
25
|
-
|
|
26
|
-
let a = arguments;
|
|
27
|
-
|
|
28
|
-
let type, o, ref = false, n = null;
|
|
29
|
-
|
|
30
|
-
if( typeof a[0] === 'string' ){
|
|
31
|
-
|
|
32
|
-
type = a[0];
|
|
33
|
-
o = a[1] || {};
|
|
34
|
-
|
|
35
|
-
} else if ( typeof a[0] === 'object' ){ // like dat gui
|
|
36
|
-
|
|
37
|
-
ref = true;
|
|
38
|
-
if( a[2] === undefined ) [].push.call(a, {});
|
|
39
|
-
|
|
40
|
-
type = a[2].type ? a[2].type : 'slide';//autoType.apply( this, a );
|
|
41
|
-
|
|
42
|
-
o = a[2];
|
|
43
|
-
o.name = a[1];
|
|
44
|
-
if( type === 'list' ){ o.list = a[0][a[1]]; }
|
|
45
|
-
else o.value = a[0][a[1]];
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
let name = type.toLowerCase();
|
|
50
|
-
|
|
51
|
-
if( name === 'group' ) o.add = add;
|
|
52
|
-
|
|
53
|
-
switch( name ){
|
|
54
|
-
|
|
55
|
-
case 'bool': n = new Bool(o); break;
|
|
56
|
-
case 'button': n = new Button(o); break;
|
|
57
|
-
case 'circular': n = new Circular(o); break;
|
|
58
|
-
case 'color': n = new Color(o); break;
|
|
59
|
-
case 'fps': n = new Fps(o); break;
|
|
60
|
-
case 'graph': n = new Graph(o); break;
|
|
61
|
-
case 'group': n = new Group(o); break;
|
|
62
|
-
case 'joystick': n = new Joystick(o); break;
|
|
63
|
-
case 'knob': n = new Knob(o); break;
|
|
64
|
-
case 'list': n = new List(o); break;
|
|
65
|
-
case 'numeric': case 'number': n = new Numeric(o); break;
|
|
66
|
-
case 'slide': n = new Slide(o); break;
|
|
67
|
-
case 'textInput': case 'string': n = new TextInput(o); break;
|
|
68
|
-
case 'title': case 'text': n = new Title(o); break;
|
|
69
|
-
case 'select': n = new Select(o); break;
|
|
70
|
-
case 'selector': n = new Selector(o); break;
|
|
71
|
-
case 'empty': case 'space': n = new Empty(o); break;
|
|
72
|
-
case 'item': n = new Item(o); break;
|
|
73
|
-
case 'grid': n = new Grid(o); break;
|
|
74
|
-
case 'pad2d': case 'pad': n = new Pad2D(o); break;
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
if( n !== null ){
|
|
79
|
-
|
|
80
|
-
if( ref ) n.setReferency( a[0], a[1] );
|
|
81
|
-
return n;
|
|
82
|
-
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
}
|
package/src/polyfills.js
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
// Polyfills
|
|
2
|
-
|
|
3
|
-
if ( Number.EPSILON === undefined ) {
|
|
4
|
-
|
|
5
|
-
Number.EPSILON = Math.pow( 2, - 52 );
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
//
|
|
10
|
-
|
|
11
|
-
if ( Math.sign === undefined ) {
|
|
12
|
-
|
|
13
|
-
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sign
|
|
14
|
-
|
|
15
|
-
Math.sign = function ( x ) {
|
|
16
|
-
|
|
17
|
-
return ( x < 0 ) ? - 1 : ( x > 0 ) ? 1 : + x;
|
|
18
|
-
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
if ( Function.prototype.name === undefined ) {
|
|
24
|
-
|
|
25
|
-
// Missing in IE9-11.
|
|
26
|
-
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/name
|
|
27
|
-
|
|
28
|
-
Object.defineProperty( Function.prototype, 'name', {
|
|
29
|
-
|
|
30
|
-
get: function () {
|
|
31
|
-
|
|
32
|
-
return this.toString().match( /^\s*function\s*([^\(\s]*)/ )[ 1 ];
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
} );
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
if ( Object.assign === undefined ) {
|
|
41
|
-
|
|
42
|
-
// Missing in IE.
|
|
43
|
-
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
|
|
44
|
-
|
|
45
|
-
( function () {
|
|
46
|
-
|
|
47
|
-
Object.assign = function ( target ) {
|
|
48
|
-
|
|
49
|
-
'use strict';
|
|
50
|
-
|
|
51
|
-
if ( target === undefined || target === null ) {
|
|
52
|
-
|
|
53
|
-
throw new TypeError( 'Cannot convert undefined or null to object' );
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
var output = Object( target );
|
|
58
|
-
|
|
59
|
-
for ( var index = 1; index < arguments.length; index ++ ) {
|
|
60
|
-
|
|
61
|
-
var source = arguments[ index ];
|
|
62
|
-
|
|
63
|
-
if ( source !== undefined && source !== null ) {
|
|
64
|
-
|
|
65
|
-
for ( var nextKey in source ) {
|
|
66
|
-
|
|
67
|
-
if ( Object.prototype.hasOwnProperty.call( source, nextKey ) ) {
|
|
68
|
-
|
|
69
|
-
output[ nextKey ] = source[ nextKey ];
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
return output;
|
|
80
|
-
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
} )();
|
|
84
|
-
|
|
85
|
-
}
|
package/src/proto/Bool.js
DELETED
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
import { Proto } from '../core/Proto.js';
|
|
2
|
-
|
|
3
|
-
export class Bool extends Proto {
|
|
4
|
-
|
|
5
|
-
constructor( o = {} ) {
|
|
6
|
-
|
|
7
|
-
super( o )
|
|
8
|
-
|
|
9
|
-
this.value = o.value || false
|
|
10
|
-
this.model = o.mode !== undefined ? o.mode : 0
|
|
11
|
-
|
|
12
|
-
this.onName = o.rename || this.txt
|
|
13
|
-
if( o.onName ) o.onname = o.onName
|
|
14
|
-
if( o.onname ) this.onName = o.onname
|
|
15
|
-
|
|
16
|
-
this.inh = o.inh || Math.floor( this.h*0.8 )
|
|
17
|
-
this.inw = o.inw || 36
|
|
18
|
-
|
|
19
|
-
let cc = this.colors
|
|
20
|
-
|
|
21
|
-
if( this.model === 0 ){
|
|
22
|
-
let t = Math.floor(this.h*0.5)-((this.inh-2)*0.5);
|
|
23
|
-
this.c[2] = this.dom( 'div', this.css.basic + 'background:'+ cc.inputBg +'; height:'+(this.inh-2)+'px; width:'+this.inw+'px; top:'+t+'px; border-radius:10px; border:2px solid '+ cc.back )
|
|
24
|
-
this.c[3] = this.dom( 'div', this.css.basic + 'height:'+(this.inh-6)+'px; width:16px; top:'+(t+2)+'px; border-radius:10px; background:'+ cc.button+';' )
|
|
25
|
-
} else {
|
|
26
|
-
this.p = 0
|
|
27
|
-
if( this.c[1] !== undefined ) this.c[1].textContent = '';
|
|
28
|
-
this.c[2] = this.dom( 'div', this.css.txt + this.css.button + 'top:1px; background:'+cc.button+'; height:'+(this.h-2)+'px; border:1px solid '+cc.border+'; border-radius:'+this.radius+'px;' )
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
this.stat = -1
|
|
32
|
-
|
|
33
|
-
this.init()
|
|
34
|
-
this.update()
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// ----------------------
|
|
39
|
-
// EVENTS
|
|
40
|
-
// ----------------------
|
|
41
|
-
|
|
42
|
-
mousedown ( e ) {
|
|
43
|
-
|
|
44
|
-
this.value = !this.value
|
|
45
|
-
this.update( true )
|
|
46
|
-
return this.mousemove( e )
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
mousemove ( e ) {
|
|
51
|
-
|
|
52
|
-
this.cursor('pointer')
|
|
53
|
-
return this.mode( true )
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
reset () {
|
|
58
|
-
|
|
59
|
-
this.cursor()
|
|
60
|
-
return this.mode()
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// ----------------------
|
|
65
|
-
// MODE
|
|
66
|
-
// ----------------------
|
|
67
|
-
|
|
68
|
-
mode ( over ) {
|
|
69
|
-
|
|
70
|
-
let change = false
|
|
71
|
-
let cc = this.colors, s, s2, n, v = this.value
|
|
72
|
-
|
|
73
|
-
if( over ) n = v ? 4 : 3
|
|
74
|
-
else n = v ? 2 : 1
|
|
75
|
-
|
|
76
|
-
if( this.stat !== n ){
|
|
77
|
-
|
|
78
|
-
this.stat = n
|
|
79
|
-
|
|
80
|
-
if( this.model !== 0 ){
|
|
81
|
-
|
|
82
|
-
s = this.s[2]
|
|
83
|
-
|
|
84
|
-
switch( n ){
|
|
85
|
-
|
|
86
|
-
case 1: s.color = cc.text; s.background = cc.button; break;
|
|
87
|
-
case 2: s.color = cc.textSelect; s.background = cc.select; break;
|
|
88
|
-
case 3: s.color = cc.textOver; s.background = cc.overoff; break;
|
|
89
|
-
case 4: s.color = cc.textOver; s.background = cc.over; break;
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
this.c[2].innerHTML = v ? this.onName : this.name
|
|
94
|
-
|
|
95
|
-
} else {
|
|
96
|
-
|
|
97
|
-
s = this.s[2]
|
|
98
|
-
s2 = this.s[3]
|
|
99
|
-
|
|
100
|
-
switch( n ){
|
|
101
|
-
|
|
102
|
-
case 1: s.background = s.borderColor = cc.back; s2.background = cc.button; break;
|
|
103
|
-
case 2: s.background = s.borderColor = cc.select; s2.background = cc.button; break;
|
|
104
|
-
case 3: s.background = s.borderColor = cc.back; s2.background = cc.overoff; break;
|
|
105
|
-
case 4: s.background = s.borderColor = cc.select; s2.background = cc.over; break;
|
|
106
|
-
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
this.s[3].marginLeft = v ? '17px' : '2px'
|
|
110
|
-
this.c[1].textContent = v ? this.onName : this.name
|
|
111
|
-
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
change = true
|
|
115
|
-
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
return change
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
// ----------------------
|
|
123
|
-
|
|
124
|
-
update ( up ) {
|
|
125
|
-
|
|
126
|
-
this.mode()
|
|
127
|
-
if( up ) this.send()
|
|
128
|
-
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
rSize () {
|
|
132
|
-
|
|
133
|
-
super.rSize()
|
|
134
|
-
|
|
135
|
-
let s = this.s
|
|
136
|
-
let w = (this.w - 10 ) - this.inw
|
|
137
|
-
if( this.model === 0 ){
|
|
138
|
-
s[2].left = w + 'px'
|
|
139
|
-
s[3].left = w + 'px'
|
|
140
|
-
} else {
|
|
141
|
-
s[2].left = this.sa + 'px'
|
|
142
|
-
s[2].width = (this.w- 20) + 'px'
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
}
|