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/proto/Grid.js
DELETED
|
@@ -1,297 +0,0 @@
|
|
|
1
|
-
import { Proto } from '../core/Proto.js';
|
|
2
|
-
import { Button } from './Button.js';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export class Grid extends Proto {
|
|
6
|
-
|
|
7
|
-
constructor( o = {} ) {
|
|
8
|
-
|
|
9
|
-
super( o );
|
|
10
|
-
|
|
11
|
-
this.values = o.values || [];
|
|
12
|
-
|
|
13
|
-
if( typeof this.values === 'string' ) this.values = [ this.values ];
|
|
14
|
-
this.lng = this.values.length;
|
|
15
|
-
|
|
16
|
-
this.value = o.value || null;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
this.isSelectable = o.selectable || false;
|
|
20
|
-
this.spaces = o.spaces || [5,3];
|
|
21
|
-
this.bsize = o.bsize || [90,20];
|
|
22
|
-
|
|
23
|
-
if(o.h) this.bsize[1] = o.h;
|
|
24
|
-
this.bsizeMax = this.bsize[0];
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
this.tmp = [];
|
|
28
|
-
this.stat = [];
|
|
29
|
-
this.grid = [ 2, Math.round( this.lng * 0.5 ) ];
|
|
30
|
-
this.h = this.grid[1] * ( this.bsize[1] + this.spaces[1] ) + this.spaces[1];
|
|
31
|
-
|
|
32
|
-
this.c[1].textContent = '';
|
|
33
|
-
this.c[2] = this.dom( 'table', this.css.basic + 'width:100%; top:'+(this.spaces[1]-2)+'px; height:auto; border-collapse:separate; border:none; border-spacing: '+(this.spaces[0]-2)+'px '+(this.spaces[1]-2)+'px;' );
|
|
34
|
-
|
|
35
|
-
let n = 0, b, mid, td, tr, sel;
|
|
36
|
-
|
|
37
|
-
this.res = -1
|
|
38
|
-
this.isDown = false
|
|
39
|
-
this.neverlock = true
|
|
40
|
-
|
|
41
|
-
this.buttons = [];
|
|
42
|
-
this.stat = [];
|
|
43
|
-
this.tmpX = [];
|
|
44
|
-
this.tmpY = [];
|
|
45
|
-
|
|
46
|
-
let cc = this.colors;
|
|
47
|
-
|
|
48
|
-
for( let i = 0; i < this.grid[1]; i++ ){
|
|
49
|
-
|
|
50
|
-
tr = this.c[2].insertRow();
|
|
51
|
-
tr.style.cssText = 'pointer-events:none;';
|
|
52
|
-
for( let j = 0; j < this.grid[0]; j++ ){
|
|
53
|
-
|
|
54
|
-
td = tr.insertCell();
|
|
55
|
-
td.style.cssText = 'pointer-events:none;';
|
|
56
|
-
|
|
57
|
-
if( this.values[n] ){
|
|
58
|
-
|
|
59
|
-
sel = false;
|
|
60
|
-
if( this.values[n] === this.value && this.isSelectable ) sel = true;
|
|
61
|
-
|
|
62
|
-
b = document.createElement( 'div' );
|
|
63
|
-
b.style.cssText = this.css.txt + this.css.button + 'position:static; width:'+this.bsize[0]+'px; height:'+this.bsize[1]+'px; border:'+cc.borderSize+'px solid '+cc.border+'; left:auto; right:auto; border-radius:'+this.radius+'px;';
|
|
64
|
-
b.style.background = sel ? cc.select : cc.button;
|
|
65
|
-
b.style.color = sel ? cc.textSelect : cc.text;
|
|
66
|
-
b.innerHTML = this.values[n];
|
|
67
|
-
td.appendChild( b );
|
|
68
|
-
|
|
69
|
-
this.buttons.push(b);
|
|
70
|
-
this.stat.push(1);
|
|
71
|
-
|
|
72
|
-
} else {
|
|
73
|
-
|
|
74
|
-
b = document.createElement( 'div' );
|
|
75
|
-
b.style.cssText = this.css.txt + 'position:static; width:'+this.bsize[0]+'px; height:'+this.bsize[1]+'px; text-align:center; left:auto; right:auto; background:none;';
|
|
76
|
-
td.appendChild( b );
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
if(j===0) b.style.cssText += 'float:right;';
|
|
81
|
-
else b.style.cssText += 'float:left;';
|
|
82
|
-
|
|
83
|
-
n++;
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
this.init();
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
testZone ( e ) {
|
|
93
|
-
|
|
94
|
-
let l = this.local;
|
|
95
|
-
if( l.x === -1 && l.y === -1 ) return -1;
|
|
96
|
-
|
|
97
|
-
let tx = this.tmpX;
|
|
98
|
-
let ty = this.tmpY;
|
|
99
|
-
|
|
100
|
-
let id = -1;
|
|
101
|
-
let c = -1;
|
|
102
|
-
let line = -1;
|
|
103
|
-
let i = this.grid[0];
|
|
104
|
-
while( i-- ){
|
|
105
|
-
if( l.x > tx[i][0] && l.x < tx[i][1] ) c = i;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
i = this.grid[1];
|
|
109
|
-
while( i-- ){
|
|
110
|
-
if( l.y > ty[i][0] && l.y < ty[i][1] ) line = i;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
if(c!==-1 && line!==-1){
|
|
114
|
-
id = c + (line*2);
|
|
115
|
-
if(id>this.lng-1) id = -1;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
return id;
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
// ----------------------
|
|
123
|
-
// EVENTS
|
|
124
|
-
// ----------------------
|
|
125
|
-
|
|
126
|
-
mouseup ( e ) {
|
|
127
|
-
|
|
128
|
-
if( !this.isDown ) return false
|
|
129
|
-
|
|
130
|
-
this.isDown = false
|
|
131
|
-
if( this.res !== -1 ){
|
|
132
|
-
this.value = this.values[this.res]
|
|
133
|
-
this.send()
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
return this.mousemove( e )
|
|
137
|
-
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
mousedown ( e ) {
|
|
141
|
-
|
|
142
|
-
if( this.isDown ) return false
|
|
143
|
-
this.isDown = true
|
|
144
|
-
return this.mousemove( e )
|
|
145
|
-
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
mousemove ( e ) {
|
|
149
|
-
|
|
150
|
-
let up = false;
|
|
151
|
-
this.res = this.testZone( e );
|
|
152
|
-
|
|
153
|
-
if( this.res !== -1 ){
|
|
154
|
-
this.cursor('pointer');
|
|
155
|
-
up = this.modes( this.isDown ? 3 : 2, this.res );
|
|
156
|
-
} else {
|
|
157
|
-
up = this.reset();
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
return up;
|
|
161
|
-
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
// ----------------------
|
|
165
|
-
// MODE
|
|
166
|
-
// -----------------------
|
|
167
|
-
|
|
168
|
-
modes ( N = 1, id = -1 ) {
|
|
169
|
-
|
|
170
|
-
let i = this.lng, w, n, r = false
|
|
171
|
-
|
|
172
|
-
while( i-- ){
|
|
173
|
-
|
|
174
|
-
n = N
|
|
175
|
-
w = this.isSelectable ? this.values[ i ] === this.value : false
|
|
176
|
-
|
|
177
|
-
if( i === id ){
|
|
178
|
-
if( w && n === 2 ) n = 3
|
|
179
|
-
} else {
|
|
180
|
-
n = 1
|
|
181
|
-
if( w ) n = 4
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
if( this.mode( n, i ) ) r = true
|
|
185
|
-
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
return r
|
|
189
|
-
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
mode ( n, id ) {
|
|
193
|
-
|
|
194
|
-
let change = false;
|
|
195
|
-
let cc = this.colors, s = this.buttons
|
|
196
|
-
let i = id
|
|
197
|
-
|
|
198
|
-
if( this.stat[id] !== n ){
|
|
199
|
-
|
|
200
|
-
this.stat[id] = n;
|
|
201
|
-
|
|
202
|
-
switch( n ){
|
|
203
|
-
|
|
204
|
-
case 1: s[i].style.color = cc.text; s[i].style.background = cc.button; break;
|
|
205
|
-
case 2: s[i].style.color = cc.textOver; s[i].style.background = cc.overoff; break;
|
|
206
|
-
case 3: s[i].style.color = cc.textOver; s[i].style.background = cc.over; break;
|
|
207
|
-
case 4: s[i].style.color = cc.textSelect; s[i].style.background = cc.select; break;
|
|
208
|
-
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
change = true;
|
|
212
|
-
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
return change;
|
|
216
|
-
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
// ----------------------
|
|
220
|
-
|
|
221
|
-
reset () {
|
|
222
|
-
|
|
223
|
-
this.res = -1
|
|
224
|
-
this.cursor()
|
|
225
|
-
return this.modes()
|
|
226
|
-
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
label ( string, n ) {
|
|
231
|
-
|
|
232
|
-
this.buttons[n].textContent = string;
|
|
233
|
-
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
icon ( string, y, n ) {
|
|
237
|
-
|
|
238
|
-
this.buttons[n].style.padding = ( y || 0 ) +'px 0px';
|
|
239
|
-
this.buttons[n].innerHTML = string;
|
|
240
|
-
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
testW () {
|
|
244
|
-
|
|
245
|
-
let vw = this.spaces[0]*3 + this.bsizeMax*2, rz = false;
|
|
246
|
-
if( vw > this.w ) {
|
|
247
|
-
this.bsize[0] = ( this.w-(this.spaces[0]*3) ) * 0.5;
|
|
248
|
-
rz = true;
|
|
249
|
-
} else {
|
|
250
|
-
if( this.bsize[0] !== this.bsizeMax ) {
|
|
251
|
-
this.bsize[0] = this.bsizeMax;
|
|
252
|
-
rz = true;
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
if( !rz ) return;
|
|
257
|
-
|
|
258
|
-
let i = this.buttons.length;
|
|
259
|
-
while(i--) this.buttons[i].style.width = this.bsize[0] + 'px';
|
|
260
|
-
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
rSize () {
|
|
264
|
-
|
|
265
|
-
super.rSize();
|
|
266
|
-
|
|
267
|
-
this.testW();
|
|
268
|
-
|
|
269
|
-
let n = 0, b, mid;
|
|
270
|
-
|
|
271
|
-
this.tmpX = [];
|
|
272
|
-
this.tmpY = [];
|
|
273
|
-
|
|
274
|
-
for( let j = 0; j < this.grid[0]; j++ ){
|
|
275
|
-
|
|
276
|
-
if(j===0){
|
|
277
|
-
mid = ( this.w*0.5 ) - ( this.spaces[0]*0.5 );
|
|
278
|
-
this.tmpX.push( [ mid-this.bsize[0], mid ] );
|
|
279
|
-
} else {
|
|
280
|
-
mid = ( this.w*0.5 ) + ( this.spaces[0]*0.5 );
|
|
281
|
-
this.tmpX.push( [ mid, mid+this.bsize[0] ] );
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
mid = this.spaces[1];
|
|
287
|
-
|
|
288
|
-
for( let i = 0; i < this.grid[1]; i++ ){
|
|
289
|
-
|
|
290
|
-
this.tmpY.push( [ mid, mid + this.bsize[1] ] );
|
|
291
|
-
mid += this.bsize[1] + this.spaces[1];
|
|
292
|
-
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
}
|
package/src/proto/Group.js
DELETED
|
@@ -1,430 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { Roots } from '../core/Roots.js';
|
|
3
|
-
import { Proto } from '../core/Proto.js';
|
|
4
|
-
|
|
5
|
-
export class Group extends Proto {
|
|
6
|
-
|
|
7
|
-
constructor( o = {} ) {
|
|
8
|
-
|
|
9
|
-
super( o );
|
|
10
|
-
|
|
11
|
-
this.isGroup = true
|
|
12
|
-
|
|
13
|
-
this.ADD = o.add;
|
|
14
|
-
|
|
15
|
-
this.uis = [];
|
|
16
|
-
|
|
17
|
-
this.isEmpty = true;
|
|
18
|
-
|
|
19
|
-
this.autoHeight = true;
|
|
20
|
-
this.current = -1;
|
|
21
|
-
this.targetIn = null;
|
|
22
|
-
|
|
23
|
-
this.decal = 0;
|
|
24
|
-
|
|
25
|
-
this.baseH = this.h;
|
|
26
|
-
|
|
27
|
-
let fltop = Math.floor(this.h*0.5)-6;
|
|
28
|
-
|
|
29
|
-
this.isLine = o.line !== undefined ? o.line : false;
|
|
30
|
-
|
|
31
|
-
this.decal = 0;
|
|
32
|
-
|
|
33
|
-
if( o.group ){
|
|
34
|
-
this.decal = o.group.decal ? o.group.decal : 0
|
|
35
|
-
this.decal += 6
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
this.useFlex = true
|
|
39
|
-
let flexible = this.useFlex ? 'display:flex; flex-flow: row wrap;' : ''
|
|
40
|
-
|
|
41
|
-
this.c[2] = this.dom( 'div', this.css.basic + flexible + 'width:100%; left:0; height:auto; overflow:hidden; top:'+this.h+'px');//
|
|
42
|
-
this.c[3] = this.dom( 'path', this.css.basic + 'position:absolute; width:10px; height:10px; left:0; top:'+fltop+'px;', { d:this.svgs.group, fill:this.colors.text, stroke:'none'});
|
|
43
|
-
this.c[4] = this.dom( 'path', this.css.basic + 'position:absolute; width:10px; height:10px; left:'+(4+this.decal)+'px; top:'+fltop+'px;', { d:this.svgs.arrow, fill:this.colors.text, stroke:'none'});
|
|
44
|
-
// bottom line
|
|
45
|
-
if( this.isLine ) this.c[5] = this.dom( 'div', this.css.basic + 'background:rgba(255, 255, 255, 0.2); width:100%; left:0; height:1px; bottom:0px');
|
|
46
|
-
|
|
47
|
-
let s = this.s;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
s[0].height = this.h + 'px';
|
|
52
|
-
s[1].height = this.h + 'px';
|
|
53
|
-
this.c[1].name = 'group';
|
|
54
|
-
|
|
55
|
-
s[1].marginLeft = (10+this.decal)+'px';
|
|
56
|
-
s[1].lineHeight = this.h-4;
|
|
57
|
-
s[1].color = this.colors.text;
|
|
58
|
-
s[1].fontWeight = 'bold';
|
|
59
|
-
|
|
60
|
-
if( this.radius !== 0 ) s[0].borderRadius = this.radius+'px';
|
|
61
|
-
//if( o.border ) s[0].border = '1px solid ' + o.border;
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
/*if(this.decal){
|
|
65
|
-
s[0].boxSizing = 'border-box';
|
|
66
|
-
s[0].backgroundClip = 'border-box';
|
|
67
|
-
s[0].border = (this.decal/3)+'px solid ' + o.group.colors.background;
|
|
68
|
-
}*/
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
this.init();
|
|
74
|
-
|
|
75
|
-
this.setBG( o.bg );
|
|
76
|
-
|
|
77
|
-
if( o.open !== undefined ) this.open();
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
//s[0].background = this.bg;
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
testZone ( e ) {
|
|
85
|
-
|
|
86
|
-
let l = this.local;
|
|
87
|
-
if( l.x === -1 && l.y === -1 ) return '';
|
|
88
|
-
|
|
89
|
-
let name = '';
|
|
90
|
-
|
|
91
|
-
if( l.y < this.baseH ) name = 'title';
|
|
92
|
-
else {
|
|
93
|
-
if( this.isOpen ) name = 'content';
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
return name;
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
clearTarget () {
|
|
101
|
-
|
|
102
|
-
if( this.current === -1 ) return false;
|
|
103
|
-
|
|
104
|
-
// if(!this.targetIn ) return;
|
|
105
|
-
this.targetIn .uiout();
|
|
106
|
-
this.targetIn .reset();
|
|
107
|
-
this.current = -1;
|
|
108
|
-
this.targetIn = null;
|
|
109
|
-
this.cursor();
|
|
110
|
-
return true;
|
|
111
|
-
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
reset () {
|
|
115
|
-
|
|
116
|
-
this.clearTarget();
|
|
117
|
-
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
// ----------------------
|
|
121
|
-
// EVENTS
|
|
122
|
-
// ----------------------
|
|
123
|
-
|
|
124
|
-
handleEvent ( e ) {
|
|
125
|
-
|
|
126
|
-
let type = e.type;
|
|
127
|
-
|
|
128
|
-
let change = false;
|
|
129
|
-
let targetChange = false;
|
|
130
|
-
|
|
131
|
-
let name = this.testZone( e );
|
|
132
|
-
|
|
133
|
-
if( !name ) return;
|
|
134
|
-
|
|
135
|
-
switch( name ){
|
|
136
|
-
|
|
137
|
-
case 'content':
|
|
138
|
-
this.cursor();
|
|
139
|
-
|
|
140
|
-
if( Roots.isMobile && type === 'mousedown' ) this.getNext( e, change );
|
|
141
|
-
|
|
142
|
-
if( this.targetIn ) targetChange = this.targetIn .handleEvent( e );
|
|
143
|
-
|
|
144
|
-
//if( type === 'mousemove' ) change = this.styles('def');
|
|
145
|
-
|
|
146
|
-
if( !Roots.lock ) this.getNext( e, change );
|
|
147
|
-
|
|
148
|
-
break;
|
|
149
|
-
case 'title':
|
|
150
|
-
this.cursor('pointer');
|
|
151
|
-
if( type === 'mousedown' ){
|
|
152
|
-
if( this.isOpen ) this.close();
|
|
153
|
-
else this.open();
|
|
154
|
-
}
|
|
155
|
-
break;
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
if( this.isDown ) change = true;
|
|
161
|
-
if( targetChange ) change = true;
|
|
162
|
-
|
|
163
|
-
return change;
|
|
164
|
-
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
getNext ( e, change ) {
|
|
168
|
-
|
|
169
|
-
let next = Roots.findTarget( this.uis, e );
|
|
170
|
-
|
|
171
|
-
if( next !== this.current ){
|
|
172
|
-
this.clearTarget();
|
|
173
|
-
this.current = next;
|
|
174
|
-
change = true;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
if( next !== -1 ){
|
|
178
|
-
this.targetIn = this.uis[ this.current ];
|
|
179
|
-
this.targetIn .uiover();
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
// ----------------------
|
|
185
|
-
|
|
186
|
-
/*calcH () {
|
|
187
|
-
|
|
188
|
-
let lng = this.uis.length, i, u, h=0, px=0, tmph=0;
|
|
189
|
-
for( i = 0; i < lng; i++){
|
|
190
|
-
u = this.uis[i];
|
|
191
|
-
if( !u.autoWidth ){
|
|
192
|
-
|
|
193
|
-
if(px===0) h += u.h+1;
|
|
194
|
-
else {
|
|
195
|
-
if(tmph<u.h) h += u.h-tmph;
|
|
196
|
-
}
|
|
197
|
-
tmph = u.h;
|
|
198
|
-
|
|
199
|
-
//tmph = tmph < u.h ? u.h : tmph;
|
|
200
|
-
px += u.w;
|
|
201
|
-
if( px+u.w > this.w ) px = 0;
|
|
202
|
-
|
|
203
|
-
}
|
|
204
|
-
else h += u.h+1;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
return h;
|
|
208
|
-
}*/
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
setBG ( bg ) {
|
|
214
|
-
|
|
215
|
-
if( bg !== undefined ) this.colors.background = bg
|
|
216
|
-
|
|
217
|
-
this.c[0].style.background = this.colors.background;
|
|
218
|
-
|
|
219
|
-
let i = this.uis.length;
|
|
220
|
-
while(i--){
|
|
221
|
-
this.uis[i].setBG( this.colors.background );
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
add () {
|
|
227
|
-
|
|
228
|
-
let a = arguments;
|
|
229
|
-
|
|
230
|
-
if( typeof a[1] === 'object' ){
|
|
231
|
-
a[1].isUI = this.isUI;
|
|
232
|
-
a[1].target = this.c[2];
|
|
233
|
-
a[1].main = this.main;
|
|
234
|
-
a[1].group = this;
|
|
235
|
-
} else if( typeof arguments[1] === 'string' ){
|
|
236
|
-
if( a[2] === undefined ) [].push.call( a, { isUI:true, target:this.c[2], main:this.main });
|
|
237
|
-
else{
|
|
238
|
-
a[2].isUI = true;
|
|
239
|
-
a[2].target = this.c[2];
|
|
240
|
-
a[2].main = this.main;
|
|
241
|
-
a[2].group = this;
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
//let n = add.apply( this, a );
|
|
246
|
-
let u = this.ADD.apply( this, a );
|
|
247
|
-
|
|
248
|
-
this.uis.push( u )
|
|
249
|
-
|
|
250
|
-
//this.calc()
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
this.isEmpty = false;
|
|
255
|
-
|
|
256
|
-
return u;
|
|
257
|
-
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
// remove one node
|
|
261
|
-
|
|
262
|
-
remove ( n ) {
|
|
263
|
-
|
|
264
|
-
if( n.clear ) n.clear();
|
|
265
|
-
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
// clear all iner
|
|
269
|
-
|
|
270
|
-
empty () {
|
|
271
|
-
|
|
272
|
-
this.close();
|
|
273
|
-
|
|
274
|
-
let i = this.uis.length, item;
|
|
275
|
-
|
|
276
|
-
while( i-- ){
|
|
277
|
-
item = this.uis.pop();
|
|
278
|
-
this.c[2].removeChild( item.c[0] );
|
|
279
|
-
item.clear( true );
|
|
280
|
-
|
|
281
|
-
//this.uis[i].clear()
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
this.isEmpty = true;
|
|
285
|
-
this.h = this.baseH;
|
|
286
|
-
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
// clear one element
|
|
290
|
-
|
|
291
|
-
clearOne ( n ) {
|
|
292
|
-
|
|
293
|
-
let id = this.uis.indexOf( n );
|
|
294
|
-
|
|
295
|
-
if ( id !== -1 ) {
|
|
296
|
-
this.calc( - ( this.uis[ id ].h + 1 ) );
|
|
297
|
-
this.c[2].removeChild( this.uis[ id ].c[0] );
|
|
298
|
-
this.uis.splice( id, 1 );
|
|
299
|
-
|
|
300
|
-
if( this.uis.length === 0 ){
|
|
301
|
-
this.isEmpty = true;
|
|
302
|
-
this.close();
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
open () {
|
|
311
|
-
|
|
312
|
-
super.open();
|
|
313
|
-
|
|
314
|
-
this.setSvg( this.c[4], 'd', this.svgs.arrowDown )
|
|
315
|
-
this.rSizeContent()
|
|
316
|
-
|
|
317
|
-
let t = this.h - this.baseH;
|
|
318
|
-
|
|
319
|
-
this.parentHeight()
|
|
320
|
-
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
close () {
|
|
324
|
-
|
|
325
|
-
super.close();
|
|
326
|
-
|
|
327
|
-
let t = this.h - this.baseH;
|
|
328
|
-
|
|
329
|
-
this.setSvg( this.c[4], 'd', this.svgs.arrow );
|
|
330
|
-
this.h = this.baseH;
|
|
331
|
-
this.s[0].height = this.h + 'px';
|
|
332
|
-
|
|
333
|
-
this.parentHeight()
|
|
334
|
-
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
clear () {
|
|
338
|
-
|
|
339
|
-
this.empty();
|
|
340
|
-
if( this.isUI ) this.main.calc( -( this.h + 1 ));
|
|
341
|
-
Proto.prototype.clear.call( this );
|
|
342
|
-
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
clearGroup () {
|
|
346
|
-
|
|
347
|
-
this.empty();
|
|
348
|
-
|
|
349
|
-
/*this.close();
|
|
350
|
-
|
|
351
|
-
let i = this.uis.length;
|
|
352
|
-
while(i--){
|
|
353
|
-
this.uis[i].clear();
|
|
354
|
-
}
|
|
355
|
-
this.uis = [];
|
|
356
|
-
this.h = this.baseH;*/
|
|
357
|
-
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
calcUis () {
|
|
361
|
-
|
|
362
|
-
if( !this.isOpen ) this.h = this.baseH;
|
|
363
|
-
else this.h = Roots.calcUis( this.uis, this.zone, this.zone.y + this.baseH ) + this.baseH;
|
|
364
|
-
|
|
365
|
-
this.s[0].height = this.h + 'px';
|
|
366
|
-
|
|
367
|
-
//console.log('G', this.h)
|
|
368
|
-
|
|
369
|
-
//if( !this.isOpen ) return;
|
|
370
|
-
|
|
371
|
-
//this.h = Roots.calcUis( this.uis, this.zone, this.zone.y + this.baseH )+this.baseH;
|
|
372
|
-
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
parentHeight ( t ) {
|
|
376
|
-
|
|
377
|
-
if ( this.group !== null ) this.group.calc( t )
|
|
378
|
-
else if ( this.isUI ) this.main.calc( t )
|
|
379
|
-
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
calc ( y ) {
|
|
383
|
-
|
|
384
|
-
if( !this.isOpen ) return;
|
|
385
|
-
|
|
386
|
-
/*
|
|
387
|
-
|
|
388
|
-
if( y !== undefined ){
|
|
389
|
-
this.h += y;
|
|
390
|
-
if( this.isUI ) this.main.calc( y );
|
|
391
|
-
} else {
|
|
392
|
-
this.h = this.calcH() + this.baseH;
|
|
393
|
-
}
|
|
394
|
-
this.s[0].height = this.h + 'px';*/
|
|
395
|
-
|
|
396
|
-
// if(this.isOpen)
|
|
397
|
-
if( this.isUI ) this.main.calc()
|
|
398
|
-
else this.calcUis()
|
|
399
|
-
|
|
400
|
-
this.s[0].height = this.h + 'px';
|
|
401
|
-
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
rSizeContent () {
|
|
405
|
-
|
|
406
|
-
let i = this.uis.length;
|
|
407
|
-
while(i--){
|
|
408
|
-
this.uis[i].setSize( this.w );
|
|
409
|
-
this.uis[i].rSize();
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
//this.calc()
|
|
413
|
-
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
rSize () {
|
|
417
|
-
|
|
418
|
-
super.rSize();
|
|
419
|
-
|
|
420
|
-
let s = this.s;
|
|
421
|
-
|
|
422
|
-
s[3].left = ( this.sa + this.sb - 17 ) + 'px';
|
|
423
|
-
s[1].width = this.w + 'px';
|
|
424
|
-
s[2].width = this.w + 'px';
|
|
425
|
-
|
|
426
|
-
if( this.isOpen ) this.rSizeContent();
|
|
427
|
-
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
}
|