uil 1.0.1 → 4.0.3

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.
@@ -1,256 +0,0 @@
1
- import { Tools } from '../core/Tools';
2
- import { Proto } from '../core/Proto';
3
- //import { add } from '../core/Gui';
4
- import { add } from '../core/add';
5
-
6
- function Group ( o ) {
7
-
8
- Proto.call( this, o );
9
-
10
- this.autoHeight = true;
11
- this.isGroup = true;
12
-
13
- //this.bg = o.bg || null;
14
-
15
-
16
- //this.h = 25;
17
- this.baseH = this.h;
18
- var fltop = Math.floor(this.h*0.5)-6;
19
-
20
- this.isOpen = o.open || false;
21
-
22
- this.isLine = o.line !== undefined ? o.line : true;
23
-
24
- this.c[2] = Tools.dom( 'div', Tools.css.basic + 'width:100%; left:0; height:auto; overflow:hidden; top:'+this.h+'px');
25
- this.c[3] = Tools.dom( 'path', Tools.css.basic + 'position:absolute; width:10px; height:10px; left:0; top:'+fltop+'px;', { d:Tools.GPATH, fill:this.fontColor, stroke:'none'});
26
- this.c[4] = Tools.dom( 'path', Tools.css.basic + 'position:absolute; width:10px; height:10px; left:4px; top:'+fltop+'px;', { d:'M 3 8 L 8 5 3 2 3 8 Z', fill:this.fontColor, stroke:'none'});
27
- // bottom line
28
- if(this.isLine) this.c[5] = Tools.dom( 'div', Tools.css.basic + 'background:rgba(255, 255, 255, 0.2); width:100%; left:0; height:1px; bottom:0px');
29
-
30
- var s = this.s;
31
-
32
- s[0].height = this.h + 'px';
33
- s[1].height = this.h + 'px';
34
- //s[1].top = 4 + 'px';
35
- //s[1].left = 4 + 'px';
36
- s[1].pointerEvents = 'auto';
37
- s[1].cursor = 'pointer';
38
- this.c[1].name = 'group';
39
-
40
- this.s[1].marginLeft = '10px';
41
- this.s[1].lineHeight = this.h-4;
42
- this.s[1].color = this.fontColor;
43
- this.s[1].fontWeight = 'bold';
44
-
45
- this.uis = [];
46
-
47
- this.c[1].events = [ 'click' ];
48
-
49
- this.init();
50
-
51
- if( o.bg !== undefined ) this.setBG(o.bg);
52
-
53
- if( this.isOpen ) this.open();
54
-
55
- };
56
-
57
- Group.prototype = Object.create( Proto.prototype );
58
- Group.prototype.constructor = Group;
59
-
60
- Group.prototype.setBG = function( c ){
61
-
62
- this.s[0].background = c;
63
-
64
- var i = this.uis.length;
65
- while(i--){
66
- this.uis[i].setBG( c );
67
- }
68
-
69
- };
70
-
71
- Group.prototype.handleEvent = function( e ) {
72
-
73
- e.preventDefault();
74
- //e.stopPropagation();
75
-
76
- switch( e.type ) {
77
- case 'click': this.click( e ); break;
78
- }
79
-
80
- };
81
-
82
-
83
- Group.prototype.click = function( e ){
84
-
85
- if( this.isOpen ) this.close();
86
- else this.open();
87
-
88
- };
89
-
90
- Group.prototype.add = function( ){
91
-
92
- var a = arguments;
93
-
94
- if( typeof a[1] === 'object' ){
95
- a[1].isUI = this.isUI;
96
- a[1].target = this.c[2];
97
- a[1].main = this.main;
98
- } else if( typeof arguments[1] === 'string' ){
99
- if( a[2] === undefined ) [].push.call(a, { isUI:true, target:this.c[2], main:this.main });
100
- else{
101
- a[2].isUI = true;
102
- a[2].target = this.c[2];
103
- a[2].main = this.main;
104
- }
105
- }
106
-
107
- var n = add.apply( this, a );
108
- this.uis.push( n );
109
-
110
- /*n.py = this.h;
111
-
112
- if( !n.autoWidth ){
113
- var y = n.c[0].getBoundingClientRect().top;
114
- if( this.prevY !== y ){
115
- this.calc( n.h + 1 );
116
- this.prevY = y;
117
- }
118
- }else{
119
- this.prevY = -1;
120
- this.calc( n.h + 1 );
121
- }*/
122
-
123
- if( n.autoHeight ) n.parentGroup = this;
124
-
125
- return n;
126
-
127
- }
128
-
129
- /*Group.prototype.add = function( ){
130
-
131
- var a = arguments;
132
-
133
- if( typeof a[1] === 'object' ){
134
- a[1].isUI = this.isUI;
135
- a[1].target = this.c[2];
136
- } else if( typeof arguments[1] === 'string' ){
137
- if( a[2] === undefined ) [].push.call(a, { isUI:true, target:this.c[2] });
138
- else{
139
- a[2].isUI = true;
140
- a[2].target = this.c[2];
141
- }
142
- }
143
-
144
- //var n = Gui.prototype.add.apply( this, a );
145
- var n = Gui.prototype.add.call( this, a );
146
- //var n = add.apply( this, a );
147
- if( n.autoHeight ) n.parentGroup = this;
148
-
149
- return n;
150
-
151
- };*/
152
-
153
- Group.prototype.open = function(){
154
-
155
- this.isOpen = true;
156
- Tools.setSvg( this.c[4], 'd','M 5 8 L 8 3 2 3 5 8 Z');
157
- //this.s[4].background = UIL.F1;
158
- this.rSizeContent();
159
-
160
- if( this.isUI ) this.main.calc( this.h - this.baseH );
161
-
162
- };
163
-
164
- Group.prototype.close = function(){
165
-
166
- if( this.isUI ) this.main.calc(-(this.h-this.baseH ));
167
-
168
- this.isOpen = false;
169
- //this.s[4].background = UIL.F0;
170
- Tools.setSvg( this.c[4], 'd','M 3 8 L 8 5 3 2 3 8 Z');
171
- this.h = this.baseH;
172
-
173
- this.s[0].height = this.h + 'px';
174
-
175
- };
176
-
177
- Group.prototype.clear = function(){
178
-
179
- this.clearGroup();
180
- if( this.isUI ) this.main.calc( -(this.h +1 ));
181
- Proto.prototype.clear.call( this );
182
-
183
- };
184
-
185
- Group.prototype.clearGroup = function(){
186
-
187
- this.close();
188
-
189
- var i = this.uis.length;
190
- while(i--){
191
- this.uis[i].clear();
192
- this.uis.pop();
193
- }
194
- this.uis = [];
195
-
196
- //if( this.isUI ) this.main.calc( -this.h+ this.baseH );
197
-
198
- this.h = this.baseH;
199
- //this.s[0].height = this.h + 'px';
200
- //this.s[2].height = 0;
201
-
202
-
203
-
204
-
205
- //this.calc();
206
-
207
- };
208
-
209
- Group.prototype.calc = function( y ){
210
-
211
- if( !this.isOpen ) return;
212
-
213
- //this.h = this.baseH;
214
-
215
- if( y !== undefined ){
216
- this.h += y;
217
- if( this.isUI ) this.main.calc( y );
218
-
219
- }
220
- else this.h = this.c[2].offsetHeight + this.baseH;
221
-
222
- //var total = this.c[2].offsetHeight;
223
- //this.h += total;
224
-
225
- this.s[0].height = this.h + 'px';
226
-
227
- //
228
-
229
- };
230
-
231
- Group.prototype.rSizeContent = function(){
232
-
233
- var i = this.uis.length;
234
- while(i--){
235
- this.uis[i].setSize( this.width );
236
- this.uis[i].rSize();
237
- }
238
- this.calc();
239
-
240
- };
241
-
242
- Group.prototype.rSize = function(){
243
-
244
- Proto.prototype.rSize.call( this );
245
-
246
- var s = this.s;
247
-
248
- s[3].left = ( this.sa + this.sb - 17 ) + 'px';
249
- s[1].width = this.width + 'px';
250
- s[2].width = this.width + 'px';
251
-
252
- if(this.isOpen) this.rSizeContent();
253
-
254
- };
255
-
256
- export { Group };
@@ -1,267 +0,0 @@
1
- import { Tools } from '../core/Tools';
2
- import { Proto } from '../core/Proto';
3
-
4
- function Joystick ( o ) {
5
-
6
- Proto.call( this, o );
7
-
8
- this.autoWidth = false;
9
-
10
- this.value = [0,0];
11
-
12
- this.joyType = 'analogique';
13
-
14
- this.precision = o.precision || 2;
15
- this.multiplicator = o.multiplicator || 1;
16
-
17
- this.x = 0;
18
- this.y = 0;
19
-
20
- this.oldx = 0;
21
- this.oldy = 0;
22
-
23
- this.interval = null;
24
-
25
- this.radius = Math.floor((this.width-20)*0.5);
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);
44
-
45
- this.top = 0;
46
-
47
- this.c[0].style.width = this.width +'px';
48
-
49
- if(this.c[1] !== undefined) {
50
-
51
- this.c[1].style.width = this.width +'px';
52
- this.c[1].style.textAlign = 'center';
53
- this.top = 20;
54
-
55
- }
56
-
57
- this.c[2] = Tools.dom( 'circle', Tools.css.basic + 'left:10px; top:'+this.top+'px; width:'+this.w+'px; height:'+this.height+'px; pointer-events:auto; cursor:pointer;', { cx:this.radius, cy:this.radius, r:this.radius, fill:'url(#grad)' });
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 );
61
-
62
- // gradian bakground
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] );
70
-
71
- // gradian shadow
72
- svg = this.c[3];
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] );
77
-
78
- // gradian stick
79
-
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
-
83
- svg = this.c[4];
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] );
90
-
91
- Tools.dom( 'radialGradient', null, {id:'gradIn2', cx:'50%', cy:'50%', r:'50%', fx:'50%', fy:'50%' }, this.c[4], 1 );
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] );
96
-
97
- //console.log( this.c[4] )
98
-
99
- this.c[5].textContent = 'x'+ this.value[0] +' y' + this.value[1];
100
-
101
- this.c[2].events = [ 'mouseover', 'mousedown', 'mouseout' ];
102
-
103
- this.init();
104
-
105
- this.update(false);
106
- }
107
-
108
- Joystick.prototype = Object.create( Proto.prototype );
109
- Joystick.prototype.constructor = Joystick;
110
-
111
- Joystick.prototype.handleEvent = function( e ) {
112
-
113
- e.preventDefault();
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
- }
122
-
123
- };
124
-
125
- Joystick.prototype.mode = function( mode ){
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;
138
-
139
- }
140
- }
141
-
142
- Joystick.prototype.over = function( e ){
143
-
144
- this.isOver = true;
145
- this.mode(1);
146
-
147
- };
148
-
149
- Joystick.prototype.out = function( e ){
150
-
151
- this.isOver = false;
152
- if(this.isDown) return;
153
- this.mode(0);
154
-
155
- };
156
-
157
- Joystick.prototype.up = function( e ){
158
-
159
- this.isDown = false;
160
- document.removeEventListener( 'mouseup', this, false );
161
- document.removeEventListener( 'mousemove', this, false );
162
-
163
- this.interval = setInterval(this.update.bind(this), 10);
164
-
165
- if(this.isOver) this.mode(1);
166
- else this.mode(0);
167
-
168
- };
169
-
170
- Joystick.prototype.down = function( e ){
171
-
172
- this.isDown = true;
173
- document.addEventListener( 'mouseup', this, false );
174
- document.addEventListener( 'mousemove', this, false );
175
-
176
- this.rect = this.c[2].getBoundingClientRect();
177
- this.move( e );
178
- this.mode( 2 );
179
-
180
- };
181
-
182
- Joystick.prototype.move = function( e ){
183
-
184
- if( !this.isDown ) return;
185
-
186
- var x = this.radius - ( e.clientX - this.rect.left );
187
- var y = this.radius - ( e.clientY - this.rect.top );
188
-
189
- var distance = Math.sqrt( x * x + y * y );
190
-
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
- }
196
-
197
- this.x = x / this.maxDistance;
198
- this.y = y / this.maxDistance;
199
-
200
- this.update();
201
-
202
- };
203
-
204
- Joystick.prototype.setValue = function( x, y ){
205
-
206
- this.x = x || 0;
207
- this.y = y || 0;
208
-
209
- this.updateSVG();
210
-
211
- };
212
-
213
- Joystick.prototype.update = function( up ){
214
-
215
- if(up === undefined) up = true;
216
-
217
- if( this.interval !== null ){
218
-
219
- if( !this.isDown ){
220
- this.x += (0 - this.x)/3;
221
- this.y += (0 - this.y)/3;
222
- }
223
-
224
- if ( this.x.toFixed(2) === this.oldx.toFixed(2) && this.y.toFixed(2) === this.oldy.toFixed(2)){
225
-
226
- this.x = 0;
227
- this.y = 0;
228
- }
229
-
230
- }
231
-
232
- this.updateSVG();
233
-
234
- if( up ) this.send();
235
-
236
- if( this.interval !== null && this.x === 0 && this.y === 0 ){
237
- clearInterval( this.interval );
238
- this.interval = null;
239
- }
240
-
241
- };
242
-
243
- Joystick.prototype.updateSVG = function(){
244
-
245
- var rx = this.x * this.maxDistance;
246
- var ry = this.y * this.maxDistance;
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;
251
-
252
- Tools.setSvg( this.c[3], 'cx', sx );
253
- Tools.setSvg( this.c[3], 'cy', sy );
254
- Tools.setSvg( this.c[4], 'cx', x );
255
- Tools.setSvg( this.c[4], 'cy', y );
256
-
257
- this.oldx = this.x;
258
- this.oldy = this.y;
259
-
260
- this.value[0] = -( this.x * this.multiplicator ).toFixed( this.precision ) * 1;
261
- this.value[1] = ( this.y * this.multiplicator ).toFixed( this.precision ) * 1;
262
-
263
- this.c[5].textContent = 'x'+ this.value[0] +' y' + this.value[1];
264
-
265
- };
266
-
267
- export { Joystick };
package/src/proto/Knob.js DELETED
@@ -1,143 +0,0 @@
1
- import { Tools } from '../core/Tools';
2
- import { Proto } from '../core/Proto';
3
- import { Circular } from './Circular';
4
-
5
- function Knob ( o ) {
6
-
7
- Proto.call( this, o );
8
-
9
- //this.type = 'knob';
10
- this.autoWidth = false;
11
-
12
- this.buttonColor = Tools.colors.button;
13
-
14
- this.setTypeNumber( o );
15
-
16
- this.mPI = Math.PI * 0.8;
17
- this.toDeg = 180 / Math.PI;
18
- this.cirRange = this.mPI * 2;
19
-
20
- this.radius = Math.floor((this.width-20)*0.5);
21
-
22
- /*this.radius = o.radius || 15;
23
-
24
- this.width = (this.radius*2)+20;
25
-
26
- if(o.width !== undefined){
27
- this.width = o.width;
28
- this.radius = ~~ (this.width-20)*0.5;
29
- }
30
-
31
- if(o.size !== undefined){
32
- this.width = o.size;
33
- this.radius = ~~ (this.width-20)*0.5;
34
- }*/
35
-
36
- this.w = this.height = this.radius * 2;
37
- this.h = o.height || (this.height + 40);
38
- this.top = 0;
39
-
40
- this.c[0].style.width = this.width +'px';
41
-
42
- if(this.c[1] !== undefined) {
43
-
44
- this.c[1].style.width = this.width +'px';
45
- this.c[1].style.textAlign = 'center';
46
- this.top = 20;
47
-
48
- }
49
-
50
- this.percent = 0;
51
-
52
- this.c[2] = Tools.dom( 'div', Tools.css.txtnumber + 'text-align:center; top:'+(this.height+24)+'px; width:'+this.width+'px; color:'+ this.fontColor );
53
-
54
- this.c[3] = Tools.dom( 'circle', Tools.css.basic + 'left:10px; top:'+this.top+'px; width:'+this.w+'px; height:'+this.height+'px; pointer-events:auto; cursor:pointer;', { cx:this.radius, cy:this.radius, r:this.radius-4, fill:'rgba(0,0,0,0.3)' });
55
- 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*0.5, r:3, fill:this.fontColor });
56
- this.c[5] = Tools.dom( 'path', Tools.css.basic + 'left:10px; top:'+this.top+'px; width:'+this.w+'px; height:'+this.height+'px;', { d:this.makeGrad(), 'stroke-width':1, stroke:Tools.colors.stroke });
57
-
58
- Tools.dom( 'circle', null, { cx:this.radius, cy:this.radius, r:this.radius*0.7, fill:this.buttonColor, 'stroke-width':1, stroke:Tools.colors.stroke }, this.c[3] );
59
-
60
- this.c[3].events = [ 'mouseover', 'mousedown', 'mouseout' ];
61
-
62
- this.r = 0;
63
-
64
- this.init();
65
-
66
- this.update();
67
-
68
- };
69
-
70
- Knob.prototype = Object.create( Circular.prototype );
71
- Knob.prototype.constructor = Knob;
72
-
73
- Knob.prototype.move = function( e ){
74
-
75
- if( !this.isDown ) return;
76
-
77
- var x = this.radius - (e.clientX - this.rect.left);
78
- var y = this.radius - (e.clientY - this.rect.top);
79
- this.r = - Math.atan2( x, y );
80
-
81
- if( this.oldr !== null ) this.r = Math.abs(this.r - this.oldr) > Math.PI ? this.oldr : this.r;
82
-
83
- this.r = this.r > this.mPI ? this.mPI : this.r;
84
- this.r = this.r < -this.mPI ? -this.mPI : this.r;
85
-
86
- var steps = 1 / this.cirRange;
87
- var value = (this.r + this.mPI) * steps;
88
-
89
- var n = ( ( this.range * value ) + this.min ) - this.old;
90
-
91
- if(n >= this.step || n <= this.step){
92
- n = ~~ ( n / this.step );
93
- this.value = this.numValue( this.old + ( n * this.step ) );
94
- this.update( true );
95
- this.old = this.value;
96
- this.oldr = this.r;
97
- }
98
-
99
- };
100
-
101
- Knob.prototype.makeGrad = function(){
102
-
103
- var d = '', step, range, a, x, y, x2, y2, r = this.radius;
104
- var startangle = Math.PI + this.mPI;
105
- var endangle = Math.PI - this.mPI;
106
-
107
- if(this.step>5){
108
- range = this.range / this.step;
109
- step = ( startangle - endangle ) / range;
110
- } else {
111
- step = ( startangle - endangle ) / r;
112
- range = r;
113
- }
114
-
115
- for ( var i = 0; i <= range; ++i ) {
116
-
117
- a = startangle - ( step * i );
118
- x = r + Math.sin( a ) * r;
119
- y = r + Math.cos( a ) * r;
120
- x2 = r + Math.sin( a ) * ( r - 3 );
121
- y2 = r + Math.cos( a ) * ( r - 3 );
122
- d += 'M' + x + ' ' + y + ' L' + x2 + ' '+y2 + ' ';
123
-
124
- }
125
-
126
- return d;
127
-
128
- };
129
-
130
- Knob.prototype.update = function( up ){
131
-
132
- this.c[2].textContent = this.value;
133
- this.percent = (this.value - this.min) / this.range;
134
-
135
- var r = ( (this.percent * this.cirRange) - (this.mPI)) * this.toDeg;
136
-
137
- Tools.setSvg( this.c[4], 'transform', 'rotate('+ r +' '+this.radius+' '+this.radius+')' );
138
-
139
- if( up ) this.send();
140
-
141
- };
142
-
143
- export { Knob };