uil 1.0.0 → 4.0.2
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 +39 -22
- package/build/uil.js +7043 -4138
- package/build/uil.min.js +6 -4
- package/build/uil.module.js +7244 -2740
- package/package.json +53 -53
- package/src/Uil.js +0 -21
- package/src/core/Gui.js +0 -454
- package/src/core/Proto.js +0 -406
- package/src/core/Tools.js +0 -385
- package/src/core/add.js +0 -92
- package/src/polyfills.js +0 -85
- package/src/proto/Bool.js +0 -82
- package/src/proto/Button.js +0 -209
- package/src/proto/Circular.js +0 -197
- package/src/proto/Color.js +0 -369
- package/src/proto/Fps.js +0 -254
- package/src/proto/Group.js +0 -254
- package/src/proto/Joystick.js +0 -265
- package/src/proto/Knob.js +0 -141
- package/src/proto/List.js +0 -377
- package/src/proto/Numeric.js +0 -250
- package/src/proto/Slide.js +0 -261
- package/src/proto/TextInput.js +0 -91
- package/src/proto/Title.js +0 -52
package/package.json
CHANGED
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "uil",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "JavaScript
|
|
5
|
-
"main": "build/uil.js",
|
|
6
|
-
"repository": "lo-th/uil",
|
|
7
|
-
"jsnext:main": "build/uil.module.js",
|
|
8
|
-
"module": "build/uil.module.js",
|
|
9
|
-
"files": [
|
|
10
|
-
"package.json",
|
|
11
|
-
"LICENSE",
|
|
12
|
-
"README.md",
|
|
13
|
-
"build/uil.js",
|
|
14
|
-
"build/uil.min.js",
|
|
15
|
-
"build/uil.module.js"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
"
|
|
24
|
-
},
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
"
|
|
37
|
-
|
|
38
|
-
"uil
|
|
39
|
-
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
|
|
43
|
-
"
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"rollup": "^
|
|
50
|
-
"rollup-
|
|
51
|
-
"
|
|
52
|
-
}
|
|
53
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "uil",
|
|
3
|
+
"version": "4.0.2",
|
|
4
|
+
"description": "JavaScript gui library",
|
|
5
|
+
"main": "build/uil.js",
|
|
6
|
+
"repository": "lo-th/uil",
|
|
7
|
+
"jsnext:main": "build/uil.module.js",
|
|
8
|
+
"module": "build/uil.module.js",
|
|
9
|
+
"files": [
|
|
10
|
+
"package.json",
|
|
11
|
+
"LICENSE",
|
|
12
|
+
"README.md",
|
|
13
|
+
"build/uil.js",
|
|
14
|
+
"build/uil.min.js",
|
|
15
|
+
"build/uil.module.js"
|
|
16
|
+
],
|
|
17
|
+
"directories": {
|
|
18
|
+
"doc": "docs",
|
|
19
|
+
"example": "examples",
|
|
20
|
+
"test": "test"
|
|
21
|
+
},
|
|
22
|
+
"eslintConfig": {
|
|
23
|
+
"extends": "mdcs"
|
|
24
|
+
},
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "rollup -c utils/build/rollup.config.js",
|
|
27
|
+
"dev": "concurrently --names \"ROLLUP,HTTP\" -c \"bgBlue.bold,bgGreen.bold\" \"rollup -c utils/build/rollup.config.js -w -m inline\" \"servez -p 8111 --index\"",
|
|
28
|
+
"start": "concurrently --names \"ROLLUP,HTTP\" -c \"bgBlue.bold,bgGreen.bold\" \"rollup -c utils/build/rollup.config.js -w -m inline\" \"http-server -c-1 -p 8111 -o index.html\""
|
|
29
|
+
},
|
|
30
|
+
"keywords": [
|
|
31
|
+
"uil",
|
|
32
|
+
"uil.js",
|
|
33
|
+
"ui"
|
|
34
|
+
],
|
|
35
|
+
"author": "lo-th",
|
|
36
|
+
"license": "MIT",
|
|
37
|
+
"bugs": {
|
|
38
|
+
"url": "https://github.com/lo-th/uil/issues"
|
|
39
|
+
},
|
|
40
|
+
"homepage": "http://lo-th.github.io/uil/",
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@babel/core": "^7.12.16",
|
|
43
|
+
"@babel/plugin-proposal-class-properties": "^7.12.13",
|
|
44
|
+
"@babel/preset-env": "^7.12.16",
|
|
45
|
+
"@rollup/plugin-babel": "^5.3.0",
|
|
46
|
+
"@rollup/plugin-node-resolve": "^11.2.0",
|
|
47
|
+
"concurrently": "^5.3.0",
|
|
48
|
+
"regenerator-runtime": "^0.13.7",
|
|
49
|
+
"rollup": "^2.39.0",
|
|
50
|
+
"rollup-plugin-terser": "^7.0.2",
|
|
51
|
+
"servez": "^1.11.0"
|
|
52
|
+
}
|
|
53
|
+
}
|
package/src/Uil.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import './polyfills.js';
|
|
2
|
-
|
|
3
|
-
export { Tools } from './core/Tools.js';
|
|
4
|
-
export { Gui } from './core/Gui.js';
|
|
5
|
-
export { Proto } from './core/Proto.js';
|
|
6
|
-
//export { add } from './core/add.js';
|
|
7
|
-
export * from './core/add.js';
|
|
8
|
-
//
|
|
9
|
-
export { Bool } from './proto/Bool.js';
|
|
10
|
-
export { Button } from './proto/Button.js';
|
|
11
|
-
export { Circular } from './proto/Circular.js';
|
|
12
|
-
export { Color } from './proto/Color.js';
|
|
13
|
-
export { Fps } from './proto/Fps.js';
|
|
14
|
-
export { Group } from './proto/Group.js';
|
|
15
|
-
export { Joystick } from './proto/Joystick.js';
|
|
16
|
-
export { Knob } from './proto/Knob.js';
|
|
17
|
-
export { List } from './proto/List.js';
|
|
18
|
-
export { Numeric } from './proto/Numeric.js';
|
|
19
|
-
export { Slide } from './proto/Slide.js';
|
|
20
|
-
export { TextInput } from './proto/TextInput.js';
|
|
21
|
-
export { Title } from './proto/Title.js';
|
package/src/core/Gui.js
DELETED
|
@@ -1,454 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { Tools } from './Tools';
|
|
3
|
-
import { add } from './add';
|
|
4
|
-
|
|
5
|
-
function Gui ( o ) {
|
|
6
|
-
|
|
7
|
-
o = o || {};
|
|
8
|
-
|
|
9
|
-
//this.height = o.height || 20;
|
|
10
|
-
|
|
11
|
-
if( o.Tpercent !== undefined ) Tools.base.P = o.Tpercent;
|
|
12
|
-
if( o.css === undefined ) o.css = '';
|
|
13
|
-
|
|
14
|
-
this.height = 20;
|
|
15
|
-
this.width = o.width !== undefined ? o.width : Tools.base.WIDTH;
|
|
16
|
-
this.width = o.size !== undefined ? o.size : this.width;
|
|
17
|
-
|
|
18
|
-
this.left = 0;
|
|
19
|
-
this.top = o.top || 0;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
this.h = 0;//this.height;
|
|
23
|
-
this.prevY = -1;
|
|
24
|
-
|
|
25
|
-
// bottom and close height
|
|
26
|
-
this.isWithClose = true;
|
|
27
|
-
this.bh = o.bh || 20;
|
|
28
|
-
|
|
29
|
-
if(o.close !== undefined ){
|
|
30
|
-
this.isWithClose = o.close;
|
|
31
|
-
this.bh = !this.isWithClose ? 0 : this.bh;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
// scroll width
|
|
37
|
-
this.sw = o.sw || 10;
|
|
38
|
-
|
|
39
|
-
Tools.main = this;
|
|
40
|
-
|
|
41
|
-
this.callback = o.callback === undefined ? null : o.callback;
|
|
42
|
-
|
|
43
|
-
//this.color = o.color || UIL.COLOR;
|
|
44
|
-
this.bg = o.bg || 'rgba(44,44,44,0.3)';
|
|
45
|
-
|
|
46
|
-
this.isCenter = o.center || false;
|
|
47
|
-
this.lockwheel = false;
|
|
48
|
-
this.onWheel = false;
|
|
49
|
-
this.isOpen = true;
|
|
50
|
-
|
|
51
|
-
this.uis = [];
|
|
52
|
-
|
|
53
|
-
this.content = Tools.dom( 'div', Tools.css.basic + 'display:block; width:'+this.width+'px; height:auto; top:0; right:10px; transition:height 0.1s ease-out;' + o.css );
|
|
54
|
-
document.body.appendChild( this.content );
|
|
55
|
-
|
|
56
|
-
this.innerContent = Tools.dom( 'div', Tools.css.basic + 'width:100%; top:0; left:0; height:auto;overflow:hidden;');
|
|
57
|
-
this.content.appendChild(this.innerContent);
|
|
58
|
-
|
|
59
|
-
this.inner = Tools.dom( 'div', Tools.css.basic + 'width:100%; top:0; left:0; height:auto;');
|
|
60
|
-
this.innerContent.appendChild(this.inner);
|
|
61
|
-
this.inner.name = 'inner';
|
|
62
|
-
|
|
63
|
-
//this.scrollBG = Tools.dom('UIL scroll-bg');
|
|
64
|
-
this.scrollBG = Tools.dom( 'div', Tools.css.basic + 'right:0; top:0; width:10px; height:10px; cursor:s-resize; pointer-events:auto; display:none;');
|
|
65
|
-
this.content.appendChild(this.scrollBG);
|
|
66
|
-
this.scrollBG.name = 'scroll';
|
|
67
|
-
|
|
68
|
-
//this.scroll = Tools.dom('UIL scroll');
|
|
69
|
-
this.scroll = Tools.dom( 'div', Tools.css.basic + 'background:#666; right:0; top:0; width:5px; height:10px;');
|
|
70
|
-
this.scrollBG.appendChild( this.scroll );
|
|
71
|
-
|
|
72
|
-
this.bottom = Tools.dom( 'div', Tools.css.txt + 'width:100%; top:auto; bottom:0; left:0; border-bottom-right-radius:10px; border-bottom-left-radius:10px; text-align:center; pointer-events:auto; cursor:pointer; height:'+this.bh+'px; line-height:'+(this.bh-5)+'px;');
|
|
73
|
-
this.content.appendChild(this.bottom);
|
|
74
|
-
this.bottom.textContent = 'close';
|
|
75
|
-
this.bottom.name = 'bottom';
|
|
76
|
-
this.bottom.style.background = this.bg;
|
|
77
|
-
|
|
78
|
-
this.isDown = false;
|
|
79
|
-
this.isScroll = false;
|
|
80
|
-
|
|
81
|
-
this.callbackClose = function(){};
|
|
82
|
-
|
|
83
|
-
this.content.addEventListener( 'mousedown', this, false );
|
|
84
|
-
this.content.addEventListener( 'mousemove', this, false );
|
|
85
|
-
this.content.addEventListener( 'mouseout', this, false );
|
|
86
|
-
this.content.addEventListener( 'mouseup', this, false );
|
|
87
|
-
this.content.addEventListener( 'mouseover', this, false );
|
|
88
|
-
//this.content.addEventListener( 'mousewheel', this, false );
|
|
89
|
-
|
|
90
|
-
document.addEventListener( 'mousewheel', function(e){this.wheel(e)}.bind(this), false );
|
|
91
|
-
|
|
92
|
-
window.addEventListener("resize", function(e){this.resize(e)}.bind(this), false );
|
|
93
|
-
|
|
94
|
-
//
|
|
95
|
-
|
|
96
|
-
this.setWidth( this.width );
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
Gui.prototype = {
|
|
101
|
-
|
|
102
|
-
constructor: Gui,
|
|
103
|
-
|
|
104
|
-
hide : function (b) {
|
|
105
|
-
|
|
106
|
-
if(b) this.content.style.display = 'none';
|
|
107
|
-
else this.content.style.display = 'block';
|
|
108
|
-
|
|
109
|
-
},
|
|
110
|
-
|
|
111
|
-
setBG : function(c){
|
|
112
|
-
|
|
113
|
-
this.bg = c;
|
|
114
|
-
|
|
115
|
-
var i = this.uis.length;
|
|
116
|
-
while(i--){
|
|
117
|
-
this.uis[i].setBG(c);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
this.bottom.style.background = c;
|
|
121
|
-
|
|
122
|
-
},
|
|
123
|
-
|
|
124
|
-
getHTML : function(){
|
|
125
|
-
|
|
126
|
-
return this.content;
|
|
127
|
-
|
|
128
|
-
},
|
|
129
|
-
|
|
130
|
-
onChange : function( f ){
|
|
131
|
-
|
|
132
|
-
this.callback = f;
|
|
133
|
-
return this;
|
|
134
|
-
|
|
135
|
-
},
|
|
136
|
-
|
|
137
|
-
handleEvent : function( e ) {
|
|
138
|
-
|
|
139
|
-
//e.preventDefault();
|
|
140
|
-
//e.stopPropagation();
|
|
141
|
-
|
|
142
|
-
switch( e.type ) {
|
|
143
|
-
case 'mousedown': this.down( e ); break;
|
|
144
|
-
case 'mouseout': this.out( e ); break;
|
|
145
|
-
case 'mouseover': this.over( e ); break;
|
|
146
|
-
//case 'mousewheel': this.wheel( e ); break;
|
|
147
|
-
|
|
148
|
-
case 'mouseup': this.up( e ); break;
|
|
149
|
-
case 'mousemove': this.move( e ); break;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
},
|
|
153
|
-
|
|
154
|
-
// Mouse event
|
|
155
|
-
|
|
156
|
-
down: function( e ){
|
|
157
|
-
|
|
158
|
-
if( !e.target.name ) return;
|
|
159
|
-
|
|
160
|
-
if(e.target.name === 'scroll'){
|
|
161
|
-
this.isDown = true;
|
|
162
|
-
this.move( e );
|
|
163
|
-
document.addEventListener( 'mouseup', this, false );
|
|
164
|
-
document.addEventListener( 'mousemove', this, false );
|
|
165
|
-
}
|
|
166
|
-
if(e.target.name === 'bottom'){
|
|
167
|
-
this.isOpen = this.isOpen ? false : true;
|
|
168
|
-
this.bottom.textContent = this.isOpen ? 'close' : 'open';
|
|
169
|
-
this.testHeight();
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
},
|
|
173
|
-
|
|
174
|
-
move: function( e ){
|
|
175
|
-
|
|
176
|
-
if(!this.isDown) return;
|
|
177
|
-
this.scroll.style.background = '#AAA';
|
|
178
|
-
this.update( (e.clientY-this.top)-(this.sh*0.5) );
|
|
179
|
-
|
|
180
|
-
},
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
out: function( e ){
|
|
185
|
-
|
|
186
|
-
if( !e.target.name ) return;
|
|
187
|
-
|
|
188
|
-
if(e.target.name === 'scroll'){
|
|
189
|
-
this.scroll.style.background = '#666';
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
if(e.target.name === 'bottom'){
|
|
193
|
-
this.bottom.style.color = '#CCC';
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
},
|
|
197
|
-
|
|
198
|
-
up: function( e ){
|
|
199
|
-
|
|
200
|
-
this.isDown = false;
|
|
201
|
-
this.scroll.style.background = '#666';
|
|
202
|
-
document.removeEventListener( 'mouseup', this, false );
|
|
203
|
-
document.removeEventListener( 'mousemove', this, false );
|
|
204
|
-
|
|
205
|
-
},
|
|
206
|
-
|
|
207
|
-
over: function( e ){
|
|
208
|
-
|
|
209
|
-
if( !e.target.name ) return;
|
|
210
|
-
if(e.target.name === 'scroll'){
|
|
211
|
-
this.scroll.style.background = '#888';
|
|
212
|
-
}
|
|
213
|
-
if(e.target.name === 'bottom'){
|
|
214
|
-
this.bottom.style.color = '#FFF';
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
},
|
|
218
|
-
|
|
219
|
-
// Wheel event
|
|
220
|
-
|
|
221
|
-
wheel: function ( e ){
|
|
222
|
-
|
|
223
|
-
//e.preventDefault();
|
|
224
|
-
//e.stopPropagation();
|
|
225
|
-
|
|
226
|
-
if( this.lockwheel || !this.isScroll ) return;
|
|
227
|
-
|
|
228
|
-
//this.onWheel = true;
|
|
229
|
-
|
|
230
|
-
var x = e.clientX;
|
|
231
|
-
var px = this.content.getBoundingClientRect().left;
|
|
232
|
-
|
|
233
|
-
if(x<px) return;
|
|
234
|
-
if(x>(px+this.width)) return;
|
|
235
|
-
|
|
236
|
-
var delta = 0;
|
|
237
|
-
if(e.wheelDeltaY) delta = -e.wheelDeltaY*0.04;
|
|
238
|
-
else if(e.wheelDelta) delta = -e.wheelDelta*0.2;
|
|
239
|
-
else if(e.detail) delta =e.detail*4.0;
|
|
240
|
-
|
|
241
|
-
this.py += delta;
|
|
242
|
-
|
|
243
|
-
this.update( this.py );
|
|
244
|
-
|
|
245
|
-
},
|
|
246
|
-
|
|
247
|
-
// -----------------------------------
|
|
248
|
-
|
|
249
|
-
// Add node to gui
|
|
250
|
-
|
|
251
|
-
add:function(){
|
|
252
|
-
|
|
253
|
-
var a = arguments;
|
|
254
|
-
|
|
255
|
-
if( typeof a[1] === 'object' ){
|
|
256
|
-
|
|
257
|
-
a[1].isUI = true;
|
|
258
|
-
a[1].main = this;
|
|
259
|
-
|
|
260
|
-
} else if( typeof a[1] === 'string' ){
|
|
261
|
-
|
|
262
|
-
if( a[2] === undefined ) [].push.call(a, { isUI:true, main:this });
|
|
263
|
-
else {
|
|
264
|
-
a[2].isUI = true;
|
|
265
|
-
a[2].main = this;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
var n = add.apply( this, a );
|
|
272
|
-
//var n = UIL.add( ...args );
|
|
273
|
-
|
|
274
|
-
this.uis.push( n );
|
|
275
|
-
n.py = this.h;
|
|
276
|
-
|
|
277
|
-
if( !n.autoWidth ){
|
|
278
|
-
var y = n.c[0].getBoundingClientRect().top;
|
|
279
|
-
if( this.prevY !== y ){
|
|
280
|
-
this.calc( n.h + 1 );
|
|
281
|
-
this.prevY = y;
|
|
282
|
-
}
|
|
283
|
-
}else{
|
|
284
|
-
this.prevY = -1;
|
|
285
|
-
this.calc( n.h + 1 );
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
return n;
|
|
289
|
-
},
|
|
290
|
-
|
|
291
|
-
// remove one node
|
|
292
|
-
|
|
293
|
-
remove: function ( n ) {
|
|
294
|
-
|
|
295
|
-
var i = this.uis.indexOf( n );
|
|
296
|
-
if ( i !== -1 ) this.uis[i].clear();
|
|
297
|
-
|
|
298
|
-
},
|
|
299
|
-
|
|
300
|
-
// call after uis clear
|
|
301
|
-
|
|
302
|
-
clearOne: function ( n ) {
|
|
303
|
-
|
|
304
|
-
var i = this.uis.indexOf( n );
|
|
305
|
-
if ( i !== -1 ) {
|
|
306
|
-
this.inner.removeChild( this.uis[i].c[0] );
|
|
307
|
-
this.uis.splice( i, 1 );
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
},
|
|
311
|
-
|
|
312
|
-
// clear all gui
|
|
313
|
-
|
|
314
|
-
clear:function(){
|
|
315
|
-
|
|
316
|
-
var i = this.uis.length;
|
|
317
|
-
while(i--) this.uis[i].clear();
|
|
318
|
-
|
|
319
|
-
this.uis = [];
|
|
320
|
-
Tools.listens = [];
|
|
321
|
-
|
|
322
|
-
this.calc( - this.h );
|
|
323
|
-
|
|
324
|
-
},
|
|
325
|
-
|
|
326
|
-
// -----------------------------------
|
|
327
|
-
|
|
328
|
-
// Scroll
|
|
329
|
-
|
|
330
|
-
update: function ( y ){
|
|
331
|
-
|
|
332
|
-
y = y < 0 ? 0 :y;
|
|
333
|
-
y = y > this.range ? this.range : y;
|
|
334
|
-
|
|
335
|
-
this.inner.style.top = -( ~~ ( y / this.ratio ) ) + 'px';
|
|
336
|
-
this.scroll.style.top = ( ~~ y ) + 'px';
|
|
337
|
-
|
|
338
|
-
this.py = y;
|
|
339
|
-
|
|
340
|
-
//this.onWheel = false;
|
|
341
|
-
|
|
342
|
-
},
|
|
343
|
-
|
|
344
|
-
showScroll:function(h){
|
|
345
|
-
|
|
346
|
-
this.isScroll = true;
|
|
347
|
-
|
|
348
|
-
this.total = this.h;
|
|
349
|
-
this.maxView = this.maxHeight;// - this.height;
|
|
350
|
-
|
|
351
|
-
this.ratio = this.maxView / this.total;
|
|
352
|
-
this.sh = this.maxView * this.ratio;
|
|
353
|
-
|
|
354
|
-
if( this.sh < 20 ) this.sh = 20;
|
|
355
|
-
|
|
356
|
-
this.range = this.maxView - this.sh;
|
|
357
|
-
|
|
358
|
-
this.scrollBG.style.display = 'block';
|
|
359
|
-
this.scrollBG.style.height = this.maxView + 'px';
|
|
360
|
-
this.scroll.style.height = this.sh + 'px';
|
|
361
|
-
|
|
362
|
-
this.update( 0 );
|
|
363
|
-
},
|
|
364
|
-
|
|
365
|
-
hideScroll:function(){
|
|
366
|
-
|
|
367
|
-
this.isScroll = false;
|
|
368
|
-
this.update( 0 );
|
|
369
|
-
|
|
370
|
-
this.scrollBG.style.display = 'none';
|
|
371
|
-
|
|
372
|
-
},
|
|
373
|
-
|
|
374
|
-
// -----------------------------------
|
|
375
|
-
|
|
376
|
-
resize:function(e){
|
|
377
|
-
|
|
378
|
-
this.testHeight();
|
|
379
|
-
|
|
380
|
-
},
|
|
381
|
-
|
|
382
|
-
calc:function( y ) {
|
|
383
|
-
|
|
384
|
-
this.h += y;
|
|
385
|
-
clearTimeout( this.tmp );
|
|
386
|
-
this.tmp = setTimeout( this.testHeight.bind(this), 10);
|
|
387
|
-
|
|
388
|
-
},
|
|
389
|
-
|
|
390
|
-
testHeight:function(){
|
|
391
|
-
|
|
392
|
-
if( this.tmp ) clearTimeout( this.tmp );
|
|
393
|
-
|
|
394
|
-
this.height = this.top + this.bh;
|
|
395
|
-
|
|
396
|
-
if( this.isOpen ){
|
|
397
|
-
|
|
398
|
-
this.maxHeight = window.innerHeight - this.top - this.bh;
|
|
399
|
-
|
|
400
|
-
if( this.h > this.maxHeight ){
|
|
401
|
-
|
|
402
|
-
this.height = this.maxHeight + this.bh;
|
|
403
|
-
this.showScroll();
|
|
404
|
-
|
|
405
|
-
}else{
|
|
406
|
-
|
|
407
|
-
this.height = this.h + this.bh;
|
|
408
|
-
this.hideScroll();
|
|
409
|
-
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
} else {
|
|
413
|
-
|
|
414
|
-
this.hideScroll();
|
|
415
|
-
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
this.innerContent.style.height = this.height - this.bh + 'px';
|
|
419
|
-
this.content.style.height = this.height + 'px';
|
|
420
|
-
this.bottom.style.top = this.height - this.bh + 'px';
|
|
421
|
-
//this.zone.h = this.height;
|
|
422
|
-
|
|
423
|
-
},
|
|
424
|
-
|
|
425
|
-
setWidth:function( w ) {
|
|
426
|
-
|
|
427
|
-
if( w ) this.width = w;
|
|
428
|
-
this.content.style.width = this.width + 'px';
|
|
429
|
-
|
|
430
|
-
//console.log(this.width)
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
if( this.isCenter ) this.content.style.marginLeft = -(~~ (this.width*0.5)) + 'px';
|
|
434
|
-
|
|
435
|
-
var l = this.uis.length;
|
|
436
|
-
var i = l;
|
|
437
|
-
while(i--){
|
|
438
|
-
this.uis[i].setSize( this.width );
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
i = l;
|
|
442
|
-
while(i--){
|
|
443
|
-
this.uis[i].rSize();
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
this.resize();
|
|
447
|
-
|
|
448
|
-
},
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
};
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
export { Gui };
|