uil 1.0.1 → 4.0.0
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 +57 -0
- package/build/uil.js +7040 -4199
- package/build/uil.min.js +6 -4
- package/build/uil.module.js +7200 -2761
- package/examples/js/BufferGeometryUtils.js +921 -0
- package/examples/js/SimplexNoise.js +324 -0
- package/examples/js/controls/OrbitControls.js +1215 -0
- package/examples/js/controls/OrbitControls_.js +1042 -0
- package/examples/js/libs/sea3d.min.js +373 -0
- package/examples/js/libs/three.min.js +6 -0
- package/examples/js/math.js +447 -0
- package/examples/js/objects/Landscape.js +778 -0
- package/examples/js/objects/Lensflare.js +372 -0
- package/examples/js/objects/SuperSky.js +297 -0
- package/examples/js/objects/Water.js +329 -0
- package/package.json +56 -54
- package/src/Uil.js +2 -17
- package/src/Uil_dev.js +15 -0
- package/src/core/Gui.js +601 -299
- package/src/core/Proto.js +490 -220
- package/src/core/Roots.js +864 -0
- package/src/core/Tools.js +591 -140
- package/src/core/V2.js +131 -0
- package/src/core/add.js +52 -57
- package/src/proto/Bool.js +117 -52
- package/src/proto/Button.js +286 -146
- package/src/proto/Circular.js +162 -130
- package/src/proto/Color.js +331 -289
- package/src/proto/Empty.js +15 -0
- package/src/proto/Fps.js +232 -159
- package/src/proto/Graph.js +310 -0
- package/src/proto/Grid.js +297 -0
- package/src/proto/Group.js +334 -160
- package/src/proto/Item.js +120 -0
- package/src/proto/Joystick.js +159 -185
- package/src/proto/Knob.js +210 -91
- package/src/proto/List.js +661 -249
- package/src/proto/Numeric.js +329 -162
- package/src/proto/Pad2D.js +268 -0
- package/src/proto/Rubric.js +0 -0
- package/src/proto/Select.js +178 -0
- package/src/proto/Selector.js +13 -0
- package/src/proto/Slide.js +191 -185
- package/src/proto/TextInput.js +149 -59
- package/src/proto/Title.js +40 -31
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { Proto } from '../core/Proto.js';
|
|
2
|
+
|
|
3
|
+
export class Item extends Proto {
|
|
4
|
+
|
|
5
|
+
constructor( o = {} ) {
|
|
6
|
+
|
|
7
|
+
super( o );
|
|
8
|
+
|
|
9
|
+
this.p = 100;
|
|
10
|
+
this.value = this.txt;
|
|
11
|
+
this.status = 1;
|
|
12
|
+
|
|
13
|
+
this.itype = o.itype || 'none';
|
|
14
|
+
this.val = this.itype;
|
|
15
|
+
|
|
16
|
+
this.graph = this.svgs[ this.itype ];
|
|
17
|
+
|
|
18
|
+
let fltop = Math.floor(this.h*0.5)-7;
|
|
19
|
+
|
|
20
|
+
this.c[2] = this.dom( 'path', this.css.basic + 'position:absolute; width:14px; height:14px; left:5px; top:'+fltop+'px;', { d:this.graph, fill:this.colors.text, stroke:'none'});
|
|
21
|
+
|
|
22
|
+
this.s[1].marginLeft = 20 + 'px';
|
|
23
|
+
|
|
24
|
+
this.init();
|
|
25
|
+
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// ----------------------
|
|
29
|
+
// EVENTS
|
|
30
|
+
// ----------------------
|
|
31
|
+
|
|
32
|
+
mousemove ( e ) {
|
|
33
|
+
|
|
34
|
+
this.cursor('pointer');
|
|
35
|
+
|
|
36
|
+
//up = this.modes( this.isDown ? 3 : 2, name );
|
|
37
|
+
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
mousedown ( e ) {
|
|
41
|
+
|
|
42
|
+
if( this.isUI ) this.main.resetItem();
|
|
43
|
+
|
|
44
|
+
this.selected( true );
|
|
45
|
+
|
|
46
|
+
this.send();
|
|
47
|
+
|
|
48
|
+
return true;
|
|
49
|
+
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
uiout () {
|
|
53
|
+
|
|
54
|
+
if( this.isSelect ) this.mode(3);
|
|
55
|
+
else this.mode(1);
|
|
56
|
+
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
uiover () {
|
|
60
|
+
|
|
61
|
+
if( this.isSelect ) this.mode(4);
|
|
62
|
+
else this.mode(2);
|
|
63
|
+
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
update () {
|
|
67
|
+
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/*rSize () {
|
|
71
|
+
|
|
72
|
+
super.rSize();
|
|
73
|
+
|
|
74
|
+
}*/
|
|
75
|
+
|
|
76
|
+
mode ( n ) {
|
|
77
|
+
|
|
78
|
+
let change = false;
|
|
79
|
+
|
|
80
|
+
if( this.status !== n ){
|
|
81
|
+
|
|
82
|
+
this.status = n;
|
|
83
|
+
let s = this.s, cc = this.colors
|
|
84
|
+
|
|
85
|
+
switch( n ){
|
|
86
|
+
|
|
87
|
+
case 1: this.status = 1; s[1].color = cc.text; s[0].background = 'none'; break;
|
|
88
|
+
case 2: this.status = 2; s[1].color = cc.textOver; s[0].background = cc.back; break;
|
|
89
|
+
case 3: this.status = 3; s[1].color = cc.textSelect; s[0].background = cc.select; break;
|
|
90
|
+
case 4: this.status = 4; s[1].color = cc.textOver; s[0].background = cc.over; break;
|
|
91
|
+
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
change = true;
|
|
95
|
+
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return change;
|
|
99
|
+
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
reset () {
|
|
103
|
+
|
|
104
|
+
this.cursor();
|
|
105
|
+
// return this.mode( 1 );
|
|
106
|
+
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
selected ( b ){
|
|
110
|
+
|
|
111
|
+
if( this.isSelect ) this.mode(1);
|
|
112
|
+
|
|
113
|
+
this.isSelect = b || false;
|
|
114
|
+
|
|
115
|
+
if( this.isSelect ) this.mode(3);
|
|
116
|
+
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
}
|
package/src/proto/Joystick.js
CHANGED
|
@@ -1,267 +1,241 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Proto } from '../core/Proto.js';
|
|
2
|
+
import { V2 } from '../core/V2.js';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
export class Joystick extends Proto {
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
constructor( o = {} ) {
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
super( o );
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
this.autoWidth = false;
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
this.value = [0,0];
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
this.minw = this.w
|
|
15
|
+
this.diam = o.diam || this.w
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
this.joyType = 'analogique';
|
|
18
|
+
this.model = o.mode !== undefined ? o.mode : 0;
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
this.precision = o.precision || 2;
|
|
21
|
+
this.multiplicator = o.multiplicator || 1;
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
this.pos = new V2();
|
|
24
|
+
this.tmp = new V2();
|
|
24
25
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
/*this.radius = o.radius || 50;
|
|
28
|
-
|
|
29
|
-
this.width = (this.radius*2)+20;
|
|
30
|
-
|
|
31
|
-
if(o.width !== undefined){
|
|
32
|
-
this.width = o.width;
|
|
33
|
-
this.radius = ~~ (( this.width-20 )*0.5);
|
|
34
|
-
}
|
|
35
|
-
if(o.size !== undefined){
|
|
36
|
-
this.width = o.size;
|
|
37
|
-
this.radius = ~~ (this.width-20)*0.5;
|
|
38
|
-
}*/
|
|
39
|
-
|
|
40
|
-
this.innerRadius = o.innerRadius || this.radius*0.6;
|
|
41
|
-
this.maxDistance = this.radius - this.innerRadius - 5;
|
|
42
|
-
this.height = this.radius*2;
|
|
43
|
-
this.h = o.height || (this.height + 40);
|
|
26
|
+
this.interval = null;
|
|
44
27
|
|
|
45
|
-
|
|
28
|
+
//this.radius = this.w * 0.5;
|
|
29
|
+
//this.distance = this.radius*0.25;
|
|
30
|
+
this.distance = (this.diam*0.5)*0.25;
|
|
46
31
|
|
|
47
|
-
|
|
32
|
+
this.h = o.h || this.w + 10;
|
|
33
|
+
this.top = 0;
|
|
48
34
|
|
|
49
|
-
|
|
35
|
+
this.c[0].style.width = this.w +'px';
|
|
50
36
|
|
|
51
|
-
this.c[1]
|
|
52
|
-
this.c[1].style.textAlign = 'center';
|
|
53
|
-
this.top = 20;
|
|
37
|
+
if( this.c[1] !== undefined ) { // with title
|
|
54
38
|
|
|
55
|
-
|
|
39
|
+
this.c[1].style.width = '100%';
|
|
40
|
+
this.c[1].style.justifyContent = 'center';
|
|
41
|
+
this.top = 10;
|
|
42
|
+
this.h += 10;
|
|
56
43
|
|
|
57
|
-
|
|
58
|
-
this.c[3] = Tools.dom( 'circle', Tools.css.basic + 'left:0px; top:'+(this.top-10)+'px; width:'+(this.w+20)+'px; height:'+(this.height+20)+'px;', { cx:this.radius+10, cy:this.radius+10, r:this.innerRadius+10, fill:'url(#gradS)'});
|
|
59
|
-
this.c[4] = Tools.dom( 'circle', Tools.css.basic + 'left:10px; top:'+this.top+'px; width:'+this.w+'px; height:'+this.height+'px;', { cx:this.radius, cy:this.radius, r:this.innerRadius, fill:'url(#gradIn)', 'stroke-width':1, stroke:'#000' });
|
|
60
|
-
this.c[5] = Tools.dom( 'div', Tools.css.txt + 'text-align:center; top:'+(this.height+20)+'px; width:'+this.width+'px; color:'+ this.fontColor );
|
|
44
|
+
}
|
|
61
45
|
|
|
62
|
-
|
|
63
|
-
var svg = this.c[2];
|
|
64
|
-
Tools.dom( 'defs', null, {}, svg );
|
|
65
|
-
Tools.dom( 'radialGradient', null, {id:'grad', cx:'50%', cy:'50%', r:'50%', fx:'50%', fy:'50%' }, svg, 1 );
|
|
66
|
-
Tools.dom( 'stop', null, { offset:'40%', style:'stop-color:rgb(0,0,0); stop-opacity:0.3;' }, svg, [1,0] );
|
|
67
|
-
Tools.dom( 'stop', null, { offset:'80%', style:'stop-color:rgb(0,0,0); stop-opacity:0;' }, svg, [1,0] );
|
|
68
|
-
Tools.dom( 'stop', null, { offset:'90%', style:'stop-color:rgb(50,50,50); stop-opacity:0.4;' }, svg, [1,0] );
|
|
69
|
-
Tools.dom( 'stop', null, { offset:'100%', style:'stop-color:rgb(50,50,50); stop-opacity:0;' }, svg, [1,0] );
|
|
46
|
+
let cc = this.colors
|
|
70
47
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
Tools.dom( 'defs', null, {}, svg );
|
|
74
|
-
Tools.dom( 'radialGradient', null, {id:'gradS', cx:'50%', cy:'50%', r:'50%', fx:'50%', fy:'50%' }, svg, 1 );
|
|
75
|
-
Tools.dom( 'stop', null, { offset:'60%', style:'stop-color:rgb(0,0,0); stop-opacity:0.5;' }, svg, [1,0] );
|
|
76
|
-
Tools.dom( 'stop', null, { offset:'100%', style:'stop-color:rgb(0,0,0); stop-opacity:0;' }, svg, [1,0] );
|
|
48
|
+
this.c[2] = this.dom( 'div', this.css.txt + 'justify-content:center; top:'+(this.h-20)+'px; width:100%; color:'+ cc.text );
|
|
49
|
+
this.c[2].textContent = this.value;
|
|
77
50
|
|
|
78
|
-
|
|
51
|
+
this.c[3] = this.getJoystick( this.model );
|
|
52
|
+
this.setSvg( this.c[3], 'viewBox', '0 0 '+this.diam+' '+this.diam );
|
|
53
|
+
this.setCss( this.c[3], { width:this.diam, height:this.diam, left:0, top:this.top });
|
|
79
54
|
|
|
80
|
-
var cc0 = ['rgb(40,40,40)', 'rgb(48,48,48)', 'rgb(30,30,30)'];
|
|
81
|
-
var cc1 = ['rgb(1,90,197)', 'rgb(3,95,207)', 'rgb(0,65,167)'];
|
|
82
55
|
|
|
83
|
-
|
|
84
|
-
Tools.dom( 'defs', null, {}, svg );
|
|
85
|
-
Tools.dom( 'radialGradient', null, {id:'gradIn', cx:'50%', cy:'50%', r:'50%', fx:'50%', fy:'50%' }, svg, 1 );
|
|
86
|
-
Tools.dom( 'stop', null, { offset:'30%', style:'stop-color:'+cc0[0]+'; stop-opacity:1;' }, svg, [1,0] );
|
|
87
|
-
Tools.dom( 'stop', null, { offset:'60%', style:'stop-color:'+cc0[1]+'; stop-opacity:1;' }, svg, [1,0] );
|
|
88
|
-
Tools.dom( 'stop', null, { offset:'80%', style:'stop-color:'+cc0[1]+'; stop-opacity:1;' }, svg, [1,0] );
|
|
89
|
-
Tools.dom( 'stop', null, { offset:'100%', style:'stop-color:'+cc0[2]+'; stop-opacity:1;' }, svg, [1,0] );
|
|
56
|
+
this.ratio = 128/this.w;
|
|
90
57
|
|
|
91
|
-
|
|
92
|
-
Tools.dom( 'stop', null, { offset:'30%', style:'stop-color:'+cc1[0]+'; stop-opacity:1;' }, svg, [1,1] );
|
|
93
|
-
Tools.dom( 'stop', null, { offset:'60%', style:'stop-color:'+cc1[1]+'; stop-opacity:1;' }, svg, [1,1] );
|
|
94
|
-
Tools.dom( 'stop', null, { offset:'80%', style:'stop-color:'+cc1[1]+'; stop-opacity:1;' }, svg, [1,1] );
|
|
95
|
-
Tools.dom( 'stop', null, { offset:'100%', style:'stop-color:'+cc1[2]+'; stop-opacity:1;' }, svg, [1,1] );
|
|
58
|
+
this.init();
|
|
96
59
|
|
|
97
|
-
|
|
60
|
+
this.update(false);
|
|
61
|
+
|
|
62
|
+
}
|
|
98
63
|
|
|
99
|
-
|
|
64
|
+
mode ( mode ) {
|
|
65
|
+
|
|
66
|
+
let cc = this.colors
|
|
67
|
+
|
|
68
|
+
switch(mode){
|
|
69
|
+
case 0: // base
|
|
70
|
+
if(this.model===0){
|
|
71
|
+
this.setSvg( this.c[3], 'fill', 'url(#gradIn)', 4 );
|
|
72
|
+
this.setSvg( this.c[3], 'stroke', '#000', 4 );
|
|
73
|
+
} else {
|
|
74
|
+
this.setSvg( this.c[3], 'stroke', 'rgba(100,100,100,0.25)', 2 );
|
|
75
|
+
//this.setSvg( this.c[3], 'stroke', 'rgb(0,0,0,0.1)', 3 );
|
|
76
|
+
this.setSvg( this.c[3], 'stroke', '#666', 4 );
|
|
77
|
+
this.setSvg( this.c[3], 'fill', 'none', 4 );
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
break;
|
|
81
|
+
case 1: // over
|
|
82
|
+
if(this.model===0){
|
|
83
|
+
this.setSvg( this.c[3], 'fill', 'url(#gradIn2)', 4 );
|
|
84
|
+
this.setSvg( this.c[3], 'stroke', 'rgba(0,0,0,0)', 4 );
|
|
85
|
+
} else {
|
|
86
|
+
this.setSvg( this.c[3], 'stroke', 'rgba(48,138,255,0.25)', 2 );
|
|
87
|
+
//this.setSvg( this.c[3], 'stroke', 'rgb(0,0,0,0.3)', 3 );
|
|
88
|
+
this.setSvg( this.c[3], 'stroke', cc.select, 4 );
|
|
89
|
+
this.setSvg( this.c[3], 'fill', 'rgba(48,138,255,0.25)', 4 );
|
|
90
|
+
}
|
|
91
|
+
break;
|
|
92
|
+
case 2: // edit
|
|
93
|
+
break;
|
|
100
94
|
|
|
101
|
-
|
|
95
|
+
}
|
|
96
|
+
}
|
|
102
97
|
|
|
103
|
-
|
|
98
|
+
// ----------------------
|
|
99
|
+
// EVENTS
|
|
100
|
+
// ----------------------
|
|
104
101
|
|
|
105
|
-
|
|
106
|
-
|
|
102
|
+
addInterval (){
|
|
103
|
+
if( this.interval !== null ) this.stopInterval();
|
|
104
|
+
if( this.pos.isZero() ) return;
|
|
105
|
+
this.interval = setInterval( function(){ this.update(); }.bind(this), 10 );
|
|
107
106
|
|
|
108
|
-
|
|
109
|
-
Joystick.prototype.constructor = Joystick;
|
|
107
|
+
}
|
|
110
108
|
|
|
111
|
-
|
|
109
|
+
stopInterval (){
|
|
112
110
|
|
|
113
|
-
|
|
111
|
+
if( this.interval === null ) return;
|
|
112
|
+
clearInterval( this.interval );
|
|
113
|
+
this.interval = null;
|
|
114
114
|
|
|
115
|
-
switch( e.type ) {
|
|
116
|
-
case 'mouseover': this.over( e ); break;
|
|
117
|
-
case 'mousedown': this.down( e ); break;
|
|
118
|
-
case 'mouseout': this.out( e ); break;
|
|
119
|
-
case 'mouseup': this.up( e ); break;
|
|
120
|
-
case 'mousemove': this.move( e ); break;
|
|
121
115
|
}
|
|
122
116
|
|
|
123
|
-
|
|
117
|
+
reset () {
|
|
124
118
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
switch(mode){
|
|
128
|
-
case 0: // base
|
|
129
|
-
Tools.setSvg( this.c[4], 'fill','url(#gradIn)');
|
|
130
|
-
Tools.setSvg( this.c[4], 'stroke', '#000' );
|
|
131
|
-
break;
|
|
132
|
-
case 1: // over
|
|
133
|
-
Tools.setSvg( this.c[4], 'fill', 'url(#gradIn2)' );
|
|
134
|
-
Tools.setSvg( this.c[4], 'stroke', 'rgba(0,0,0,0)' );
|
|
135
|
-
break;
|
|
136
|
-
case 2: // edit
|
|
137
|
-
break;
|
|
119
|
+
this.addInterval();
|
|
120
|
+
this.mode(0);
|
|
138
121
|
|
|
139
122
|
}
|
|
140
|
-
}
|
|
141
123
|
|
|
142
|
-
|
|
124
|
+
mouseup ( e ) {
|
|
143
125
|
|
|
144
|
-
|
|
145
|
-
|
|
126
|
+
this.addInterval();
|
|
127
|
+
this.isDown = false;
|
|
128
|
+
|
|
129
|
+
}
|
|
146
130
|
|
|
147
|
-
|
|
131
|
+
mousedown ( e ) {
|
|
148
132
|
|
|
149
|
-
|
|
133
|
+
this.isDown = true;
|
|
134
|
+
this.mousemove( e );
|
|
135
|
+
this.mode( 2 );
|
|
150
136
|
|
|
151
|
-
|
|
152
|
-
if(this.isDown) return;
|
|
153
|
-
this.mode(0);
|
|
137
|
+
}
|
|
154
138
|
|
|
155
|
-
|
|
139
|
+
mousemove ( e ) {
|
|
156
140
|
|
|
157
|
-
|
|
141
|
+
this.mode(1);
|
|
158
142
|
|
|
159
|
-
|
|
160
|
-
document.removeEventListener( 'mouseup', this, false );
|
|
161
|
-
document.removeEventListener( 'mousemove', this, false );
|
|
143
|
+
if( !this.isDown ) return;
|
|
162
144
|
|
|
163
|
-
|
|
145
|
+
//this.tmp.x = this.radius - ( e.clientX - this.zone.x );
|
|
146
|
+
//this.tmp.y = this.radius - ( e.clientY - this.zone.y - this.top );
|
|
164
147
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
};
|
|
148
|
+
this.tmp.x = (this.w*0.5) - ( e.clientX - this.zone.x );
|
|
149
|
+
this.tmp.y = (this.diam*0.5) - ( e.clientY - this.zone.y - this.top );
|
|
169
150
|
|
|
170
|
-
|
|
151
|
+
let distance = this.tmp.length();
|
|
171
152
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
153
|
+
if ( distance > this.distance ) {
|
|
154
|
+
let angle = Math.atan2(this.tmp.x, this.tmp.y);
|
|
155
|
+
this.tmp.x = Math.sin( angle ) * this.distance;
|
|
156
|
+
this.tmp.y = Math.cos( angle ) * this.distance;
|
|
157
|
+
}
|
|
175
158
|
|
|
176
|
-
|
|
177
|
-
this.move( e );
|
|
178
|
-
this.mode( 2 );
|
|
159
|
+
this.pos.copy( this.tmp ).divideScalar( this.distance ).negate();
|
|
179
160
|
|
|
180
|
-
|
|
161
|
+
this.update();
|
|
181
162
|
|
|
182
|
-
|
|
163
|
+
}
|
|
183
164
|
|
|
184
|
-
|
|
165
|
+
setValue ( v ) {
|
|
185
166
|
|
|
186
|
-
|
|
187
|
-
var y = this.radius - ( e.clientY - this.rect.top );
|
|
167
|
+
if(v===undefined) v=[0,0];
|
|
188
168
|
|
|
189
|
-
|
|
169
|
+
this.pos.set( v[0] || 0, v[1] || 0 );
|
|
170
|
+
this.updateSVG();
|
|
190
171
|
|
|
191
|
-
if ( distance > this.maxDistance ) {
|
|
192
|
-
var angle = Math.atan2(x, y);
|
|
193
|
-
x = Math.sin(angle) * this.maxDistance;
|
|
194
|
-
y = Math.cos(angle) * this.maxDistance;
|
|
195
172
|
}
|
|
196
173
|
|
|
197
|
-
|
|
198
|
-
this.y = y / this.maxDistance;
|
|
174
|
+
update ( up ) {
|
|
199
175
|
|
|
200
|
-
|
|
176
|
+
if( up === undefined ) up = true;
|
|
201
177
|
|
|
202
|
-
|
|
178
|
+
if( this.interval !== null ){
|
|
203
179
|
|
|
204
|
-
|
|
180
|
+
if( !this.isDown ){
|
|
205
181
|
|
|
206
|
-
|
|
207
|
-
this.y = y || 0;
|
|
182
|
+
this.pos.lerp( null, 0.3 );
|
|
208
183
|
|
|
209
|
-
|
|
184
|
+
this.pos.x = Math.abs( this.pos.x ) < 0.01 ? 0 : this.pos.x;
|
|
185
|
+
this.pos.y = Math.abs( this.pos.y ) < 0.01 ? 0 : this.pos.y;
|
|
210
186
|
|
|
211
|
-
|
|
187
|
+
if( this.isUI && this.main.isCanvas ) this.main.draw();
|
|
212
188
|
|
|
213
|
-
|
|
189
|
+
}
|
|
214
190
|
|
|
215
|
-
|
|
191
|
+
}
|
|
216
192
|
|
|
217
|
-
|
|
193
|
+
this.updateSVG();
|
|
218
194
|
|
|
219
|
-
if(
|
|
220
|
-
|
|
221
|
-
this.y += (0 - this.y)/3;
|
|
222
|
-
}
|
|
195
|
+
if( up ) this.send();
|
|
196
|
+
|
|
223
197
|
|
|
224
|
-
if
|
|
225
|
-
|
|
226
|
-
this.x = 0;
|
|
227
|
-
this.y = 0;
|
|
228
|
-
}
|
|
198
|
+
if( this.pos.isZero() ) this.stopInterval();
|
|
229
199
|
|
|
230
200
|
}
|
|
231
201
|
|
|
232
|
-
|
|
202
|
+
updateSVG () {
|
|
233
203
|
|
|
234
|
-
|
|
204
|
+
//let x = this.radius - ( -this.pos.x * this.distance );
|
|
205
|
+
//let y = this.radius - ( -this.pos.y * this.distance );
|
|
235
206
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
207
|
+
let x = (this.diam*0.5) - ( -this.pos.x * this.distance );
|
|
208
|
+
let y = (this.diam*0.5) - ( -this.pos.y * this.distance );
|
|
209
|
+
|
|
210
|
+
if(this.model === 0){
|
|
240
211
|
|
|
241
|
-
|
|
212
|
+
let sx = x + ((this.pos.x)*5) + 5;
|
|
213
|
+
let sy = y + ((this.pos.y)*5) + 10;
|
|
242
214
|
|
|
243
|
-
|
|
215
|
+
this.setSvg( this.c[3], 'cx', sx*this.ratio, 3 );
|
|
216
|
+
this.setSvg( this.c[3], 'cy', sy*this.ratio, 3 );
|
|
217
|
+
} else {
|
|
218
|
+
this.setSvg( this.c[3], 'cx', x*this.ratio, 3 );
|
|
219
|
+
this.setSvg( this.c[3], 'cy', y*this.ratio, 3 );
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
|
|
244
223
|
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
var x = this.radius - rx;
|
|
248
|
-
var y = this.radius - ry;
|
|
249
|
-
var sx = x + ((1-this.x)*5) + 5;
|
|
250
|
-
var sy = y + ((1-this.y)*5) + 10;
|
|
224
|
+
this.setSvg( this.c[3], 'cx', x*this.ratio, 4 );
|
|
225
|
+
this.setSvg( this.c[3], 'cy', y*this.ratio, 4 );
|
|
251
226
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
Tools.setSvg( this.c[4], 'cx', x );
|
|
255
|
-
Tools.setSvg( this.c[4], 'cy', y );
|
|
227
|
+
this.value[0] = ( this.pos.x * this.multiplicator ).toFixed( this.precision ) * 1;
|
|
228
|
+
this.value[1] = ( this.pos.y * this.multiplicator ).toFixed( this.precision ) * 1;
|
|
256
229
|
|
|
257
|
-
|
|
258
|
-
this.oldy = this.y;
|
|
230
|
+
this.c[2].textContent = this.value;
|
|
259
231
|
|
|
260
|
-
|
|
261
|
-
this.value[1] = ( this.y * this.multiplicator ).toFixed( this.precision ) * 1;
|
|
232
|
+
}
|
|
262
233
|
|
|
263
|
-
|
|
234
|
+
clear () {
|
|
235
|
+
|
|
236
|
+
this.stopInterval();
|
|
237
|
+
super.clear();
|
|
264
238
|
|
|
265
|
-
}
|
|
239
|
+
}
|
|
266
240
|
|
|
267
|
-
|
|
241
|
+
}
|