-
Notifications
You must be signed in to change notification settings - Fork 4
/
Workspace.js
8177 lines (7574 loc) · 389 KB
/
Workspace.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Frequency of Auto Save (downloads data every __ moves)
var autoFrequency = 10;
// Toggle Tooltips
var toolTips = true;
//// Import Saved Workspace ////
var wiresDataImport = [
];
var nodesDataImport = [
];
var objectsDataImport = [
]
//// ////
/// Import Parts ///
let wiringXPoints = {
x0: [-0.16570967872053635, 0.3089304380604097, 0.13941611063864198, 0.24112470709171166, 0.27502757257606475, 0.3428333035447583, 0.3767361690291155, 0.41063903451346817, -0.13180681323618473, -0.09790394775183274, -0.06400108226747572, -0.030098216783124535, 0.003804648701228281, 0.03770751418558245, 0.07161037966993568, 0.10551324515428821, 0.225196858569643, 0.19014501872648074, 0.25859061621625495, 0.29150816982851513, 0.32597435713789336, 0.3592016374895765, 0.39366782479895324, 0.42689510515063533, -0.04702952433998594, -0.01333137458782741, 0.021297699251674566, 0.05468554097471924, 0.08844965874439717, 0.12283439257230254, 0.15628820231286744, 0.1910759428138234],
x1: [-0.4355300576295487, -0.4054552594253796, -0.37538046122120705, -0.34530566301703786, 0.43663909029135745, -0.3152308648128713, -0.2851560666086997, -0.2550812684045329, -0.22500647020036454, -0.19493167199619196, -0.16485687379202554, -0.13478207558785624, -0.10470727738368726, -0.07463247917951807, -0.04455768097534887, -0.014482882771179914, 0.015591915432989163, 0.0456667136371586, 0.07574151184132756, 0.105816310045497, 0.13589110824966838, 0.16596590645383505, 0.1960407046580041, 0.2261155028621737, 0.256190301066343, 0.28626509927051186, 0.31633989747468116, 0.34641469567885025, 0.37648949388301933, 0.40656429208718836, -0.4355300576295454, -0.4054552594253796, -0.3753804612212103, -0.34530566301703786, -0.3152308648128713, -0.2851560666086997, -0.2550812684045329, -0.2250064702003613, -0.19493167199619196, -0.16485687379202554, -0.13478207558785696, -0.10470727738368726, -0.07463247917951542, -0.04455768097534887, -0.014482882771179914, 0.015591915432989163, 0.0456667136371586, 0.07574151184132684, 0.105816310045497, 0.13589110824966583, 0.16596590645383505, 0.1960407046580041, 0.2261155028621737, 0.256190301066343, 0.28626509927051186, 0.31633989747468116, 0.34641469567885025, 0.37648949388301933, 0.40656429208718836, 0.43663909029135745, -0.4355300576295454, -0.43553005762954755, -0.4355300576295454, -0.43553005762954344, -0.43553005762954344, -0.4054552594253796, -0.4054552594253762, -0.4054552594253739, -0.4054552594253743, -0.4054552594253762, -0.3753804612212103, -0.37538046122120705, -0.3753804612212092, -0.3753804612212051, -0.3753804612212051, -0.34530566301703786, -0.3453056630170401, -0.34530566301703786, -0.345305663017036, -0.345305663017036, -0.3152308648128719, -0.31523086481286877, -0.3152308648128719, -0.31523086481286877, -0.31523086481286683, -0.2851560666086997, -0.28515606660870163, -0.28515606660870163, -0.2851560666086973, -0.2851560666086997, -0.2550812684045304, -0.2550812684045336, -0.2550812684045304, -0.2550812684045336, -0.2550812684045304, -0.2250064702003613, -0.22500647020035924, -0.2250064702003613, -0.22500647020036346, -0.22500647020036346, -0.19493167199619196, -0.19493167199619196, -0.19493167199619196, -0.19493167199619196, -0.19493167199619196, -0.13478207558785696, -0.16485687379202615, -0.16485687379202615, -0.16485687379202302, -0.16485687379202615, -0.16485687379202615, -0.13478207558785382, -0.13478207558785696, -0.13478207558785588, -0.13478207558785382, -0.10470727738368474, -0.10470727738368787, -0.10470727738368474, -0.10470727738368679, -0.10470727738368474, -0.07463247917951879, -0.07463247917951879, -0.07463247917951879, -0.07463247917951879, -0.07463247917951542, -0.044557680975349595, -0.044557680975349595, -0.04455768097534634, -0.04455768097534634, -0.04455768097534634, -0.014482882771180396, -0.014482882771180396, -0.014482882771177263, -0.014482882771177263, -0.014482882771180396, 0.01559191543298844, 0.015591915432991935, 0.01559191543298844, 0.015591915432991935, 0.01559191543298844, 0.045666713637161016, 0.04566671363715776, 0.04566671363715776, 0.045666713637162945, 0.04566671363715776, 0.07574151184133021, 0.07574151184132684, 0.07574151184133021, 0.07574151184132684, 0.07574151184132805, 0.10581631004549616, 0.10581631004549616, 0.1058163100454994, 0.1058163100454994, 0.10581631004549616, 0.13589110824966838, 0.13589110824966535, 0.13589110824966535, 0.13589110824966535, 0.13589110824966838, 0.16596590645383433, 0.16596590645383433, 0.16596590645383769, 0.16596590645383433, 0.16596590645383433, 0.19604070465800666, 0.19604070465800666, 0.19604070465800363, 0.22611550286217222, 0.19604070465800666, 0.22611550286217222, 0.22611550286217222, 0.2261155028621756, 0.19604070465800666, 0.22611550286217222, 0.25619030106634155, 0.25619030106634155, 0.25619030106634155, 0.25619030106634155, 0.25619030106634494, 0.2862650992705104, 0.2862650992705104, 0.2862650992705104, 0.28626509927051375, 0.28626509927051375, 0.3163398974746797, 0.3163398974746797, 0.3163398974746831, 0.3163398974746831, 0.3163398974746831, 0.34641469567885214, 0.3464146956788485, 0.3464146956788485, 0.3464146956788485, 0.34641469567885214, 0.3764894938830179, 0.3764894938830179, 0.3764894938830179, 0.3764894938830212, 0.3764894938830212, 0.4065642920871869, 0.4065642920871869, 0.4065642920871869, 0.4366390902913596, 0.4065642920871903, 0.4366390902913563, 0.4366390902913563, 0.4366390902913563, 0.4065642920871869, 0.4366390902913563, -0.43553005762954344, -0.43553005762954344, -0.4355300576295487, -0.43553005762954344, -0.43553005762954344, -0.40545525942537836, -0.4054552594253743, -0.4054552594253743, -0.4054552594253743, -0.4054552594253796, -0.3753804612212092, -0.3753804612212051, -0.3753804612212051, -0.3753804612212051, -0.3753804612212092, -0.345305663017036, -0.345305663017036, -0.3453056630170401, -0.345305663017036, -0.345305663017036, -0.31523086481286683, -0.3152308648128708, -0.31523086481286683, -0.31523086481286683, -0.31523086481286683, -0.28515606660869774, -0.28515606660869774, -0.28515606660870163, -0.28515606660869774, -0.28515606660869774, -0.25508126840453255, -0.25508126840452866, -0.25508126840452866, -0.25508126840453255, -0.25508126840452866, -0.22500647020035924, -0.225006470200359, -0.22500647020035924, -0.22500647020035924, -0.22500647020036346, -0.1949316719961903, -0.1949316719961903, -0.1949316719961903, -0.1949316719961903, -0.1949316719961903, -0.1648568737920206, -0.16485687379202302, -0.16485687379202096, -0.16485687379202096, -0.16485687379202507, -0.13478207558785202, -0.13478207558785382, -0.13478207558785202, -0.13478207558785202, -0.13478207558785202, -0.10470727738368281, -0.10470727738368281, -0.10470727738368281, -0.10470727738368679, -0.10470727738368281, -0.07463247917951542, -0.07463247917951374, -0.07463247917951374, -0.07463247917951374, -0.07463247917951325, -0.04455768097534634, -0.04455768097534634, -0.04455768097534405, -0.04455768097534441, -0.04455768097534441, -0.014482882771177263, -0.014482882771174852, -0.014482882771175334, -0.014482882771175334, -0.014482882771174852, 0.015591915432993745, 0.015591915432991935, 0.015591915432991935, 0.015591915432993745, 0.015591915432989526, 0.045666713637162945, 0.045666713637161016, 0.045666713637162945, 0.045666713637162945, 0.045666713637163306, 0.07574151184133202, 0.07574151184133021, 0.07574151184133021, 0.07574151184133021, 0.07574151184133202, 0.1058163100454994, 0.1058163100454994, 0.10581631004550159, 0.10581631004550122, 0.10581631004550122, 0.1358911082496703, 0.13589110824966838, 0.13589110824966644, 0.1358911082496708, 0.13589110824966838, 0.16596590645383769, 0.16596590645383938, 0.16596590645383769, 0.16596590645383769, 0.16596590645383938, 0.19604070465800905, 0.19604070465800869, 0.19604070465800869, 0.19604070465800905, 0.19604070465800666, 0.2261155028621756, 0.2261155028621756, 0.22611550286217755, 0.22611550286217755, 0.22611550286217755, 0.25619030106634494, 0.2561903010663473, 0.2561903010663469, 0.25619030106634494, 0.2561903010663469, 0.28626509927051375, 0.2862650992705164, 0.28626509927051375, 0.28626509927051375, 0.28626509927051375, 0.3163398974746831, 0.3163398974746831, 0.316339897474685, 0.3163398974746855, 0.3163398974746831, 0.34641469567885214, 0.34641469567885214, 0.3464146956788546, 0.3464146956788546, 0.3464146956788541, 0.37648949388302316, 0.3764894938830212, 0.3764894938830212, 0.3764894938830239, 0.3764894938830239, 0.4065642920871903, 0.4065642920871903, 0.4065642920871903, 0.40656429208719225, 0.40656429208719297, 0.4366390902913596, 0.4366390902913596, 0.43663909029136183, 0.43663909029136183, 0.43663909029136183, -0.43553005762954344, -0.43553005762954344, -0.4054552594253743, -0.4054552594253743, -0.345305663017036, -0.3753804612212051, -0.3753804612212051, -0.345305663017036, -0.31523086481286683, -0.31523086481286683, -0.28515606660869774, -0.28515606660869774, -0.25508126840452866, -0.25508126840452866, -0.22500647020035924, -0.22500647020035924, -0.1949316719961903, -0.1949316719961903, -0.16485687379202096, -0.13478207558785202, -0.13478207558785202, -0.16485687379202096, -0.10470727738368281, -0.10470727738368281, -0.07463247917951374, -0.07463247917951374, -0.04455768097534441, -0.04455768097534441, -0.014482882771175334, -0.014482882771175334, 0.015591915432993745, 0.015591915432993745, 0.045666713637162945, 0.045666713637162945, 0.07574151184133202, 0.07574151184133202, 0.10581631004550122, 0.10581631004550122, 0.1358911082496703, 0.1358911082496703, 0.16596590645383985, 0.16596590645383938, 0.19604070465800905, 0.19604070465800869, 0.22611550286217802, 0.22611550286217755, 0.2561903010663473, 0.2561903010663469, 0.2862650992705164, 0.2862650992705164, 0.3163398974746855, 0.3464146956788546, 0.3464146956788541, 0.3163398974746855, 0.3764894938830239, 0.3764894938830239, 0.40656429208719297, 0.40656429208719297, 0.43663909029136205, 0.43663909029136205],
x2: [-0.00001985584269739049, -0.00001985584269739049],
x3: [-0.25713074101659733, 0.2642279382128468],
x4: [-0.41691687598528954, 0.41636162203332855, -0.41691687598528954, 0.41636162203332855],
x5: [-0.02462889408867556, -0.02462889408867556],
x6: [0.49552323581957114, 0.49552323581957114],
x7: [-0.006054565323046129, -0.006054565323046129],
x8: [-0.33484580542016396, 0.33651173164350273],
x9: [-0.11004099709771833, 0.03633374543587863, -0.03685362583092005],
x10: [-0.003282747751095225],
x11: [-0.28908020553172925, 0.2894548827056025],
x12: [-0.4265972385709647, -0.3048621568840238, -0.18312707519708282, -0.061391993510142094, 0.060343088176798856, 0.1820781698637398, 0.3038132515506805, 0.4255483332376215, -0.4265972385709647, -0.3048621568840238, -0.18312707519708282, -0.061391993510142094, 0.060343088176798856, 0.1820781698637398, 0.3038132515506805, 0.4255483332376215],
x13: [0.00043320237511288405, 0.00043320237511288405],
x14: [-0.0026060143739623674, -0.0026060143739623674],
x15: [-0.02598548814835974, -0.2552613032988832, -0.22903990128971882, -0.20704323085755588, -0.18250771201751456, -0.15797219317747266, -0.1351292399426843, -0.11144000390526866, -0.08775076786785282, 0.11614992807612638, 0.42410999656252885, 0.4477992325999449, -0.1918101404102825, -0.2789833375797429, -0.0022962521109586888, 0.021392983926457148, 0.04508221996387198, 0.06877145600128733, 0.3293530524128675, 0.09246069203871116, 0.13983916411354302, 0.21090687222579002, 0.187217636188375, 0.23459610826320507, 0.2582853443006207, 0.28197458033803546, 0.30566381637545126, 0.35304228845028257, -0.16812090437285207, -0.14443166833543622, -0.12074243229802138, -0.09705319626060575, -0.07336396022319061, -0.04967472418577577, -0.02598548814835974, 0.021392983926464642, 0.06877145600129492, 0.04508221996388008, 0.09246069203871154, 0.11614992807612678, 0.13983916411354322, 0.16352840015095765, 0.1872176361883752, 0.23459610826320568, 0.2582853443006215, 0.28197458033803585, 0.3056638163754517, 0.3293530524128675, 0.35304228845028257, 0.37673152448769937, 0.40042076052511344, 0.42410999656252985, 0.4477992325999453, 0.4477992325999453, 0.42410999656252985, 0.42410999656252985, 0.4477992325999453, 0.42410999656252285, 0.4477992325999381, 0.4477992325999381, 0.42410999656252285, 0.42410999656252285, 0.4477992325999381, 0.4477992325999381, 0.42410999656252285, 0.42410999656252285, 0.4477992325999381, 0.4477992325999381, 0.42410999656252285, 0.42410999656252285, 0.4477992325999381, 0.4477992325999381, 0.42410999656252285, 0.42410999656252285, 0.4477992325999381, 0.4477992325999381, 0.42410999656252285, 0.42410999656252285, 0.4477992325999381, 0.4477992325999381, 0.42410999656252285, 0.42410999656252285, 0.4477992325999381, 0.42410999656252246, 0.4477992325999369, -0.06282283489971752],
x16: [-0.3812102027544783, -0.33082420792379524, 0.2738077300444212, -0.381210202754469, -0.28043821309310124, -0.23005221826241715, -0.33082420792378514, -0.28043821309310124, -0.17966622343173333, -0.23005221826241715, -0.17966622343173333, -0.12928022860104948, -0.12928022860104948, -0.07889423377036565, -0.02850823893968182, 0.021877755891002017, 0.07226375072168585, 0.12264974555236968, 0.17303574038305353, 0.22342173521373734, -0.07889423377036565, -0.02850823893968182, 0.021877755891002017, 0.07226375072168585, 0.12264974555236968, 0.17303574038305353, 0.22342173521373734, 0.2738077300444212, 0.32419372487510545, 0.37457971970578885, 0.4249657145364728, 0.37457971970578885, 0.32419372487510545, 0.4249657145364728],
x17: [-0.3353424203600527, 0.3906588098742318, 0.4632589328976631, -0.2627422973366244, -0.19014217431319694, -0.1175420512897685, -0.3353424203600527, -0.2627422973366244, -0.19014217431319694, -0.04494192826634062, 0.027658194757087057, 0.10025831778051532, 0.1728584408039432, 0.24545856382737125, 0.3180586868507995, -0.1175420512897685, -0.04494192826634062, 0.027658194757087057, 0.10025831778051532, 0.1728584408039432, 0.24545856382737125, 0.3180586868507995, 0.3906588098742274, 0.46325893289765546],
x18: [-0.36309589092281475, -0.36309589092281475, -0.30879043918680493, -0.25448498745079423, -0.20017953571478384, -0.1458740839787734, -0.09156863224276242, -0.037263180506751266, 0.017042271229258995, 0.0713477229652697, 0.12565317470128085, 0.17995862643729083, 0.23426407817330153, 0.28856952990931206, 0.34287498164532276, 0.39718043338133424, 0.39718043338133424, -0.30879043918680493, -0.25448498745079423, -0.20017953571478384, -0.1458740839787734, -0.09156863224276242, -0.037263180506751266, 0.017042271229258995, 0.0713477229652697, 0.12565317470128085, 0.17995862643729083, 0.23426407817330153, 0.28856952990931206, 0.34287498164532276],
x19: [-0.2260912022563598, 0.22785329178666386, 0.34774731695634875, 0.4291533285853066, 0.4528765644996553, 0.4301329531555218, 0.3497065660967791, 0.22785329178666386, -0.3482877410958964, -0.42735288035982555, -0.4564786601501534, -0.42833250493004077, -0.34247006972580774, -0.22643942787727464],
x20: [-0.45226135531566963, -0.14730945826955144, 0.15764243877656678, 0.46259433582268455],
x21: [0.0324225193646796, 0.14411907235980556, 0.2558156253549315],
x22: [-0.41364316979422733, -0.32899707584044696, -0.41364316979422733, -0.41364316979422733, -0.32899707584044696, -0.32899707584044696, -0.4136431697942063, -0.3289970758404271],
x23: [-0.07449568983677538, -0.02490571406950914, 0.024684261697757087, 0.07427423746502332],
x24: [-0.05224943682833422, 0.05455614918879511],
x25: [-0.05826347770038855, -0.0004161094192336923, 0.057431258861921165],
x26: [-0.411514123757181, 0.006053431328736376, 0.423620986414653],
x27: [-0.3297147524876264, 0.00013717992731768295, 0.32998911234226175],
x28: [0.4985704754596618, 0.4985704754596618, 0.4985704754596618, 0.4985704754596618],
x29: [0.4997496161776881, 0.4997496161776881, 0.4997496161776881, 0.4997496161776881],
x30: [-0.4974781359547788, 0.5004700171332438],
x31: [-0.13863482750762376, -0.0447464070521597, 0.04914201340329864, 0.1430304338587629],
x32: [-0.28942886248366373, -0.19882895759693578, -0.10822905271020754, -0.01762914782347794, 0.07297075706325151, 0.16357066194997902, 0.2541705668367074],
x33: [-0.4992291344495405, -0.4992291344495405, -0.4992291344495405, -0.4992291344495405],
x34: [-0.43277281867408224, -0.43277281867408224, -0.43277281867408224, 0.43703968730123627, 0.43703968730123566, 0.4370396873012304, 0.4370396873012304, 0.4370396873012304, 0.43703968730123566, 0.43703968730123566, 0.43703968730123566, 0.43703968730123566, 0.4370396873012236, 0.437039687301231, 0.437039687301231, -0.4327728186740424, -0.4327728186740424, -0.4327728186740424, -0.4327728186740424, -0.4327728186740424, -0.4327728186740424, -0.4327728186740424, -0.4327728186740424, -0.4327728186740424, -1.3067682130501903],
x35: [-0.16898223467576715, 0.16954687474916863],
x36: [-0.10414849928958492, 0.1036213062129172],
x37: [-0.14558515446669837, -0.02931021671424917, 0.027503247012651326, -0.08989360534402087, 0.08696472103823623, 0.14521365179333626],
x38: [-0.49488911301793953, -0.49488911301793953, -0.4948891130179401, -0.49488911301793953, -0.49488911301793953],
x39: [-0.07683685862694926, 0.07723414765915756],
x40: [-0.23591300013348127, -0.14151537115854845, -0.04711774218361539, 0.04727988679131743, 0.14167751576625048, 0.23607514474118332],
x41: [-0.2919001767385683, -0.2132629530841657],
x42: [-0.19889389437584654, 0.20336742429750831],
x43: [-0.20582304505523624, -0.000185741749582157, 0.20545156155607192],
x44: [-0.2237743416364035, 0.21754974242532113],
x45: [-0.3998886494258509, -0.3998886494258509, -0.3998886494258509, 0.39938852653483536, 0.39938852653483536, 0.39938852653483536],
x46: [-0.4811067569480075, -0.48110675694804844, -0.48110675694804844, 0.4798798833807109, 0.4798798833807109, 0.4798798833807109],
x47: [-0.0007653160890589677, -0.0007653160890589677],
x48: [-0.048900714104488686, 0.04714957520762518],
x49: [-0.015694649059141565, 0.016237143426105907],
};
let wiringYPoints = {
y0: [-0.4445729874223717, 0.43182761693507016, -0.4445729874223537, 0.4318276169350643, 0.4318276169350643, 0.43182761693507016, 0.43182761693507016, 0.43182761693507016, -0.444572987422368, -0.444572987422368, -0.4445729874223717, -0.444572987422368, -0.444572987422368, -0.444572987422368, -0.444572987422368, -0.444572987422368, -0.44502297685843273, -0.44502297685843273, -0.44502297685843273, -0.44502297685843273, -0.44502297685843273, -0.44502297685843273, -0.44502297685843273, -0.44502297685843273, 0.43182761693507016, 0.43182761693507016, 0.43182761693507016, 0.43182761693507016, 0.43182761693507016, 0.43182761693507016, 0.43182761693507016, 0.43182761693507016],
y1: [-0.43585246460459726, -0.43585246460459726, -0.4358524646045939, -0.4358524646045939, -0.4358524646045926, -0.4358524646045926, -0.4358524646045939, -0.4358524646045926, -0.43585246460459726, -0.4358524646045939, -0.4358524646045926, -0.4358524646045926, -0.4358524646045926, -0.4358524646045926, -0.4358524646045926, -0.4358524646045926, -0.4358524646045926, -0.4358524646045926, -0.4358524646045926, -0.4358524646045926, -0.4358524646045939, -0.4358524646045926, -0.4358524646045926, -0.4358524646045926, -0.4358524646045926, -0.4358524646045926, -0.4358524646045926, -0.4358524646045926, -0.4358524646045926, -0.4358524646045926, -0.3900958073368223, -0.39009580733682575, -0.39009580733682575, -0.3900958073368223, -0.39009580733682103, -0.3900958073368223, -0.39009580733682103, -0.3900958073368223, -0.3900958073368223, -0.39009580733682103, -0.39009580733682575, -0.39009580733682103, -0.3900958073368223, -0.39009580733682103, -0.39009580733682103, -0.39009580733682103, -0.39009580733682103, -0.39009580733682575, -0.39009580733682103, -0.39009580733682103, -0.39009580733682103, -0.39009580733682103, -0.39009580733682103, -0.39009580733682103, -0.39009580733682103, -0.39009580733682103, -0.39009580733682103, -0.39009580733682103, -0.39009580733682103, -0.39009580733682103, -0.2528258355335071, -0.20706917826573656, -0.16131252099796384, -0.11555586373019824, -0.06979920646242654, -0.2528258355335106, -0.20706917826573554, -0.16131252099797017, -0.11555586373019824, -0.06979920646242035, -0.2528258355335106, -0.20706917826573554, -0.16131252099796495, -0.11555586373019824, -0.06979920646242654, -0.2528258355335071, -0.20706917826573656, -0.16131252099796384, -0.11555586373019824, -0.06979920646242654, -0.2528258355335106, -0.20706917826573554, -0.16131252099796728, -0.1155558637301922, -0.06979920646242654, -0.2528258355335071, -0.20706917826573656, -0.16131252099796495, -0.11555586373019852, -0.06979920646242035, -0.2528258355335071, -0.20706917826573892, -0.16131252099796384, -0.11555586373019568, -0.06979920646242035, -0.2528258355335071, -0.20706917826574156, -0.16131252099796384, -0.06979920646242145, -0.11555586373019329, -0.2528258355335071, -0.20706917826573554, -0.16131252099796384, -0.1155558637301922, -0.06979920646242035, -0.2528258355335106, -0.20706917826573892, -0.16131252099796728, -0.1155558637301922, -0.06979920646242374, -0.2528258355335106, -0.20706917826573554, -0.16131252099796728, -0.11555586373019329, -0.06979920646242035, -0.2528258355335071, -0.20706917826573892, -0.16131252099796384, -0.11555586373019329, -0.06979920646242035, -0.2528258355335106, -0.20706917826573892, -0.16131252099796728, -0.11555586373019568, -0.06979920646242035, -0.2528258355335106, -0.20706917826573892, -0.16131252099796384, -0.1155558637301922, -0.06979920646242035, -0.2528258355335106, -0.20706917826573892, -0.16131252099796384, -0.1155558637301922, -0.06979920646242374, -0.2528258355335106, -0.20706917826573554, -0.16131252099796728, -0.1155558637301922, -0.06979920646242374, -0.2528258355335071, -0.20706917826573892, -0.16131252099796728, -0.11555586373019824, -0.06979920646242374, -0.2528258355335071, -0.20706917826573892, -0.16131252099796384, -0.11555586373019568, -0.06979920646242145, -0.2528258355335106, -0.20706917826573892, -0.16131252099796384, -0.1155558637301922, -0.06979920646242374, -0.2528258355335071, -0.20706917826573892, -0.16131252099796728, -0.11555586373019568, -0.06979920646242035, -0.2528258355335106, -0.20706917826573892, -0.16131252099796384, -0.11555586373019568, -0.06979920646242374, -0.2528258355335071, -0.20706917826573554, -0.16131252099796728, -0.11555586373019568, -0.06979920646242035, -0.2528258355335106, -0.20706917826573892, -0.16131252099796384, -0.1155558637301922, -0.06979920646242374, -0.2528258355335106, -0.20706917826573892, -0.16131252099796728, -0.11555586373019568, -0.06979920646242035, -0.2528258355335106, -0.20706917826573892, -0.16131252099796728, -0.1155558637301922, -0.06979920646242035, -0.2528258355335106, -0.20706917826573892, -0.16131252099796384, -0.1155558637301922, -0.06979920646242035, -0.2528258355335071, -0.20706917826573892, -0.16131252099796728, -0.11555586373019568, -0.06979920646242035, -0.2528258355335106, -0.20706917826573892, -0.16131252099796728, -0.1155558637301922, -0.06979920646242035, -0.2528258355335106, -0.20706917826573892, -0.16131252099796728, -0.1155558637301922, -0.06979920646242035, -0.2528258355335106, -0.20706917826573892, -0.16131252099796728, -0.11555586373019568, -0.06979920646242374, 0.06747076534088856, 0.11322742260866002, 0.15898407987643506, 0.20474073714420343, 0.25049739441197505, 0.06747076534089341, 0.11322742260866002, 0.15898407987643196, 0.20474073714420343, 0.25049739441197827, 0.06747076534089341, 0.11322742260866002, 0.15898407987643196, 0.20474073714420343, 0.2504973944119801, 0.06747076534088856, 0.11322742260866002, 0.1589840798764368, 0.20474073714420343, 0.25049739441197505, 0.06747076534088856, 0.11322742260866507, 0.15898407987643196, 0.20474073714420343, 0.25049739441197505, 0.06747076534088856, 0.11322742260866002, 0.1589840798764368, 0.20474073714420343, 0.25049739441197505, 0.06747076534089341, 0.11322742260866002, 0.15898407987643196, 0.20474073714420857, 0.25049739441197505, 0.06747076534088856, 0.11322742260865974, 0.15898407987643196, 0.20474073714420343, 0.2504973944119801, 0.06747076534088856, 0.11322742260866002, 0.15898407987643196, 0.20474073714420343, 0.25049739441197505, 0.06747076534088818, 0.11322742260866626, 0.15898407987643196, 0.20474073714420343, 0.2504973944119801, 0.06747076534088856, 0.11322742260866626, 0.15898407987643196, 0.25049739441197505, 0.20474073714420343, 0.06747076534088856, 0.11322742260866002, 0.15898407987643196, 0.20474073714420857, 0.25049739441197505, 0.0674707653408946, 0.11322742260866002, 0.15898407987643196, 0.20474073714420343, 0.25049739441197477, 0.0674707653408946, 0.11322742260866626, 0.15898407987643148, 0.20474073714420343, 0.25049739441197505, 0.0674707653408946, 0.11322742260865974, 0.15898407987643196, 0.20474073714420343, 0.25049739441197477, 0.06747076534088856, 0.11322742260866626, 0.15898407987643792, 0.20474073714420343, 0.2504973944119801, 0.06747076534088856, 0.11322742260866626, 0.15898407987643196, 0.20474073714420343, 0.25049739441197477, 0.06747076534088856, 0.11322742260866626, 0.15898407987643792, 0.20474073714420957, 0.25049739441197505, 0.0674707653408946, 0.11322742260866626, 0.15898407987643148, 0.20474073714420343, 0.25049739441197505, 0.06747076534088856, 0.11322742260866626, 0.1589840798764368, 0.20474073714420304, 0.2504973944119812, 0.0674707653408946, 0.11322742260866002, 0.15898407987643792, 0.20474073714420957, 0.25049739441197505, 0.06747076534088818, 0.11322742260866002, 0.15898407987643196, 0.20474073714420304, 0.2504973944119812, 0.0674707653408946, 0.11322742260866626, 0.15898407987643196, 0.20474073714420343, 0.25049739441197505, 0.0674707653408946, 0.11322742260865974, 0.15898407987643196, 0.20474073714420957, 0.25049739441197505, 0.0674707653408946, 0.11322742260865974, 0.15898407987643792, 0.20474073714420957, 0.2504973944119812, 0.0674707653408946, 0.11322742260866626, 0.20474073714420343, 0.15898407987643148, 0.2504973944119812, 0.0674707653408946, 0.11322742260866626, 0.15898407987643148, 0.20474073714420304, 0.25049739441197505, 0.06747076534088856, 0.11322742260866626, 0.15898407987643792, 0.20474073714420304, 0.25049739441197477, 0.0674707653408946, 0.11322742260866626, 0.15898407987643792, 0.20474073714420343, 0.25049739441197477, 0.0674707653408946, 0.11322742260866626, 0.15898407987643196, 0.20474073714420343, 0.25049739441197505, 0.3877673662152903, 0.4335240234830617, 0.3877673662152903, 0.4335240234830617, 0.3877673662152903, 0.4335240234830617, 0.3877673662152903, 0.4335240234830617, 0.3877673662152903, 0.4335240234830617, 0.3877673662152903, 0.4335240234830617, 0.3877673662152903, 0.4335240234830617, 0.3877673662152903, 0.4335240234830617, 0.3877673662152903, 0.4335240234830617, 0.3877673662152903, 0.4335240234830617, 0.3877673662152903, 0.4335240234830617, 0.3877673662152903, 0.4335240234830617, 0.3877673662152903, 0.4335240234830617, 0.3877673662152903, 0.4335240234830617, 0.3877673662152903, 0.4335240234830617, 0.3877673662152903, 0.4335240234830617, 0.3877673662152903, 0.4335240234830617, 0.3877673662152903, 0.4335240234830617, 0.3877673662152903, 0.4335240234830617, 0.3877673662152903, 0.4335240234830617, 0.38776736621528995, 0.4335240234830617, 0.38776736621528995, 0.4335240234830617, 0.38776736621528995, 0.4335240234830617, 0.38776736621528995, 0.4335240234830617, 0.38776736621528995, 0.4335240234830615, 0.38776736621528995, 0.4335240234830615, 0.3877673662152903, 0.4335240234830615, 0.38776736621528995, 0.4335240234830615, 0.38776736621528995, 0.4335240234830615, 0.38776736621528995, 0.4335240234830615],
y2: [-0.44933822152103914, 0.4140512583532616],
y3: [0.2926591734669553, 0.5127606278424598],
y4: [-0.4996025474369343, -0.4996025474369343, 0.4871746212693234, 0.4871746212693234],
y5: [-0.5008893804902528, 0.4981170475513312],
y6: [-0.07616666559703317, 0.07372120753169188],
y7: [-0.5012625505784923, 0.5035819806018437],
y8: [0.25018101283374106, 0.49644316616713885],
y9: [-0.36854733799743455, -0.36854733799743455, -0.36854733799743455],
y10: [0.0017178177834557525],
y11: [0.4956809951072103, 0.4956809951072103],
y12: [-0.4736769194750314, -0.4736769194750314, -0.4736769194750314, -0.4736769194750314, -0.4736769194750314, -0.4736769194750314, -0.4736769194750314, -0.4736769194750314, 0.46119210552622697, 0.46119210552622697, 0.46119210552622697, 0.46119210552622697, 0.46119210552622697, 0.46119210552622697, 0.46119210552622697, 0.46119210552622697],
y13: [-0.6336156284237829, 0.618109193444901],
y14: [-0.7638951348074525, 0.7502819379080748],
y15: [-0.4474208596207195, -0.4474208596207195, -0.4474208596207195, -0.4474208596207195, -0.4474208596207195, -0.4474208596207195, -0.4474208596207195, -0.4474208596207195, -0.4474208596207151, -0.4474208596207151, -0.44742085962071393, -0.44742085962071393, 0.40209710821110806, -0.44742085962071065, -0.44742085962071065, -0.44742085962071065, -0.44742085962071065, -0.44742085962071065, -0.4474208596207151, -0.4474208596207151, -0.4474208596207151, -0.4474208596207151, -0.4474208596207151, -0.4474208596207151, -0.4474208596207151, -0.4474208596207151, -0.4474208596207151, -0.4474208596207151, 0.4020971082111001, 0.4020971082111001, 0.4020971082111001, 0.4020971082111001, 0.4020971082111001, 0.4020971082111001, 0.4020971082111001, 0.40209710821111144, 0.40209710821111144, 0.40209710821111144, 0.40209710821111144, 0.40209710821111144, 0.40209710821111144, 0.40209710821111144, 0.40209710821111144, 0.40209710821111144, 0.40209710821111144, 0.40209710821111144, 0.40209710821111144, 0.40209710821111144, 0.40209710821111144, 0.40209710821111144, 0.40209710821111144, 0.3126741642288136, 0.3126741642288136, 0.2679626922376667, 0.2679626922376667, 0.22325122024651764, 0.22325122024651764, 0.17853974825536137, 0.17853974825536137, 0.13382827626421312, 0.13382827626421312, 0.08911680427306486, 0.08911680427306486, 0.044405332281915566, 0.044405332281915566, -0.00030613970923240856, -0.00030613970923240856, -0.045017611700381134, -0.045017611700381134, -0.08972908369152977, -0.08972908369152977, -0.13444055568267801, -0.13444055568267801, -0.17915202767382563, -0.17915202767382563, -0.22386349966497368, -0.22386349966497368, -0.2685749716561222, -0.2685749716561222, -0.31328644364727004, -0.31328644364727004, -0.357997915638419, -0.357997915638419, -0.40270938762956454, -0.40270938762956454, -0.4474208596207151],
y16: [-0.4288992177715712, -0.4288992177715712, -0.42889921777155554, 0.4315385401062758, -0.42889921777155554, -0.42889921777155554, 0.4315385401062758, 0.4315385401062758, -0.42889921777155554, 0.4315385401062758, 0.4315385401062758, 0.4315385401062758, -0.42889921777155554, -0.42889921777155554, -0.42889921777155554, -0.42889921777155554, -0.42889921777155554, -0.42889921777155554, -0.42889921777155554, -0.42889921777155554, 0.4315385401062758, 0.4315385401062758, 0.4315385401062758, 0.4315385401062758, 0.4315385401062758, 0.4315385401062758, 0.4315385401062758, 0.4315385401062758, 0.4315385401062758, 0.4315385401062758, 0.4315385401062758, -0.42889921777155554, -0.42889921777155554, -0.42889921777155554],
y17: [-0.42830637797406274, -0.4283063779740646, -0.42830637797405235, -0.42830637797406274, -0.42830637797406274, -0.42830637797406274, 0.42564358392526674, 0.42564358392526674, 0.42564358392526674, -0.42830637797406274, -0.42830637797406274, -0.42830637797406274, -0.42830637797406274, -0.42830637797406274, -0.42830637797406274, 0.42564358392526674, 0.42564358392526674, 0.42564358392526674, 0.42564358392526674, 0.42564358392526674, 0.42564358392526674, 0.42564358392526674, 0.42564358392526674, 0.42564358392526674],
y18: [0.4068974540165188, -0.4076843220236405, -0.4076843220236405, -0.4076843220236405, -0.4076843220236405, -0.4076843220236405, -0.4076843220236405, -0.4076843220236405, -0.4076843220236405, -0.4076843220236405, -0.4076843220236405, -0.4076843220236405, -0.4076843220236405, -0.4076843220236405, -0.4076843220236405, -0.4076843220236405, 0.4068974540165188, 0.4068974540165188, 0.4068974540165188, 0.4068974540165188, 0.4068974540165188, 0.4068974540165188, 0.4068974540165188, 0.4068974540165188, 0.4068974540165188, 0.4068974540165188, 0.4068974540165188, 0.4068974540165188, 0.4068974540165188, 0.4068974540165188],
y19: [-0.3951466325379341, 0.3936245944772217, 0.2911646730599088, 0.15440097163588754, -0.002193757186519534, -0.15679349730162326, -0.2934144796766195, -0.3951466325379341, -0.2924328919309129, -0.15679349730162326, -0.002193757186519534, 0.1560471704551244, 0.29480586058644664, 0.3926430067315151],
y20: [0.4912533151881678, 0.4912533151881678, 0.4912533151881678, 0.4912533151881678],
y21: [0.5025266418092283, 0.5025266418092283, 0.5025266418092283],
y22: [-0.336987461914186, -0.336987461914186, -0.03948133757664016, -0.18823439974541314, -0.18823439974541314, -0.03948133757664016, 0.10927172459220066, 0.10927172459220066],
y23: [0.4210415452711405, 0.4210415452711405, 0.4210415452711405, 0.4210415452711405],
y24: [0.4482725878627099, 0.4482725878627099],
y25: [0.41728048922878286, 0.41728048922878286, 0.41728048922878286],
y26: [0.497018747825306, 0.497018747825306, 0.497018747825306],
y27: [0.48937116850865736, 0.48937116850865736, 0.48937116850865736],
y28: [-0.24321931719596104, -0.08387841495672171, 0.07546248728251762, 0.23480338952175694],
y29: [0.27480374240640054, 0.0931480043418076, -0.08850773372278528, -0.2701634717873782],
y30: [-0.010013315445377736, -0.010013315445377736],
y31: [-0.4407054007305456, -0.4407054007305456, -0.4407054007305456, -0.4407054007305456],
y32: [-0.4423734150592768, -0.4423734150592768, -0.4423734150592768, -0.4423734150592768, -0.44360069372652544, -0.4423734150592768, -0.4423734150592768],
y33: [-0.32650620160540383, -0.2551052305229663, -0.1837042594405288, -0.11230328835809125],
y34: [-0.461792391524817, -0.37869782238696303, -0.29560325324911085, 0.45224786899163283, 0.2860587307159139, -0.46179239152476903, -0.37869782238691535, -0.29560325324906195, 0.3691532998537676, 0.20296416157806033, 0.11986959244020683, 0.03677502330235322, -0.04631954583549568, -0.12941411497335265, -0.21250868411120616, -0.21250868411120616, -0.12941411497335265, -0.04631954583549905, 0.036775023302354465, 0.11986959244020798, 0.2029641615780615, 0.286058730715915, 0.3691532998537689, 0.4522478689916224, -0.5581126263833195],
y35: [0.49877718128334403, 0.49877718128334403],
y36: [0.49974862949105897, 0.49974862949105897],
y37: [0.45654356803979634, 0.45654356803979634, 0.45654356803979634, 0.45654356803979634, 0.4565435680397323, 0.45654356803979634],
y38: [-0.1227499139897371, -0.06108216884295189, 0.0005855763038032807, 0.06225332145061806, 0.12392106659740329],
y39: [0.49829121457517556, 0.49829121457517556],
y40: [0.436417024575174, 0.436417024575174, 0.436417024575174, 0.436417024575174, 0.436417024575174, 0.436417024575174],
y41: [0.49926408692078345, 0.49926408692078345],
y42: [0.49911647143345345, 0.49911647143345345],
y43: [0.49485992640128945, 0.49485992640128945, 0.49485992640128945],
y44: [0.48799174409407564, 0.48799174409407564],
y45: [-0.2517250477748368, -0.0016340920830922529, 0.24845686360865193, -0.2517250477749341, -0.00163409208319045, 0.24845686360855324],
y46: [-0.2534839194529619, 0.0033529080021853794, 0.2601897354573633, -0.2534839194529265, 0.002779184634732914, 0.25904228872239227],
y47: [-0.49529398479747266, 0.4967962283964071],
y48: [-0.49952094172670014, -0.49952094172670014],
y49: [-0.49829929808022605, -0.49829929808022605],
};
let objectsData = [
"Arduino Uno", "Microcontrollers", 1.0314452510656404, 32, 1418.4, //0
"Breadboard", "Electrical", 0.930840742046, 420, 827.4, //1
"Resistor", "Electrical", 0.6286216172399489, 2, 1418.4, //2
"LED", "Modules", 0.66280184339, 2, 1418.4, //3
"Button", "Electrical", 0.8960589628, 4, 1418.4, //4
"Diode", "Electrical", 0.5630794172983389, 2, 1418.4, //5
"Battery", "Other", 0.8291107459089542, 2, 1418.4, //6
"Toggle Switch", "Electrical", 0.86996931995, 2, 1418.4, //7
"Capacitor", "Electrical", 0.6959117149009196, 2, 1414.46, //8
"Servo Motor", "Modules", 0.6376327754216928, 3, 1418.4, //9
"Single Point", "Other", 0.022, 1, 1418.4, //10
"Piezo Buzzer", "Modules", 0.6453080218, 2, 1418.4, //11
"IC Chip", "Microcontrollers", 0.5990144, 16, 1418.4, //12
"Large Text", "Other", 0.8719942676674203, 2, 1418.4, //13
"Small Text", "Other", 0.7396757091238941, 2, 1418.4, //14
"Arduino Mega", "Microcontrollers", 0.844265301271, 86, 1418.4, //15
"Arduino Micro", "Microcontrollers", 1.01038177534, 34, 1418.4, //16
"Arduino Pro Micro", "Microcontrollers", 0.9739249434088939, 24, 1418.4, //17
"Arduino Nano", "Microcontrollers", 0.937458197688, 30, 1418.4, //18
"Adafruit Circuit Playground", "Microcontrollers", 0.7401785998271294, 14, 1418.4, //19
"4 Pin LED", "Modules", 0.918177596900323, 4, 1418.4, //20
"Relay", "Modules", 0.835597257305, 3, 1418.4, //21
"nRF24L01", "Modules", 0.735086751386, 8, 1418.4, //22
"Ultrasonic Distance", "Modules", 0.6006704698213494, 4, 1418.4, //23
"Force Pressure", "Modules", 0.749024493786, 2, 1418.4, //24
"PIR Motion", "Modules", 1.0211653825062605, 3, 1418.4, //25
"Transistor", "Electrical", 0.8214818882830167, 3, 1418.4, //26
"Transistor", "Electrical", 0.8412417971761024, 3, 1418.4, //27
"USB", "Other", 0.9222677749062851, 4, 1418.4, //28
"Micro USB", "Other", 0.9285404391421072, 4, 1418.4, //29
"Inductor", "Electrical", 0.779376939948, 2, 1418.4, //30
"OLED Display", "Modules", 0.852075257118, 4, 1418.4, //31
"RGB OLED Display", "Modules", 1.044091544167301, 7, 1418.4, //32
"I2C 16x2 LCD Display", "Modules", 0.985688064188, 4, 1418.4, //33
"I2C Multiplexer", "Modules", 0.965725365213, 25, 1418.4, //34
"Haptic Vibration", "Modules", 0.689256335236, 2, 1418.4, //35
"DC Motor", "Modules", 0.668148765786, 2, 1418.4, //36
"Stepper Motor", "Modules", 0.860030561469, 6, 1418.4, //37
"Stepper Motor", "Modules", 1.1824117533907919, 5, 1418.4, //38
"Solenoid", "Modules", 0.826065398938, 2, 1418.4, //39
"BNO055 9-Axis", "Modules", 0.741541438935, 6, 1418.4, //40
"Power Plug", "Other", 0.5314410000000003, 2, 1418.4, //41
"Flex Sensor", "Modules", 1.0236249094005352, 2, 1418.4, //42
"Potentiometer", "Electrical", 0.680810328425, 3, 1418.4, //43
"Photoresistor", "Modules", 0.528711986859, 2, 1418.4, //44
"Single Neopixel", "Modules", 0.778481158898, 6, 1418.4, //45
"Neopixel Strip", "Modules", 0.7284180347819951, 6, 1418.4, //46
"Coin Battery", "Other", 0.7662774750873609, 2, 1418.4, //47
"Large Battery", "Other", 1.1850160892438533, 2, 1418.4, //48
"Solar Cell", "Other", 1.1447376410536698, 2, 1418.4, //49
];
//// ////
//// Warning: Crazy Code Below!! ////
//Noting objects for use with Auto Color (objectID, numberOfPowerPoints)
var powerObjects = [
0, 2,
1, 60,
3, 1,
5, 1,
6, 1,
8, 1,
9, 1,
11, 1,
15, 2,
16, 3,
17, 1,
18, 3,
19, 1,
21, 1,
22, 1,
23, 1,
25, 1,
28, 1,
29, 1,
31, 1,
32, 1,
33, 1,
34, 1,
35, 1,
36, 1,
39, 1,
40, 2,
41, 1,
45, 2,
46, 2,
47, 1,
48, 1,
49, 1,
];
//Noting objects for use with Auto Color (objectID, numberOfGroundPoints)
var groundObjects = [
0, 3,
1, 60,
3, 1,
5, 1,
6, 1,
8, 1,
9, 1,
11, 1,
15, 3,
16, 2,
17, 3,
18, 2,
19, 3,
21, 1,
22, 1,
23, 1,
25, 1,
28, 1,
29, 1,
31, 1,
32, 1,
33, 1,
34, 1,
35, 1,
36, 1,
39, 1,
40, 1,
41, 1,
45, 2,
46, 2,
47, 1,
48, 1,
49, 1,
];
//Noting wiring points that wires should be red with Auto Color (p[objectID]: [wiringPointID])
var powerPins = {
p0: [27, 28],
p1: [30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 361, 363, 365, 367, 369, 371, 373, 375, 377, 379, 381, 383, 385, 387, 389, 391, 393, 395, 397, 399, 401, 403, 405, 407, 409, 411, 413, 415, 417, 419],
p3: [1],
p5: [1],
p6: [1],
p8: [1],
p9: [2],
p11: [0],
p15: [30, 31],
p16: [6, 25, 28],
p17: [5],
p18: [16, 17, 27],
p19: [7],
p21: [1],
p22: [1],
p23: [0],
p25: [0],
p28: [3],
p29: [0],
p31: [0],
p32: [1],
p33: [1],
p34: [0],
p35: [1],
p36: [1],
p39: [1],
p40: [0, 1],
p41: [1],
p45: [0, 3],
p46: [0, 3],
p47: [0],
p48: [0],
p49: [1],
};
//Noting wiring points that wires should be black with Auto Color (p[objectID]: [wiringPointID])
var gndPins = {
g0: [10, 29, 30],
g1: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 360, 362, 364, 366, 368, 370, 372, 374, 376, 378, 380, 382, 384, 386, 388, 390, 392, 394, 396, 398, 400, 402, 404, 406, 408, 410, 412, 414, 416, 418],
g3: [0],
g5: [0],
g6: [0],
g8: [0],
g9: [0],
g11: [1],
g15: [3, 32, 33],
g16: [18, 27],
g17: [3, 8, 15],
g18: [12, 29],
g19: [0, 13, 4],
g21: [2],
g22: [0],
g23: [3],
g25: [2],
g28: [0],
g29: [3],
g31: [1],
g32: [0],
g33: [0],
g34: [1],
g35: [0],
g36: [0],
g39: [0],
g40: [2],
g41: [0],
g45: [1, 4],
g46: [1, 4],
g47: [1],
g48: [1],
g49: [0],
};
//Assign objects with attached label (objectID, defaultLabel, fontSize, textLength, rotateWithObject, forEachAngle[relativePositionX, relativePositionY], defaultColor)
var defaultLabel = [
4, "1", 0.05, 1, false, 0, 0, 0, 0, 0, 0, 0, 0, 0xffffff,
5, "1N1418", 0.03, 6, false, 0.04, 0, 0, 0.04, -0.04, 0, 0, -0.04, 0x000000,
6, "AA", 0.08, 10, true, -0.065, 0, 0, -0.065, 0.065, 0, 0, 0.065, 0x000000,
8, "1uF", 0.04, 4, false, 0.06, 0, 0, 0.09, -0.06, 0, 0, -0.09, 0x000000,
12, "4N35", 0.04, 5, true, 0, 0, 0, 0, 0, 0, 0, 0, 0xffffff,
13, "Heading", 0.15, 17, true, 0, 0, 0, 0, 0, 0, 0, 0, 0x000000,
14, "Label", 0.035, 9, true, 0, 0, 0, 0, 0, 0, 0, 0, 0x000000,
26, "2SA1943", 0.025, 5, true, 0, -0.01, 0.01, 0, 0, 0.01, -0.01, 0, 0xffffff,
27, "TIP120", 0.028, 6, true, 0, 0.01, -0.01, 0, 0, -0.01, 0.01, 0, 0xffffff,
30, "10uH", 0.028, 8, false, 0, -0.045, 0.045, 0, 0, 0.045, -0.045, 0, 0x000000,
41, "5V 1A", 0.08, 7, false, -0.04, -0.3, 0.11, -0.13, 0.04, 0.3, -0.11, 0.13, 0xffffff,
48, "9V", 0.15, 4, true, 0, 0.2, -0.1, 0, 0, -0.2, 0.1, 0, 0xffffff,
];
//Relative X positions of wiring points for each button variation (pin[numberOfPins]: [xPosition])
var buttonxPoints = {
pin2: [-0.41691687598528954, 0.41636162203332855],
pin4: [-0.41691687598528954, 0.41636162203332855, -0.41691687598528954, 0.41636162203332855],
}
//Relative Y positions of wiring points for each button variation (pin[numberOfPins]: [yPosition])
var buttonyPoints = {
pin2: [0.4871746212693234, 0.4871746212693234],
pin4: [-0.4996025474369343, -0.4996025474369343, 0.4871746212693234, 0.4871746212693234],
}
//Relative X positions of wiring points for each IC Chip variation (pin[numberOfPins]: [xPosition])
var ICxPoints = {
pin4: [-0.061391993510142094, 0.060343088176798856, -0.061391993510142094, 0.060343088176798856],
pin6: [-0.122, 0, 0.122, -0.122, 0, 0.122],
pin8: [-0.18312707519708282, -0.061391993510142094, 0.060343088176798856, 0.1820781698637398, -0.18312707519708282, -0.061391993510142094, 0.060343088176798856, 0.1820781698637398],
pin10: [-0.244, -0.122, 0, 0.122, 0.244, -0.244, -0.122, 0, 0.122, 0.244],
pin12: [-0.3048621568840238, -0.18312707519708282, -0.061391993510142094, 0.060343088176798856, 0.1820781698637398, 0.3038132515506805, -0.3048621568840238, -0.18312707519708282, -0.061391993510142094, 0.060343088176798856, 0.1820781698637398, 0.3038132515506805],
pin14: [-0.366, -0.244, -0.122, 0, 0.122, 0.244, 0.366, -0.366, -0.244, -0.122, 0, 0.122, 0.244, 0.366],
pin16: [-0.4265972385709647, -0.3048621568840238, -0.18312707519708282, -0.061391993510142094, 0.060343088176798856, 0.1820781698637398, 0.3038132515506805, 0.4255483332376215, -0.4265972385709647, -0.3048621568840238, -0.18312707519708282, -0.061391993510142094, 0.060343088176798856, 0.1820781698637398, 0.3038132515506805, 0.4255483332376215],
};
//Relative Y positions of wiring points for each IC Chip variation (pin[numberOfPins]: [yPosition])
var ICyPoints = {
pin4: [-0.4736769194750314, -0.4736769194750314, 0.46119210552622697, 0.46119210552622697],
pin6: [-0.4736769194750314, -0.4736769194750314, -0.4736769194750314, 0.46119210552622697, 0.46119210552622697, 0.46119210552622697],
pin8: [-0.4736769194750314, -0.4736769194750314, -0.4736769194750314, -0.4736769194750314, 0.46119210552622697, 0.46119210552622697, 0.46119210552622697, 0.46119210552622697],
pin10: [-0.4736769194750314, -0.4736769194750314, -0.4736769194750314, -0.4736769194750314, -0.4736769194750314, 0.46119210552622697, 0.46119210552622697, 0.46119210552622697, 0.46119210552622697, 0.46119210552622697],
pin12: [-0.4736769194750314, -0.4736769194750314, -0.4736769194750314, -0.4736769194750314, -0.4736769194750314, -0.4736769194750314, 0.46119210552622697, 0.46119210552622697, 0.46119210552622697, 0.46119210552622697, 0.46119210552622697, 0.46119210552622697],
pin14: [-0.4736769194750314, -0.4736769194750314, -0.4736769194750314, -0.4736769194750314, -0.4736769194750314, -0.4736769194750314, -0.4736769194750314, 0.46119210552622697, 0.46119210552622697, 0.46119210552622697, 0.46119210552622697, 0.46119210552622697, 0.46119210552622697, 0.46119210552622697],
pin16: [-0.4736769194750314, -0.4736769194750314, -0.4736769194750314, -0.4736769194750314, -0.4736769194750314, -0.4736769194750314, -0.4736769194750314, -0.4736769194750314, 0.46119210552622697, 0.46119210552622697, 0.46119210552622697, 0.46119210552622697, 0.46119210552622697, 0.46119210552622697, 0.46119210552622697, 0.46119210552622697],
};
var objectLabelData = [];
var itemTypes = ["All", "Microcontrollers", "Electrical", "Modules", "Other"];
var objectID = 0;
var itemObjectID = [];
var currentItemType = 0;
var currentPage = 0;
var snapStartX = -10010;
var snapStartY = -10006;
var grid;
var gridColor = 0xdddddd;
var labelColor = 0x000000;
var scaleCount = 1;
var activeWire = false;
var activeWireXY = [];
var boxMode = false;
var selectedMode = false;
var down = false;
var up = true;
var del = -1;
var delCount = 0;
var nodeLinks = [];
var wireColor = 0xED4040;
var wireGroup = 0;
var lineWidth;
var wireClick = 0;
var clickTime = 0;
var rotateAngle = [];
var settings = [];
var shiftObjects = [];
var startingX = [];
var startingY = [];
var endingX = [];
var endingY = [];
var lastX = 0;
var lastY = 0;
var autoSave = false;
var autoSaved = autoFrequency;
var dragPositionWires = [];
var dragPositionNodes = [];
var createObjects = [];
var createWires = [];
var panelType = 0;
var paletteColors = [0xED4040, 0xED9B40, 0xEDDD2D, 0x4FBA52, 0x45B5C4, 0x406EED, 0x9067B6, 0xE0607E, 0xAE7636, 0x3B3B3B];
var lastClicked = -1;
var lastWire = -1;
var customColors = [];
var customObjectColors = [0xff0000, 0xffff00, 0x00ff00, 0x0000ff, 0xffffff];
var resistorData = [];
var resistorColors = [0xBF9A30, 0x3B3B3B, 0xAE7636, 0xED4040, 0xED9B40, 0xEDDD2D, 0x4FBA52, 0x406EED, 0x9067B6, 0x999999, 0xFFFFFF];
class Workspace extends SimpleScene {
constructor() {
super("Workspace");
}
init() { }
preload() {
this.load.imageset("binhandlearrow", "assets/binhandlearrow.png", 560, 981);
this.load.image("increasescale", "assets/increasescale.png");
this.load.image("decreasescale", "assets/decreasescale.png");
this.load.image("grid", "assets/grid.jpeg");
this.load.image("magnet", "assets/magnet.png");
this.load.image("slash", "assets/slash.png");
this.load.image("arrow", "assets/arrow.png");
this.load.image("rotate", "assets/rotate.png");
this.load.image("swap", "assets/swap.png");
this.load.image("x", "assets/x.png");
this.load.image("duplicate", "assets/duplicate.png");
this.load.image("trash", "assets/trash.png");
this.load.image("edit", "assets/edit.png");
this.load.image("add", "assets/add.png");
this.load.image("addnode", "assets/addnode.png");
this.load.image("forward", "assets/forward.png");
this.load.image("backward", "assets/backward.png");
this.load.image("help", "assets/help.png");
this.load.image("info", "assets/info.png");
this.load.image("saved", "assets/saved.png");
this.load.image("editpop", "assets/editpop.png");
this.load.image("undo", "assets/undo.png");
this.load.image("search", "assets/search.png");
this.load.image("exit", "assets/exit.png");
this.load.image("dark", "assets/dark.png");
this.load.image("import", "assets/import.png");
this.load.image("pen", "assets/pen.png");
this.load.image("select", "assets/select.png");
this.load.image("home", "assets/home.png");
this.load.image("wand", "assets/wand.png");
this.load.imageset("checkbox", "assets/checkbox.png", 96, 96);
objectID = 0;
for (var i = 0; i < objectsData.length / 5; i++) {
if (objectID != 2 && objectID != 4 && objectID != 12) {
this.load.image(`${objectID}`, `workspace-objects/${objectID}.png`);
}
objectID++;
}
this.load.imageset("2", "workspace-objects/2.png", 100, 212);
this.load.imageset("4", "workspace-objects/4.png", 75, 95);
this.load.imageset("12", "workspace-objects/12.png", 384, 150);
}
create() {
this.tooltip = this.add.rectangle(0, 0, 0, deviceWidth * 0.015, 0x000000);
this.tooltiptext = this.add.text(0, 0, "", 0xffffff);
this.tooltiptext.setOrigin(0.5, 0.5);
this.tooltiptext.setFontSize(deviceWidth * 0.01);
this.tooltip.setDepth(10);
this.tooltiptext.setDepth(10);
undo.splice(0, undo.length);
redo.splice(0, redo.length);
resistorData.splice(0, resistorData.length)
rotateAngle.splice(0, rotateAngle.length);
settings.splice(0, settings.length);
itemObjectID.splice(0, itemObjectID.length);
objectID = 0;
closing = false;
opening = false;
lastPosition = [];
snapStartX = -10010;
snapStartY = -10006;
scaleCount = 1;
lastX = 0;
lastY = 0;
panelType = 0;
itemBinOpen = true;
currentItemType = 0;
currentPage = 0;
this.clearHTML();
//Create 3 additional sets of wiring point X and Y relative position data for each object angle
for (var i = 0; i < objectsData.length / 5; i++) {
for (var v = 0; v < 3; v++) {
for (var t = 0; t < objectsData[(i * 5) + 3]; t++) {
wiringXPoints["x" + i].push(0 - wiringYPoints["y" + i][t + (v * objectsData[(i * 5) + 3])]);
wiringYPoints["y" + i].push(wiringXPoints["x" + i][t + (v * objectsData[(i * 5) + 3])]);
}
}
}
//Do the same for the button for each variation
for (var i = 0; i < 2; i++) {
for (var t = 0; t < (i + 1) * 2; t++) {
buttonxPoints["pin" + (i + 1) * 2].push(0 - buttonyPoints["pin" + (i + 1) * 2][t]);
buttonyPoints["pin" + (i + 1) * 2].push(0 - buttonxPoints["pin" + (i + 1) * 2][t]);
}
for (var t = 0; t < (i + 1) * 2; t++) {
buttonxPoints["pin" + (i + 1) * 2].push(buttonyPoints["pin" + (i + 1) * 2][t + ((i + 1) * 2)]);
buttonyPoints["pin" + (i + 1) * 2].push(buttonxPoints["pin" + (i + 1) * 2][t + ((i + 1) * 2)]);
}
for (var t = 0; t < (i + 1) * 2; t++) {
buttonxPoints["pin" + (i + 1) * 2].push(0 - buttonyPoints["pin" + (i + 1) * 2][t + (2 * ((i + 1) * 2))]);
buttonyPoints["pin" + (i + 1) * 2].push(0 - buttonxPoints["pin" + (i + 1) * 2][t + (2 * ((i + 1) * 2))]);
}
}
//Do the same for the IC Chip for each variation
for (var i = 0; i < 7; i++) {
for (var v = 0; v < 3; v++) {
for (var t = 0; t < (i + 2) * 2; t++) {
ICxPoints["pin" + (i + 2) * 2].push(0 - ICyPoints["pin" + (i + 2) * 2][t + (v * ((i + 2) * 2))]);
ICyPoints["pin" + (i + 2) * 2].push(0 - ICxPoints["pin" + (i + 2) * 2][t + (v * ((i + 2) * 2))]);
}
}
}
this.title = this.add.text(deviceWidth / 2, deviceHeight * 0.045, "WORKSPACE", 0x999999);
this.title.setOrigin(0.5, 0);
this.title.setFontSize(deviceHeight * 0.075);
this.title.setDepth(1);
this.instructions = this.add.text(deviceWidth / 2, deviceHeight * 0.15, "Create a wiring diagram here.", labelColor);
this.instructions.setOrigin(0.5, 0);
this.instructions.setFontSize(deviceHeight * 0.03);
this.instructions.setDepth(1);
if (gridColor == 0xdddddd) {
this.itemBin = this.add.rectangle(deviceWidth * 0.1, deviceHeight * 0.22, deviceWidth * 0.22, deviceHeight * 2, 0xdddddd);
this.binHandle = this.add.circle(deviceWidth * 0.21, deviceHeight / 2, deviceWidth * 0.02, 0xdddddd);
this.binHandleArrow = this.add.sprite(deviceWidth * 0.215, deviceHeight / 2, "binhandlearrow", 0);
} else {
this.itemBin = this.add.rectangle(deviceWidth * 0.1, deviceHeight * 0.22, deviceWidth * 0.22, deviceHeight * 2, 0x333333);
this.binHandle = this.add.circle(deviceWidth * 0.21, deviceHeight / 2, deviceWidth * 0.02, 0x333333);
this.binHandleArrow = this.add.sprite(deviceWidth * 0.215, deviceHeight / 2, "binhandlearrow", 1);
}
this.itemBin.setDepth(5);
this.itemBin.enableClick();
this.binHandleArrow.setScale(deviceWidth * 0.00002);
this.binHandleArrow.setAngle(180);
this.binHandleArrow.enableClick();
this.binHandleArrow.setDepth(5);
this.binHandle.enableClick();
this.binHandle.setDepth(5);
this.binLabel = this.add.text(deviceWidth * 0.02, deviceHeight * 0.03, "All", 0x999999);
this.binLabel.setFontSize(deviceHeight * 0.045);
this.binLabel.setDepth(5);
this.binLabelDivider = this.add.line(deviceWidth * 0.015, deviceHeight * 0.09, deviceWidth * 0.2, deviceHeight * 0.09, 5, 0xdddddd);
this.binLabelDivider.setDepth(5);
if (gridColor == 0xdddddd) {
this.lastPageButton = this.add.rectangle(deviceWidth * 0.053, deviceHeight * 0.97, deviceWidth * 0.105, deviceWidth * 0.03, 0xffffff);
this.nextPageButton = this.add.rectangle(deviceWidth * 0.157, deviceHeight * 0.97, deviceWidth * 0.105, deviceWidth * 0.03, 0xffffff);
this.lastPageArrow = this.add.sprite(deviceWidth * 0.053, deviceHeight * 0.97, "binhandlearrow", 0);
this.nextPageArrow = this.add.sprite(deviceWidth * 0.157, deviceHeight * 0.97, "binhandlearrow", 0);
} else {
this.lastPageButton = this.add.rectangle(deviceWidth * 0.053, deviceHeight * 0.97, deviceWidth * 0.105, deviceWidth * 0.03, 0x000000);
this.nextPageButton = this.add.rectangle(deviceWidth * 0.157, deviceHeight * 0.97, deviceWidth * 0.105, deviceWidth * 0.03, 0x000000);
this.lastPageArrow = this.add.sprite(deviceWidth * 0.053, deviceHeight * 0.97, "binhandlearrow", 1);
this.nextPageArrow = this.add.sprite(deviceWidth * 0.157, deviceHeight * 0.97, "binhandlearrow", 1);
}
this.lastPageButton.setAlpha(0.3);
this.lastPageButton.enableClick();
this.lastPageButton.setDepth(5);
this.lastPageArrow.setScale(deviceWidth * 0.00003);
this.lastPageArrow.setAngle(-90);
this.lastPageArrow.enableClick();
this.lastPageArrow.setDepth(5);
this.nextPageButton.setAlpha(0.3);
this.nextPageButton.enableClick();
this.nextPageButton.setDepth(5);
this.nextPageArrow.setScale(deviceWidth * 0.00003);
this.nextPageArrow.setAngle(90);
this.nextPageArrow.enableClick();
this.nextPageArrow.setDepth(5);
this.addItem = this.add.sprite(deviceWidth * 0.115, deviceHeight * 0.05, "add");
this.addItem.setScale(deviceWidth * 0.00035);
this.addItem.enableClick();
this.addItem.setDepth(5);
this.search = this.add.sprite(deviceWidth * 0.15, deviceHeight * 0.05, "search");
this.search.setScale(deviceWidth * 0.00028);
this.search.enableClick();
this.search.setDepth(5);
this.itemTypeArrow = this.add.sprite(deviceWidth * 0.185, deviceHeight * 0.05, "swap");
this.itemTypeArrow.setScale(deviceWidth * 0.0005);
this.itemTypeArrow.enableClick();
this.itemTypeArrow.setDepth(5);
this.exit = this.add.sprite(deviceWidth * 0.18, deviceHeight * 0.05, "exit");
this.exit.setScale(deviceWidth * 0.0003);
this.exit.enableClick();
this.exit.setDepth(5);
this.exit.setVisible(0);
objectID = 0;
this.items = [];
this.itemLabels = [];
this.itemResistorBars = [];
this.labelItemText = [];
this.labelItemText[0] = this.add.text(0, 0, "", 0x000000);
this.labelItemText[1] = this.add.text(0, 0, "", 0x000000);
this.itemButtons = [];
//Create the parts panel on the left
var v = 0;
for (var i = 0; i < objectsData.length / 5; i++) { //Each part own 5 pieces of data in this array
if (v < 8) { //Display 8 objects at once in the panel
if (objectID != 10) { //Exclude the white point object for Pen Mode use only
var obj;
var label;
var button;
if (i % 2 == 0) { //If even, place object on the left
obj = this.add.sprite(deviceWidth * 0.05, (Math.floor(i / 2) * deviceHeight * 0.2) + deviceHeight * 0.17, `${objectID}`, 1);
label = this.add.text(deviceWidth * 0.05, (Math.floor(i / 2) * deviceHeight * 0.2) + deviceHeight * 0.26, objectsData[i * 5], labelColor);
button = this.add.rectangle(deviceWidth * 0.05, (Math.floor(i / 2) * deviceHeight * 0.2) + deviceHeight * 0.2, deviceWidth * 0.08, deviceHeight * 0.17, 0xffffff);
}
if (i % 2 == 1) { //If odd, place object on the right
obj = this.add.sprite(deviceWidth * 0.15, (Math.floor(i / 2) * deviceHeight * 0.2) + deviceHeight * 0.17, `${objectID}`, 1);
label = this.add.text(deviceWidth * 0.15, (Math.floor(i / 2) * deviceHeight * 0.2) + deviceHeight * 0.26, objectsData[i * 5], labelColor);
button = this.add.rectangle(deviceWidth * 0.15, (Math.floor(i / 2) * deviceHeight * 0.2) + deviceHeight * 0.2, deviceWidth * 0.08, deviceHeight * 0.17, 0xffffff);
}
obj.scale *= (objectsData[(i * 5) + 2]);
obj.width *= (objectsData[(i * 5) + 2]);
obj.height *= (objectsData[(i * 5) + 2])
while (obj.width < deviceWidth * 0.03 && obj.height < deviceHeight * 0.08) {
obj.width *= 1.1;
obj.scale *= 1.1;
obj.height *= 1.1;
}
while (obj.width > deviceWidth * 0.08 || obj.height > deviceHeight * 0.12) {
obj.width *= 0.9;
obj.scale *= 0.9;
obj.height *= 0.9;
}
obj.setDepth(6);
this.items.push(obj);
itemObjectID.push(objectID);
button.setAlpha(0.01);
button.setDepth(7);
button.enableClick();
this.itemButtons.push(button);
//Generate colored bars if it is a resistor
if (objectID == 2) {
this.itemResistorBars[0] = this.add.rectangle(obj.x, obj.y + obj.height * 0.052, obj.width * 0.3, obj.height * 0.055, 0x3b3b3b);
this.itemResistorBars[1] = this.add.rectangle(obj.x, obj.y - obj.height * 0.057, obj.width * 0.3, obj.height * 0.055, 0xed9c40);
this.itemResistorBars[0].setOrigin(0.5, 0.5);
this.itemResistorBars[1].setOrigin(0.5, 0.5);
this.itemResistorBars[0].setDepth(6);
this.itemResistorBars[1].setDepth(6);
}
//Generate text if it is a label
if (objectID == 13) {
this.labelItemText[0] = this.add.text(obj.x, obj.y, "Heading", 0xff0000);
this.labelItemText[0].setFontSize(deviceHeight * 0.025);
this.labelItemText[0].setDepth(6);
this.labelItemText[0].setOrigin(0.5, 0.5);
}
if (objectID == 14) {
this.labelItemText[1] = this.add.text(obj.x, obj.y, "Label", 0x0000ff);
this.labelItemText[1].setFontSize(deviceHeight * 0.03);
this.labelItemText[1].setDepth(6);
this.labelItemText[1].setOrigin(0.5, 0.5);
}
if (label.text.length > 15) {
label.setFontSize(15 / label.text.length * deviceHeight * 0.025);
} else {
label.setFontSize(deviceHeight * 0.025);
}
label.setOrigin(0.5, 0.5);
label.setDepth(6);
this.itemLabels.push(label);
v++;
}
objectID++;
}
}
this.objects = [];
var object = this.objects;
this.objectIDs = [];
this.objectLabels = [];
this.resistorBars = [];
this.wires = [];
this.wireLines = [];
lineWidth = 8 * scaleCount;
this.activeWire = this.add.line(0, 0, 0, 0, 0xED4040);
this.activeWire.setLineWidth(3.8 * scaleCount);
this.nodes = [];
var nodes = this.nodes;
this.leftarrow = this.add.key("LEFT");
this.rightarrow = this.add.key("RIGHT");
this.uparrow = this.add.key("UP");
this.downarrow = this.add.key("DOWN")
this.shift = this.add.key("SHIFT");
this.space = this.add.key("SPACE");
this.del = this.add.key("BACKSPACE");
this.esc = this.add.key("ESC");
this.return = this.add.key("ENTER");
this.s = this.add.key("S");
this.w = this.add.key("w");
this.d = this.add.key("D");
this.z = this.add.key("Z");
this.x = this.add.key("X");
this.c = this.add.key("C");
this.a = this.add.key("A");
this.key0 = this.add.key("ZERO");
this.key1 = this.add.key("ONE");
this.key2 = this.add.key("TWO");
this.key3 = this.add.key("THREE");
this.key4 = this.add.key("FOUR");
this.key5 = this.add.key("FIVE");
this.key6 = this.add.key("SIX");
this.key7 = this.add.key("SEVEN");
this.key8 = this.add.key("EIGHT");
this.key9 = this.add.key("NINE");
this.increaseScaleButton = this.add.circle(deviceWidth * 0.83, deviceHeight * 0.94, deviceWidth * 0.02, 0xF4F5F6);
this.increaseScaleButton.enableClick();
this.increaseScaleButton.setAlpha(0.01);
this.increaseScaleButton.setDepth(5);
this.decreaseScaleButton = this.add.circle(deviceWidth * 0.785, deviceHeight * 0.94, deviceWidth * 0.02, 0xF4F5F6);
this.decreaseScaleButton.enableClick();
this.decreaseScaleButton.setAlpha(0.01);
this.decreaseScaleButton.setDepth(5);
this.increaseScale = this.add.sprite(deviceWidth * 0.83, deviceHeight * 0.94, "increasescale");
this.increaseScale.setScale(deviceWidth * 0.000035);
this.increaseScale.enableClick();
this.increaseScale.setDepth(5);
this.decreaseScale = this.add.sprite(deviceWidth * 0.785, deviceHeight * 0.94, "decreasescale");
this.decreaseScale.setScale(deviceWidth * 0.000035);
this.decreaseScale.enableClick();
this.decreaseScale.setDepth(5);
this.saveButton = this.add.rectangle(deviceWidth * 0.9, deviceHeight * 0.94, deviceWidth * 0.07, deviceHeight * 0.075, 0x4FBA52);
this.saveButton.enableClick();
this.saveButton.setDepth(5);
this.save = this.add.text(deviceWidth * 0.9, deviceHeight * 0.94, "Save");
this.save.setOrigin(0.5, 0.5);
this.save.setFontSize(deviceHeight * 0.03);
this.save.enableClick();
this.save.setDepth(5);
this.saved = this.add.sprite(deviceWidth * 0.9, deviceHeight * 0.94, "saved");
this.saved.setScale(deviceWidth * 0.0004);
this.saved.setVisible(0);
this.saved.setDepth(5);
this.import = this.add.sprite(deviceWidth * 0.965, deviceHeight * 0.94, "import");
this.import.setScale(deviceWidth * 0.00035)
this.import.enableClick();
this.import.setDepth(5);
this.help = this.add.sprite(deviceWidth * 0.965, deviceHeight * 0.06, "help");
this.help.setScale(deviceWidth * 0.0004);
this.help.enableClick();
this.help.setDepth(5);
this.help2 = this.add.sprite(deviceWidth * 0.965, deviceHeight * 0.06, "help");
this.help2.setScale(deviceWidth * 0.0004);
this.help2.enableClick();
this.help2.setDepth(5);
this.help2.setVisible(0);
this.home = this.add.sprite(deviceWidth * 0.92, deviceHeight * 0.06, "home");
this.home.setScale(deviceWidth * 0.00011);
this.home.enableClick();
this.home.setDepth(5);
this.home.setVisible(0);
this.increaseScaleButton2 = this.add.circle(deviceWidth * 0.875, deviceHeight * 0.06, deviceWidth * 0.02, 0xF4F5F6);
this.increaseScaleButton2.enableClick();
this.increaseScaleButton2.setAlpha(0.01);
this.increaseScaleButton2.setDepth(5);
this.increaseScaleButton2.setVisible(0);
this.decreaseScaleButton2 = this.add.circle(deviceWidth * 0.835, deviceHeight * 0.06, deviceWidth * 0.02, 0xF4F5F6);
this.decreaseScaleButton2.enableClick();
this.decreaseScaleButton2.setAlpha(0.01);
this.decreaseScaleButton2.setDepth(5);
this.decreaseScaleButton2.setVisible(0);
this.increaseScale2 = this.add.sprite(deviceWidth * 0.875, deviceHeight * 0.06, "increasescale");
this.increaseScale2.setScale(deviceWidth * 0.00003);
this.increaseScale2.enableClick();
this.increaseScale2.setDepth(5);
this.increaseScale2.setVisible(0);
this.decreaseScale2 = this.add.sprite(deviceWidth * 0.835, deviceHeight * 0.06, "decreasescale");
this.decreaseScale2.setScale(deviceWidth * 0.00003);
this.decreaseScale2.enableClick();
this.decreaseScale2.setDepth(5);
this.decreaseScale2.setVisible(0);
this.dark = this.add.sprite(deviceWidth * 0.92, deviceHeight * 0.06, "dark");
this.dark.setScale(deviceWidth * 0.00035);
this.dark.enableClick();
this.dark.setDepth(5);
this.pen = this.add.sprite(deviceWidth * 0.83, deviceHeight * 0.06, "pen");
this.pen.setScale(deviceWidth * 0.0004);
this.pen.enableClick();
this.pen.setDepth(5);
this.penSlash = this.add.sprite(deviceWidth * 0.83, deviceHeight * 0.06, "slash");
this.penSlash.flipX = true;
this.penSlash.setScale(deviceWidth * 0.0003);
this.penSlash.enableClick();
this.penSlash.setDepth(5);
this.wand = this.add.sprite(deviceWidth * 0.785, deviceHeight * 0.06, "wand");
this.wand.setScale(deviceWidth * 0.0004);
this.wand.enableClick();
this.wand.setDepth(5);
this.select = this.add.sprite(deviceWidth * 0.875, deviceHeight * 0.06, "select");
this.select.setScale(deviceWidth * 0.0004);
this.select.enableClick();
this.select.setDepth(5);
this.selectBox = this.add.rectangle(deviceWidth * 0.5, deviceHeight * 0.5, 0, 0, 0x0000ff);
this.selectBox.setOrigin(0, 0);
this.selectBox.setAlpha(0.1);
this.selectBox.setDepth(10);
this.magnet = this.add.sprite(deviceWidth * 0.735, deviceHeight * 0.945, "magnet");
this.magnet.setScale(deviceWidth * 0.0005);
this.magnet.enableClick();
this.magnet.setDepth(5);
this.slash = this.add.sprite(deviceWidth * 0.735, deviceHeight * 0.95, "slash");
this.slash.setScale(deviceWidth * 0.0004);
this.slash.enableClick();
this.slash.setVisible(0);
this.slash.setDepth(5);
if (gridColor == 0xdddddd) {
this.floor = this.add.rectangle(deviceWidth / 2, deviceHeight / 2, deviceWidth, deviceHeight, 0xF4F5F6);
} else {
this.floor = this.add.rectangle(deviceWidth / 2, deviceHeight / 2, deviceWidth, deviceHeight, 0x040506);
}
this.floor.setDepth(0);
this.floor.enableClick();
this.grid = this.add.gridLayout(snapStartX, snapStartY, 100000, 100000, 28 * scaleCount, 28 * scaleCount);
this.grid.setOutlineStyle(gridColor, 1)
this.grid.setDepth(0);
this.grid.enableClick();
grid = this.grid;
this.redo = this.add.sprite(deviceWidth * 0.685, deviceHeight * 0.945, "undo");
this.redo.setScale(deviceWidth * 0.0005);
this.redo.flipX = true;
this.redo.setDepth(5);
this.redo.enableClick();
this.undo = this.add.sprite(deviceWidth * 0.635, deviceHeight * 0.945, "undo");
this.undo.setScale(deviceWidth * 0.0005);
this.undo.setDepth(5);
this.undo.enableClick();
this.wiringPointer = this.add.circle(0, 0, 8 * scaleCount, 0xbbbbbb);
this.wiringPointer.setDepth(5);
//Move all objects, wires, and nodes along with the background grid when panned
var pointer = this.input.activePointer;
this.input.on('wheel', function(pointer, gameObjects, deltaX, deltaY) {
grid.x -= deltaX * 0.2;
grid.y -= deltaY * 0.2;
snapStartX -= deltaX * 0.2;
snapStartY -= deltaY * 0.2;
for (var i = 0; i < object.length; i++) {
object[i].x -= deltaX * 0.2;
object[i].y -= deltaY * 0.2;
}
for (var i = 0; i < nodes.length; i++) {
nodes[i].x -= deltaX * 0.2;
nodes[i].y -= deltaY * 0.2;
}
lastPosition[1] -= deltaX * 0.2;
lastPosition[2] -= deltaY * 0.2;
});
this.popupover = this.add.rectangle(deviceWidth / 2, deviceHeight / 2, deviceWidth, deviceHeight, 0xffffff);
this.popupover.setAlpha(0.5);
this.popupover.setDepth(8);
this.popupover.setVisible(0);
this.popup = this.add.rectangle(deviceWidth / 2, deviceHeight / 2, deviceWidth * 0.6, deviceHeight * 0.3, 0xcccccc);
this.popup.setDepth(9);
this.popup.setVisible(0);
this.popuptext = this.add.text(deviceWidth / 2, deviceHeight * 0.45, "", 0x000000);
this.popuptext.setOrigin(0.5, 0.5);
this.popuptext.setFontSize(deviceHeight * 0.04);
this.popuptext.setDepth(9);
this.popuptext.setVisible(0);
this.popupdone = this.add.rectangle(deviceWidth * 0.44, deviceHeight * 0.55, deviceWidth * 0.1, deviceHeight * 0.05, 0xaaaaaa);
this.popupdone.width = deviceWidth * 0.1;
this.popupdone.height = deviceHeight * 0.05;
this.popupdone.enableClick();
this.popupdone.setDepth(9);
this.popupdone.setVisible(0);
this.popupcreate = this.add.rectangle(deviceWidth * 0.56, deviceHeight * 0.55, deviceWidth * 0.1, deviceHeight * 0.05, 0x4FBA52);
this.popupcreate.width = deviceWidth * 0.1;
this.popupcreate.height = deviceHeight * 0.05;
this.popupcreate.enableClick();
this.popupcreate.setDepth(9);
this.popupcreate.setVisible(0);
this.popupdonetext = this.add.text(deviceWidth * 0.44, deviceHeight * 0.55, "Done", 0x000000);
this.popupdonetext.setOrigin(0.5, 0.5);
this.popupdonetext.setFontSize(deviceHeight * 0.03);
this.popupdonetext.enableClick();
this.popupdonetext.setDepth(10);
this.popupdonetext.setVisible(0);
this.popupcreatetext = this.add.text(deviceWidth * 0.56, deviceHeight * 0.55, "Create Image", 0x000000);
this.popupcreatetext.setOrigin(0.5, 0.5);
this.popupcreatetext.setFontSize(deviceHeight * 0.025);
this.popupcreatetext.enableClick();
this.popupcreatetext.setDepth(10);
this.popupcreatetext.setVisible(0);