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.
Files changed (43) hide show
  1. package/README.md +1 -1
  2. package/package.json +2 -5
  3. package/examples/js/BufferGeometryUtils.js +0 -921
  4. package/examples/js/SimplexNoise.js +0 -324
  5. package/examples/js/controls/OrbitControls.js +0 -1215
  6. package/examples/js/controls/OrbitControls_.js +0 -1042
  7. package/examples/js/libs/sea3d.min.js +0 -373
  8. package/examples/js/libs/three.min.js +0 -6
  9. package/examples/js/math.js +0 -447
  10. package/examples/js/objects/Landscape.js +0 -778
  11. package/examples/js/objects/Lensflare.js +0 -372
  12. package/examples/js/objects/SuperSky.js +0 -297
  13. package/examples/js/objects/Water.js +0 -329
  14. package/src/Uil.js +0 -6
  15. package/src/Uil_dev.js +0 -15
  16. package/src/core/Gui.js +0 -807
  17. package/src/core/Proto.js +0 -679
  18. package/src/core/Roots.js +0 -864
  19. package/src/core/Tools.js +0 -830
  20. package/src/core/V2.js +0 -131
  21. package/src/core/add.js +0 -85
  22. package/src/polyfills.js +0 -85
  23. package/src/proto/Bool.js +0 -147
  24. package/src/proto/Button.js +0 -357
  25. package/src/proto/Circular.js +0 -230
  26. package/src/proto/Color.js +0 -411
  27. package/src/proto/Empty.js +0 -15
  28. package/src/proto/Fps.js +0 -327
  29. package/src/proto/Graph.js +0 -310
  30. package/src/proto/Grid.js +0 -297
  31. package/src/proto/Group.js +0 -430
  32. package/src/proto/Item.js +0 -120
  33. package/src/proto/Joystick.js +0 -241
  34. package/src/proto/Knob.js +0 -262
  35. package/src/proto/List.js +0 -789
  36. package/src/proto/Numeric.js +0 -417
  37. package/src/proto/Pad2D.js +0 -268
  38. package/src/proto/Rubric.js +0 -0
  39. package/src/proto/Select.js +0 -178
  40. package/src/proto/Selector.js +0 -13
  41. package/src/proto/Slide.js +0 -267
  42. package/src/proto/TextInput.js +0 -181
  43. package/src/proto/Title.js +0 -61
package/src/core/Roots.js DELETED
@@ -1,864 +0,0 @@
1
-
2
- /**
3
- * @author lth / https://github.com/lo-th
4
- */
5
-
6
- // INTENAL FUNCTION
7
-
8
- const R = {
9
-
10
- ui: [],
11
-
12
- dom:null,
13
-
14
- ID: null,
15
- lock:false,
16
- wlock:false,
17
- current:-1,
18
-
19
- needReZone: true,
20
- isEventsInit: false,
21
- isLeave:false,
22
-
23
- downTime:0,
24
- prevTime:0,
25
-
26
- prevDefault: ['contextmenu', 'wheel'],
27
- pointerEvent: ['pointerdown', 'pointermove', 'pointerup'],
28
- eventOut: ['pointercancel', 'pointerout', 'pointerleave'],
29
-
30
- xmlserializer: new XMLSerializer(),
31
- tmpTime: null,
32
- tmpImage: null,
33
-
34
- oldCursor:'auto',
35
-
36
- input: null,
37
- parent: null,
38
- firstImput: true,
39
-
40
- hiddenImput:null,
41
- hiddenSizer:null,
42
- hasFocus:false,
43
- startInput:false,
44
- inputRange : [0,0],
45
- cursorId : 0,
46
- str:'',
47
- pos:0,
48
- startX:-1,
49
- moveX:-1,
50
-
51
- debugInput:false,
52
-
53
- isLoop: false,
54
- listens: [],
55
-
56
- e:{
57
- type:null,
58
- clientX:0,
59
- clientY:0,
60
- keyCode:NaN,
61
- key:null,
62
- delta:0,
63
- },
64
-
65
- isMobile: false,
66
-
67
- now: null,
68
-
69
- getTime: function() {
70
- return ( self.performance && self.performance.now ) ? self.performance.now.bind( performance ) : Date.now;
71
- },
72
-
73
- add: function ( o ) {
74
-
75
- R.ui.push( o );
76
- R.getZone( o );
77
-
78
- if( !R.isEventsInit ) R.initEvents();
79
-
80
- },
81
-
82
- testMobile: function () {
83
-
84
- let n = navigator.userAgent;
85
- if (n.match(/Android/i) || n.match(/webOS/i) || n.match(/iPhone/i) || n.match(/iPad/i) || n.match(/iPod/i) || n.match(/BlackBerry/i) || n.match(/Windows Phone/i)) return true;
86
- else return false;
87
-
88
- },
89
-
90
- remove: function ( o ) {
91
-
92
- let i = R.ui.indexOf( o );
93
-
94
- if ( i !== -1 ) {
95
- R.removeListen( o );
96
- R.ui.splice( i, 1 );
97
- }
98
-
99
- if( R.ui.length === 0 ){
100
- R.removeEvents();
101
- }
102
-
103
- },
104
-
105
- // ----------------------
106
- // EVENTS
107
- // ----------------------
108
-
109
- initEvents: function () {
110
-
111
- if( R.isEventsInit ) return;
112
-
113
- let dom = document.body;
114
-
115
- R.isMobile = R.testMobile()
116
- R.now = R.getTime()
117
-
118
-
119
- if(!R.isMobile){
120
- dom.addEventListener( 'wheel', R, { passive: false } )
121
- } else {
122
- dom.style.touchAction = 'none'
123
- }
124
-
125
-
126
- dom.addEventListener( 'pointercancel', R )
127
- dom.addEventListener( 'pointerleave', R )
128
- //dom.addEventListener( 'pointerout', R )
129
-
130
- dom.addEventListener( 'pointermove', R )
131
- dom.addEventListener( 'pointerdown', R )
132
- dom.addEventListener( 'pointerup', R )
133
-
134
-
135
- dom.addEventListener( 'keydown', R, false )
136
- dom.addEventListener( 'keyup', R, false )
137
- window.addEventListener( 'resize', R.resize , false )
138
-
139
- //window.onblur = R.out;
140
- //window.onfocus = R.in;
141
-
142
-
143
- R.isEventsInit = true;
144
- R.dom = dom
145
-
146
- },
147
-
148
- removeEvents: function () {
149
-
150
- if( !R.isEventsInit ) return;
151
-
152
- let dom = document.body;
153
-
154
- if(!R.isMobile){
155
- dom.removeEventListener( 'wheel', R )
156
- }
157
-
158
-
159
- dom.removeEventListener( 'pointercancel', R );
160
- dom.removeEventListener( 'pointerleave', R );
161
- //dom.removeEventListener( 'pointerout', R );
162
-
163
- dom.removeEventListener( 'pointermove', R );
164
- dom.removeEventListener( 'pointerdown', R );
165
- dom.removeEventListener( 'pointerup', R );
166
-
167
-
168
- dom.removeEventListener( 'keydown', R );
169
- dom.removeEventListener( 'keyup', R );
170
- window.removeEventListener( 'resize', R.resize );
171
-
172
- R.isEventsInit = false;
173
-
174
- },
175
-
176
- resize: function () {
177
-
178
- R.needReZone = true;
179
-
180
- let i = R.ui.length, u;
181
-
182
- while( i-- ){
183
-
184
- u = R.ui[i]
185
- if( u.isGui && !u.isCanvasOnly && u.autoResize ) u.calc()
186
-
187
- }
188
-
189
- },
190
-
191
- out: function () {
192
-
193
- console.log('im am out')
194
- R.clearOldID();
195
-
196
- },
197
-
198
- in: function () {
199
-
200
- console.log('im am in')
201
- // R.clearOldID();
202
-
203
- },
204
-
205
- // ----------------------
206
- // HANDLE EVENTS
207
- // ----------------------
208
-
209
- fakeUp: function(){
210
-
211
- this.handleEvent( {type:'pointerup'} )
212
-
213
- },
214
-
215
-
216
- handleEvent: function ( event ) {
217
-
218
- //if(!event.type) return;
219
-
220
- if( R.prevDefault.indexOf( event.type ) !== -1 ) event.preventDefault();
221
-
222
- R.findZone();
223
-
224
- let e = R.e
225
- let leave = false
226
-
227
- if( event.type === 'keydown') R.keydown( event );
228
- if( event.type === 'keyup') R.keyup( event );
229
-
230
- if( event.type === 'wheel' ) e.delta = event.deltaY > 0 ? 1 : -1;
231
- else e.delta = 0;
232
-
233
- let ptype = event.pointerType // mouse, pen, touch
234
-
235
- e.clientX = ( ptype === 'touch' ? event.pageX : event.clientX ) || 0
236
- e.clientY = ( ptype === 'touch' ? event.pageY : event.clientY ) || 0
237
-
238
- e.type = event.type
239
-
240
- if( R.eventOut.indexOf( event.type ) !== -1 ){
241
- leave = true
242
- e.type = 'mouseup'
243
- }
244
-
245
- if( event.type === 'pointerleave'){ R.isLeave = true };
246
-
247
-
248
- if( event.type === 'pointerdown') e.type = 'mousedown';
249
- if( event.type === 'pointerup') e.type = 'mouseup';
250
- if( event.type === 'pointermove'){
251
- if( R.isLeave ){
252
- // if user resize outside this document
253
- R.isLeave = false
254
- R.resize()
255
- }
256
- e.type = 'mousemove';
257
- }
258
-
259
- // double click test
260
- if( e.type === 'mousedown' ) {
261
- R.downTime = R.now()
262
- let time = R.downTime - R.prevTime
263
-
264
- // double click on imput
265
- if( time < 200 ) { R.selectAll(); return false }
266
-
267
- R.prevTime = R.downTime
268
- }
269
-
270
- // for imput
271
- if( e.type === 'mousedown' ) R.clearInput()
272
-
273
- // mouse lock
274
- if( e.type === 'mousedown' ) R.lock = true;
275
- if( e.type === 'mouseup' ) R.lock = false;
276
-
277
- //if( R.current !== null && R.current.neverlock ) R.lock = false;
278
-
279
- /*if( e.type === 'mousedown' && event.button === 1){
280
- R.cursor()
281
- e.preventDefault();
282
- e.stopPropagation();
283
- }*/
284
-
285
- if( R.isMobile && e.type === 'mousedown' ) R.findID( e );
286
- if( e.type === 'mousemove' && !R.lock ) R.findID( e );
287
-
288
- if( R.ID !== null ){
289
-
290
- if( R.ID.isCanvasOnly ) {
291
-
292
- e.clientX = R.ID.mouse.x;
293
- e.clientY = R.ID.mouse.y;
294
-
295
- }
296
-
297
- R.ID.handleEvent( e );
298
-
299
- }
300
-
301
- if( R.isMobile && e.type === 'mouseup' ) R.clearOldID();
302
- if( leave ) R.clearOldID();
303
-
304
-
305
- },
306
-
307
- // ----------------------
308
- // ID
309
- // ----------------------
310
-
311
- findID: function ( e ) {
312
-
313
- let i = R.ui.length, next = -1, u, x, y;
314
-
315
- while( i-- ){
316
-
317
- u = R.ui[i]
318
-
319
- if( u.isCanvasOnly ) {
320
-
321
- x = u.mouse.x;
322
- y = u.mouse.y;
323
-
324
- } else {
325
-
326
- x = e.clientX;
327
- y = e.clientY;
328
-
329
- }
330
-
331
- if( R.onZone( u, x, y ) ){
332
-
333
- next = i;
334
-
335
- if( next !== R.current ){
336
- R.clearOldID();
337
- R.current = next;
338
- R.ID = u;
339
- }
340
- break;
341
- }
342
-
343
- }
344
-
345
- if( next === -1 ) R.clearOldID();
346
-
347
- },
348
-
349
- clearOldID: function () {
350
-
351
- if( !R.ID ) return;
352
- R.current = -1;
353
- R.ID.reset();
354
- R.ID = null;
355
- R.cursor();
356
-
357
- },
358
-
359
- // ----------------------
360
- // GUI / GROUP FUNCTION
361
- // ----------------------
362
-
363
- calcUis: function ( uis, zone, py ) {
364
-
365
- //console.log('calc_uis')
366
-
367
- let i = uis.length, u, px = 0, n = 0, tw;
368
- let height = 0
369
- let m = 1
370
-
371
- while( i-- ){
372
-
373
- u = uis[n]
374
- n++
375
-
376
- if( u.isGroup ) u.calcUis()
377
-
378
- u.zone.w = u.w
379
- u.zone.h = u.h
380
- m = u.margin
381
-
382
- if( !u.autoWidth ){
383
-
384
- if( px===0 ){
385
- height += u.h + m
386
-
387
- }
388
-
389
- u.zone.x = zone.x + px;
390
- u.zone.y = py;
391
-
392
- tw = R.getWidth(u)
393
- if( tw ) u.zone.w = u.w = tw;
394
-
395
- //console.log( u.name, u.zone.w, u.w, zone )
396
- px += u.zone.w;
397
-
398
- if( px >= zone.w ) {
399
- py += u.h + m;
400
- px = 0;
401
- }
402
-
403
- } else {
404
-
405
- px = 0
406
-
407
- u.zone.x = zone.x
408
- u.zone.y = py
409
- py += u.h + m
410
-
411
- height += u.h + m
412
-
413
- }
414
-
415
- }
416
-
417
- return height
418
-
419
- },
420
-
421
-
422
- findTarget: function ( uis, e ) {
423
-
424
- let i = uis.length;
425
-
426
- while( i-- ){
427
- if( R.onZone( uis[i], e.clientX, e.clientY ) ) return i
428
- }
429
-
430
- return -1;
431
-
432
- },
433
-
434
- // ----------------------
435
- // ZONE
436
- // ----------------------
437
-
438
- findZone: function ( force ) {
439
-
440
- if( !R.needReZone && !force ) return;
441
-
442
- var i = R.ui.length, u;
443
-
444
- while( i-- ){
445
-
446
- u = R.ui[i]
447
- R.getZone( u )
448
- if( u.isGui ) u.calcUis()
449
-
450
- }
451
-
452
- R.needReZone = false
453
-
454
- },
455
-
456
- onZone: function ( o, x, y ) {
457
-
458
- if( x === undefined || y === undefined ) return false;
459
-
460
- let z = o.zone;
461
- let mx = x - z.x;
462
- let my = y - z.y;
463
-
464
- let over = ( mx >= 0 ) && ( my >= 0 ) && ( mx <= z.w ) && ( my <= z.h );
465
-
466
- if( over ) o.local.set( mx, my );
467
- else o.local.neg();
468
-
469
- return over;
470
-
471
- },
472
-
473
- getWidth: function ( o ) {
474
-
475
-
476
-
477
- return o.getDom().offsetWidth
478
-
479
- //let r = o.getDom().getBoundingClientRect();
480
- //return (r.width)
481
- //return Math.floor(r.width)
482
-
483
- },
484
-
485
- getZone: function ( o ) {
486
-
487
- if( o.isCanvasOnly ) return;
488
- let r = o.getDom().getBoundingClientRect();
489
-
490
- //if( !r.width ) return
491
- //o.zone = { x:Math.floor(r.left), y:Math.floor(r.top), w:Math.floor(r.width), h:Math.floor(r.height) };
492
- //o.zone = { x:Math.round(r.left), y:Math.round(r.top), w:Math.round(r.width), h:Math.round(r.height) };
493
- o.zone = { x:r.left, y:r.top, w:r.width, h:r.height };
494
-
495
- //console.log(o.name, o.zone)
496
-
497
- },
498
-
499
- // ----------------------
500
- // CURSOR
501
- // ----------------------
502
-
503
- cursor: function ( name ) {
504
-
505
- name = name ? name : 'auto';
506
- if( name !== R.oldCursor ){
507
- document.body.style.cursor = name;
508
- R.oldCursor = name;
509
- }
510
-
511
- },
512
-
513
- // ----------------------
514
- // CANVAS
515
- // ----------------------
516
-
517
- toCanvas: function ( o, w, h, force ) {
518
-
519
- // prevent exesive redraw
520
-
521
- if( force && R.tmpTime !== null ) { clearTimeout(R.tmpTime); R.tmpTime = null; }
522
-
523
- if( R.tmpTime !== null ) return;
524
-
525
- if( R.lock ) R.tmpTime = setTimeout( function(){ R.tmpTime = null; }, 10 );
526
-
527
- ///
528
-
529
- let isNewSize = false;
530
- if( w !== o.canvas.width || h !== o.canvas.height ) isNewSize = true;
531
-
532
- if( R.tmpImage === null ) R.tmpImage = new Image();
533
-
534
- let img = R.tmpImage; //new Image();
535
-
536
- let htmlString = R.xmlserializer.serializeToString( o.content );
537
-
538
- let svg = '<svg xmlns="http://www.w3.org/2000/svg" width="'+w+'" height="'+h+'"><foreignObject style="pointer-events: none; left:0;" width="100%" height="100%">'+ htmlString +'</foreignObject></svg>';
539
-
540
- img.onload = function() {
541
-
542
- let ctx = o.canvas.getContext("2d");
543
-
544
- if( isNewSize ){
545
- o.canvas.width = w;
546
- o.canvas.height = h
547
- }else{
548
- ctx.clearRect( 0, 0, w, h );
549
- }
550
- ctx.drawImage( this, 0, 0 );
551
-
552
- o.onDraw();
553
-
554
- };
555
-
556
- img.src = "data:image/svg+xml;charset=utf-8," + encodeURIComponent(svg);
557
- //img.src = 'data:image/svg+xml;base64,'+ window.btoa( svg );
558
- img.crossOrigin = '';
559
-
560
-
561
- },
562
-
563
- // ----------------------
564
- // INPUT
565
- // ----------------------
566
-
567
- setHidden: function () {
568
-
569
-
570
- if( R.hiddenImput === null ){
571
-
572
- //let css = R.parent.css.txtselect + 'padding:0; width:auto; height:auto; '
573
- //let css = R.parent.css.txt + 'padding:0; width:auto; height:auto; text-shadow:none;'
574
- //css += 'left:10px; top:auto; border:none; color:#FFF; background:#000;' + hide;
575
-
576
- R.hiddenImput = document.createElement('input');
577
- R.hiddenImput.type = 'text';
578
- //R.hiddenImput.style.cssText = css + 'bottom:30px;' + (R.debugInput ? '' : 'transform:scale(0);');
579
-
580
- R.hiddenSizer = document.createElement('div');
581
- //R.hiddenSizer.style.cssText = css + 'bottom:60px;';
582
-
583
- document.body.appendChild( R.hiddenImput );
584
- document.body.appendChild( R.hiddenSizer );
585
-
586
- }
587
-
588
- let hide = R.debugInput ? '' : 'opacity:0; zIndex:0;';
589
- let css = R.parent.css.txtselect + 'padding:0; width:auto; height:auto; left:10px; top:auto; color:#FFF; background:#000;'+ hide;
590
- R.hiddenImput.style.cssText = css + 'bottom:10px;' + (R.debugInput ? '' : 'transform:scale(0);');
591
- R.hiddenSizer.style.cssText = css + 'bottom:40px;';
592
-
593
- R.hiddenImput.style.width = R.input.clientWidth + 'px';
594
- R.hiddenImput.value = R.str;
595
- R.hiddenSizer.innerHTML = R.str;
596
-
597
- R.hasFocus = true;
598
-
599
- },
600
-
601
- clearHidden: function ( p ) {
602
-
603
- if( R.hiddenImput === null ) return;
604
- R.hasFocus = false;
605
-
606
- },
607
-
608
- clickPos: function( x ){
609
-
610
- let i = R.str.length, l = 0, n = 0;
611
- while( i-- ){
612
- l += R.textWidth( R.str[n] );
613
- if( l >= x ) break;
614
- n++;
615
- }
616
- return n;
617
-
618
- },
619
-
620
- upInput: function ( x, down ) {
621
-
622
- if( R.parent === null ) return false;
623
-
624
- let up = false;
625
-
626
- if( down ){
627
-
628
- let id = R.clickPos( x );
629
-
630
- R.moveX = id;
631
-
632
- if( R.startX === -1 ){
633
-
634
- R.startX = id;
635
- R.cursorId = id;
636
- R.inputRange = [ R.startX, R.startX ];
637
-
638
- } else {
639
-
640
- let isSelection = R.moveX !== R.startX;
641
-
642
- if( isSelection ){
643
- if( R.startX > R.moveX ) R.inputRange = [ R.moveX, R.startX ];
644
- else R.inputRange = [ R.startX, R.moveX ];
645
- }
646
- }
647
-
648
- up = true;
649
-
650
- } else {
651
-
652
- if( R.startX !== -1 ){
653
-
654
- R.hasFocus = true;
655
- R.hiddenImput.focus();
656
- R.hiddenImput.selectionStart = R.inputRange[0];
657
- R.hiddenImput.selectionEnd = R.inputRange[1];
658
- R.startX = -1;
659
-
660
- up = true;
661
-
662
- }
663
-
664
- }
665
-
666
- if( up ) R.selectParent();
667
-
668
- return up;
669
-
670
- },
671
-
672
- selectAll: function (){
673
-
674
- if(!R.parent) return
675
-
676
- R.str = R.input.textContent;
677
- R.inputRange = [0, R.str.length ]
678
- R.hasFocus = true;
679
- R.hiddenImput.focus();
680
- R.hiddenImput.selectionStart = R.inputRange[0];
681
- R.hiddenImput.selectionEnd = R.inputRange[1];
682
- R.cursorId = R.inputRange[1]
683
- R.selectParent()
684
-
685
- },
686
-
687
- selectParent: function (){
688
-
689
- var c = R.textWidth( R.str.substring( 0, R.cursorId ));
690
- var e = R.textWidth( R.str.substring( 0, R.inputRange[0] ));
691
- var s = R.textWidth( R.str.substring( R.inputRange[0], R.inputRange[1] ));
692
-
693
- R.parent.select( c, e, s, R.hiddenSizer.innerHTML );
694
-
695
- },
696
-
697
- textWidth: function ( text ){
698
-
699
- if( R.hiddenSizer === null ) return 0;
700
- text = text.replace(/ /g, '&nbsp;');
701
- R.hiddenSizer.innerHTML = text;
702
- return R.hiddenSizer.clientWidth;
703
-
704
- },
705
-
706
-
707
- clearInput: function () {
708
-
709
- if( R.parent === null ) return;
710
- if( !R.firstImput ) R.parent.validate( true );
711
-
712
- R.clearHidden();
713
- R.parent.unselect();
714
-
715
- //R.input.style.background = 'none';
716
- R.input.style.background = R.parent.colors.back;
717
- R.input.style.borderColor = R.parent.colors.border;
718
- //R.input.style.color = R.parent.colors.text;
719
- R.parent.isEdit = false;
720
-
721
- R.input = null;
722
- R.parent = null;
723
- R.str = '',
724
- R.firstImput = true;
725
-
726
- },
727
-
728
- setInput: function ( Input, parent ) {
729
-
730
- R.clearInput();
731
-
732
- R.input = Input;
733
- R.parent = parent;
734
-
735
- R.input.style.background = R.parent.colors.backoff;
736
- R.input.style.borderColor = R.parent.colors.select;
737
- //R.input.style.color = R.parent.colors.textSelect;
738
- R.str = R.input.textContent;
739
-
740
- R.setHidden();
741
-
742
- },
743
-
744
- keydown: function ( e ) {
745
-
746
- if( R.parent === null ) return;
747
-
748
- let keyCode = e.which, isShift = e.shiftKey;
749
-
750
- //console.log( keyCode )
751
-
752
- R.firstImput = false;
753
-
754
-
755
- if (R.hasFocus) {
756
- // hack to fix touch event bug in iOS Safari
757
- window.focus();
758
- R.hiddenImput.focus();
759
-
760
- }
761
-
762
-
763
- R.parent.isEdit = true;
764
-
765
- // e.preventDefault();
766
-
767
- // add support for Ctrl/Cmd+A selection
768
- //if ( keyCode === 65 && (e.ctrlKey || e.metaKey )) {
769
- //R.selectText();
770
- //e.preventDefault();
771
- //return self.render();
772
- //}
773
-
774
- if( keyCode === 13 ){ //enter
775
-
776
- R.clearInput();
777
-
778
- //} else if( keyCode === 9 ){ //tab key
779
-
780
- // R.input.textContent = '';
781
-
782
- } else {
783
-
784
- if( R.input.isNum ){
785
- if ( ((e.keyCode > 47) && (e.keyCode < 58)) || ((e.keyCode > 95) && (e.keyCode < 106)) || e.keyCode === 190 || e.keyCode === 110 || e.keyCode === 8 || e.keyCode === 109 ){
786
- R.hiddenImput.readOnly = false;
787
- } else {
788
- R.hiddenImput.readOnly = true;
789
- }
790
- } else {
791
- R.hiddenImput.readOnly = false;
792
- }
793
-
794
- }
795
-
796
- },
797
-
798
- keyup: function ( e ) {
799
-
800
- if( R.parent === null ) return;
801
-
802
- R.str = R.hiddenImput.value;
803
-
804
- if( R.parent.allEqual ) R.parent.sameStr( R.str );// numeric samùe value
805
- else R.input.textContent = R.str;
806
-
807
- R.cursorId = R.hiddenImput.selectionStart;
808
- R.inputRange = [ R.hiddenImput.selectionStart, R.hiddenImput.selectionEnd ];
809
-
810
- R.selectParent();
811
-
812
- //if( R.parent.allway )
813
- R.parent.validate();
814
-
815
- },
816
-
817
- // ----------------------
818
- //
819
- // LISTENING
820
- //
821
- // ----------------------
822
-
823
- loop: function () {
824
-
825
- if( R.isLoop ) requestAnimationFrame( R.loop );
826
- R.update();
827
-
828
- },
829
-
830
- update: function () {
831
-
832
- let i = R.listens.length;
833
- while( i-- ) R.listens[i].listening();
834
-
835
- },
836
-
837
- removeListen: function ( proto ) {
838
-
839
- let id = R.listens.indexOf( proto );
840
- if( id !== -1 ) R.listens.splice(id, 1);
841
- if( R.listens.length === 0 ) R.isLoop = false;
842
-
843
- },
844
-
845
- addListen: function ( proto ) {
846
-
847
- let id = R.listens.indexOf( proto );
848
-
849
- if( id !== -1 ) return false;
850
-
851
- R.listens.push( proto );
852
-
853
- if( !R.isLoop ){
854
- R.isLoop = true;
855
- R.loop();
856
- }
857
-
858
- return true;
859
-
860
- },
861
-
862
- }
863
-
864
- export const Roots = R;