forked from b3m2a1/mathematica-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
BlockBuilder.nb
8292 lines (8113 loc) · 418 KB
/
BlockBuilder.nb
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
(* Content-type: application/vnd.wolfram.mathematica *)
(*** Wolfram Notebook File ***)
(* http://www.wolfram.com/nb *)
(* CreatedBy='Mathematica 11.1' *)
(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest
NotebookFileLineBreakTest
NotebookDataPosition[ 158, 7]
NotebookDataLength[ 427622, 8284]
NotebookOptionsPosition[ 414948, 7978]
NotebookOutlinePosition[ 415303, 7994]
CellTagsIndexPosition[ 415260, 7991]
WindowFrame->Normal*)
(* Beginning of Notebook Content *)
Notebook[{
Cell[CellGroupData[{
Cell["BlockBuilder", "Section",
CellChangeTimes->{{3.713227151510705*^9, 3.71322715930964*^9}, {
3.713320400590301*^9,
3.7133204063899307`*^9}},ExpressionUUID->"7a3368b6-0876-489b-90df-\
c4a2851cc25c"],
Cell[CellGroupData[{
Cell["Locator Framework", "Subsection",
CellChangeTimes->{{3.7132312075375834`*^9, 3.71323121277629*^9}, {
3.713320394392087*^9,
3.713320399014454*^9}},ExpressionUUID->"16cd61f1-abb1-4e8e-b521-\
076d7c10f240"],
Cell[CellGroupData[{
Cell["Defaults", "Subsubsection",
CellChangeTimes->{{3.7132312142719193`*^9,
3.713231215296061*^9}},ExpressionUUID->"b08167b9-37b9-4ddb-acb7-\
6be1077eae45"],
Cell[BoxData[
RowBox[{
RowBox[{"$defaultLocatorObjects", "=", "\[IndentingNewLine]",
RowBox[{"<|", "\[IndentingNewLine]",
RowBox[{
RowBox[{"\"\<Point\>\"", "\[Rule]", "None"}], ",", "\[IndentingNewLine]",
RowBox[{"\"\<Line\>\"", "\[Rule]", "\[IndentingNewLine]",
RowBox[{"Function", "[", "\[IndentingNewLine]",
RowBox[{"With", "[",
RowBox[{
RowBox[{"{",
RowBox[{"locatorManager", "=",
RowBox[{"First", "@", "#"}]}], "}"}], ",", "\[IndentingNewLine]",
RowBox[{"{", "\[IndentingNewLine]",
RowBox[{"Thick", ",", "\[IndentingNewLine]",
RowBox[{"GrayLevel", "[", ".75", "]"}], ",", "\[IndentingNewLine]",
RowBox[{"Line", "@", "\[IndentingNewLine]",
RowBox[{"Lookup", "[",
RowBox[{
RowBox[{"Lookup", "[",
RowBox[{"locatorManager", ",", "#2"}], "]"}], ",",
"\"\<Position\>\""}], "]"}]}]}], "\[IndentingNewLine]", "}"}]}],
"\[IndentingNewLine]", "]"}], "\[IndentingNewLine]", "]"}]}], ",",
"\[IndentingNewLine]",
RowBox[{"\"\<Block\>\"", "\[Rule]", "\[IndentingNewLine]",
RowBox[{"Function", "[", "\[IndentingNewLine]",
RowBox[{"With", "[",
RowBox[{
RowBox[{"{",
RowBox[{"locatorManager", "=",
RowBox[{"First", "@", "#"}]}], "}"}], ",", "\[IndentingNewLine]",
RowBox[{"Polygon", "@", "\[IndentingNewLine]",
RowBox[{"Lookup", "[",
RowBox[{
RowBox[{"Lookup", "[",
RowBox[{"locatorManager", ",", "#2"}], "]"}], ",",
"\"\<Position\>\""}], "]"}]}]}], "\[IndentingNewLine]", "]"}],
"\[IndentingNewLine]", "]"}]}]}], "\[IndentingNewLine]", "|>"}]}],
";"}]], "Input",
CellChangeTimes->{{3.713227201798317*^9, 3.713227606492551*^9}, {
3.713229362774047*^9, 3.713229407486074*^9}, {3.713229475457897*^9,
3.713229530322032*^9}, {3.713230314237101*^9, 3.713230322900557*^9}, {
3.713230423309691*^9, 3.7132304398672667`*^9}, {3.713230616068022*^9,
3.713230684378195*^9}, 3.713233180909955*^9, {3.713233231013019*^9,
3.713233234741004*^9}, {3.713293210208927*^9,
3.7132932220873137`*^9}},ExpressionUUID->"159f25b3-b96a-4f87-b827-\
b134663bc0e7"],
Cell[BoxData[
RowBox[{
RowBox[{"$defaultLocatorEvents", "=", "\[IndentingNewLine]",
RowBox[{"<|", "\[IndentingNewLine]",
RowBox[{
RowBox[{"\"\<MoveStart\>\"", "\[Rule]",
RowBox[{"(",
RowBox[{"Null", "&"}], ")"}]}], ",", "\[IndentingNewLine]",
RowBox[{"\"\<Move\>\"", "\[Rule]", "\[IndentingNewLine]",
RowBox[{"Function", "[", "\[IndentingNewLine]",
RowBox[{"Null", ",", "\[IndentingNewLine]",
RowBox[{"setAnchorLocatorPosition", "[", "##", "]"}], ",",
"\[IndentingNewLine]", "HoldFirst"}], "\[IndentingNewLine]", "]"}]}],
",", "\[IndentingNewLine]",
RowBox[{"\"\<MoveEnd\>\"", "\[Rule]", "\[IndentingNewLine]",
RowBox[{"Function", "[",
RowBox[{"Null", ",", "\[IndentingNewLine]",
RowBox[{"updateAnchorLocators", "[", "#", "]"}], ",",
"\[IndentingNewLine]", "HoldFirst"}], "\[IndentingNewLine]",
"]"}]}]}], "\[IndentingNewLine]", "|>"}]}], ";"}]], "Input",
CellChangeTimes->{{3.71323175002792*^9, 3.713231754159636*^9}, {
3.713232298160872*^9, 3.713232325052496*^9}, {3.7132326601904707`*^9,
3.713232660636451*^9}, {3.713232732117127*^9, 3.713232737851313*^9}, {
3.713237389911501*^9, 3.713237397958766*^9}, {3.7132375944384403`*^9,
3.713237598483107*^9}, {3.71323805305262*^9,
3.713238053233646*^9}},ExpressionUUID->"2b5b7a6c-cc1c-425a-9949-\
e4941d98a4b3"],
Cell[BoxData[
RowBox[{
RowBox[{"$defaultLocatorDefinitions", "=", "\[IndentingNewLine]",
RowBox[{"<|", "\[IndentingNewLine]",
RowBox[{
RowBox[{"\"\<AttractionRadius\>\"", "\[Rule]", ".5"}], ",",
"\[IndentingNewLine]",
RowBox[{"\"\<Bound\>\"", "\[Rule]",
RowBox[{"{", "}"}]}], ",", "\[IndentingNewLine]",
RowBox[{"\"\<Connected\>\"", "\[Rule]",
RowBox[{"{", "}"}]}], ",", "\[IndentingNewLine]",
RowBox[{"\"\<ConnectedMove\>\"", "\[Rule]", "False"}], ",",
"\[IndentingNewLine]",
RowBox[{"\"\<Type\>\"", "\[Rule]", "\"\<Point\>\""}], ",",
"\[IndentingNewLine]",
RowBox[{"\"\<Draggable\>\"", "\[Rule]", "False"}], ",",
"\[IndentingNewLine]",
RowBox[{
"\"\<Events\>\"", ":>", "\[IndentingNewLine]",
"$defaultLocatorEvents"}]}], "\[IndentingNewLine]", "|>"}]}],
";"}]], "Input",
CellChangeTimes->{{3.713233375955456*^9, 3.7132333992803783`*^9}, {
3.713233523666234*^9, 3.7132335254337397`*^9}, {3.713234237273497*^9,
3.713234281903212*^9}, {3.713237110087059*^9,
3.713237112061977*^9}},ExpressionUUID->"aa524b4a-274a-480c-ad2e-\
ad6e989e504d"]
}, Closed]],
Cell[CellGroupData[{
Cell["Base Anchor", "Subsubsection",
CellChangeTimes->{{3.7132312142719193`*^9, 3.713231220775996*^9}, {
3.7132340503337183`*^9, 3.7132340507488003`*^9},
3.713234171969881*^9},ExpressionUUID->"530c9990-4304-4477-85b9-\
0e1c05e0eda9"],
Cell[BoxData[{
RowBox[{
RowBox[{"Clear", "[", "makeAnchorLocator", "]"}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"makeAnchorLocator", "[",
RowBox[{
RowBox[{
RowBox[{"Verbatim", "[", "Dynamic", "]"}], "[", "locatorManager_",
"]"}], ",", "\[IndentingNewLine]",
RowBox[{"pt", ":",
RowBox[{"{",
RowBox[{"_", ",", "_"}], "}"}]}], ",", "\[IndentingNewLine]",
RowBox[{"obj", ":",
RowBox[{"Except", "[",
RowBox[{"_", "?", "OptionQ"}], "]"}], ":", "None"}], ",",
"\[IndentingNewLine]",
RowBox[{"ops___", "?", "OptionQ"}]}], "]"}], ":=", "\[IndentingNewLine]",
RowBox[{"With", "[",
RowBox[{
RowBox[{"{", "\[IndentingNewLine]",
RowBox[{
RowBox[{"uuid", "=",
RowBox[{"CreateUUID", "[", "]"}]}], ",", "\[IndentingNewLine]",
RowBox[{"graphic", "=", "\[IndentingNewLine]",
RowBox[{"Replace", "[",
RowBox[{"obj", ",", "\[IndentingNewLine]",
RowBox[{"Automatic", "\[RuleDelayed]", "\[IndentingNewLine]",
RowBox[{"$defaultLocatorObjects", "[", "\"\<Point\>\"", "]"}]}]}],
"\[IndentingNewLine]", "]"}]}]}], "\[IndentingNewLine]", "}"}], ",",
"\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"locatorManager", "[", "uuid", "]"}], "=",
"\[IndentingNewLine]",
RowBox[{"Merge", "[",
RowBox[{
RowBox[{"{", "\[IndentingNewLine]",
RowBox[{"$defaultLocatorDefinitions", ",", "\[IndentingNewLine]",
RowBox[{"<|", "\[IndentingNewLine]",
RowBox[{
RowBox[{"\"\<Position\>\"", "\[Rule]", "pt"}], ",",
"\[IndentingNewLine]",
RowBox[{"\"\<UUID\>\"", "\[Rule]", "uuid"}], ",",
"\[IndentingNewLine]",
RowBox[{"\"\<Graphics\>\"", "\[Rule]", "graphic"}]}],
"\[IndentingNewLine]", "|>"}], ",", "\[IndentingNewLine]",
"ops"}], "\[IndentingNewLine]", "}"}], ",", "\[IndentingNewLine]",
"Last"}], "\[IndentingNewLine]", "]"}]}], ";", "\[IndentingNewLine]",
RowBox[{"With", "[",
RowBox[{
RowBox[{"{", "\[IndentingNewLine]",
RowBox[{"loc", "=",
RowBox[{"Locator", "[", "\[IndentingNewLine]",
RowBox[{
RowBox[{"Dynamic", "[",
RowBox[{
RowBox[{"locatorManager", "[",
RowBox[{"uuid", ",", "\"\<Position\>\""}], "]"}], ",",
"\[IndentingNewLine]",
RowBox[{"{", "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"callAnchorLocatorEvent", "[",
RowBox[{
"locatorManager", ",", "\[IndentingNewLine]", "uuid", ",",
"\[IndentingNewLine]", "\"\<MoveStart\>\""}],
"\[IndentingNewLine]", "]"}], "&"}], ",",
"\[IndentingNewLine]",
RowBox[{"Function", "[", "\[IndentingNewLine]",
RowBox[{"callAnchorLocatorEvent", "[",
RowBox[{
"locatorManager", ",", "\[IndentingNewLine]", "uuid", ",",
"\[IndentingNewLine]", "\"\<Move\>\"", ",",
"\[IndentingNewLine]", "#", ",", "\[IndentingNewLine]",
"False", ",", "\[IndentingNewLine]", "True", ",",
"\[IndentingNewLine]", "True"}], "\[IndentingNewLine]",
"]"}], "\[IndentingNewLine]", "]"}], ",",
"\[IndentingNewLine]",
RowBox[{
RowBox[{"callAnchorLocatorEvent", "[",
RowBox[{
"locatorManager", ",", "\[IndentingNewLine]", "uuid", ",",
"\[IndentingNewLine]", "\"\<MoveEnd\>\""}],
"\[IndentingNewLine]", "]"}], "&"}]}],
"\[IndentingNewLine]", "}"}]}], "\[IndentingNewLine]", "]"}],
",", "\[IndentingNewLine]",
RowBox[{"Replace", "[",
RowBox[{"graphic", ",", "\[IndentingNewLine]",
RowBox[{"None", "\[RuleDelayed]",
RowBox[{"Sequence", "@@",
RowBox[{"{", "}"}]}]}]}], "\[IndentingNewLine]", "]"}]}],
"\[IndentingNewLine]", "]"}]}], "\[IndentingNewLine]", "}"}], ",",
"\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"locatorManager", "[",
RowBox[{"uuid", ",", "\"\<Locator\>\""}], "]"}], "=", "loc"}], ";",
"\[IndentingNewLine]",
RowBox[{"uuid", "\[Rule]", "loc"}]}]}], "\[IndentingNewLine]",
"]"}]}]}], "\[IndentingNewLine]", "]"}]}], ";"}]}], "Input",
CellChangeTimes->{{3.713227201798317*^9, 3.713227690967429*^9}, {
3.713227812731427*^9, 3.7132278406453247`*^9}, {3.7132282314570017`*^9,
3.713228232017095*^9}, {3.713228847089028*^9, 3.713228852697071*^9}, {
3.71322890481822*^9, 3.713228921040502*^9}, 3.713229025240568*^9, {
3.7132290630946903`*^9, 3.7132290665907097`*^9}, {3.713229232034008*^9,
3.713229235016835*^9}, {3.713229321343973*^9, 3.713229350486541*^9}, {
3.7132294045055428`*^9, 3.713229426126197*^9}, {3.7132295728860807`*^9,
3.713229603529524*^9}, {3.713229649850581*^9, 3.713229653457581*^9}, {
3.713229694020955*^9, 3.713229697597122*^9}, {3.713230351034625*^9,
3.7132304042575197`*^9}, {3.713230818915436*^9, 3.713230827059285*^9}, {
3.713231501519269*^9, 3.713231759497718*^9}, {3.7132318139726686`*^9,
3.71323181573138*^9}, {3.713232342814711*^9, 3.713232350142837*^9}, {
3.7132324355111227`*^9, 3.713232436045239*^9}, {3.713232899819097*^9,
3.71323290081623*^9}, 3.71323326333377*^9, {3.713233337985713*^9,
3.713233370587306*^9}, {3.713233404683819*^9, 3.713233415145102*^9}, {
3.713234043679048*^9, 3.713234045857387*^9}, {3.7132340925463533`*^9,
3.713234132994134*^9}, {3.7132342915786333`*^9, 3.713234481438457*^9}, {
3.713234763152891*^9, 3.713234774677616*^9}, 3.713234927867228*^9, {
3.713235010404105*^9, 3.7132350120825233`*^9}, {3.713236280094901*^9,
3.713236299116171*^9}, {3.7132366266867228`*^9, 3.713236628415518*^9},
3.713236713318042*^9, 3.713237310373472*^9, 3.7132374023141537`*^9, {
3.713237605518734*^9, 3.713237609872064*^9}, {3.713238311135024*^9,
3.713238323039033*^9}, {3.713240085900982*^9, 3.7132401106780577`*^9}, {
3.7132416881916637`*^9, 3.713241696373848*^9}, {3.713242374753335*^9,
3.713242376154255*^9}, {3.71324309669995*^9, 3.7132430979386253`*^9}, {
3.713243130195589*^9, 3.713243134504826*^9}, {3.713243182321471*^9,
3.713243220423237*^9}, {3.713293924775426*^9, 3.7132940228929377`*^9},
3.713294960754402*^9, {3.713294996731827*^9, 3.7132950428705187`*^9},
3.713303794455834*^9},ExpressionUUID->"afd5552c-734d-4e2e-9b41-\
e2b08f8f4aef"]
}, Closed]],
Cell[CellGroupData[{
Cell["Point Anchors", "Subsubsection",
CellChangeTimes->{{3.713234054101901*^9,
3.713234056748897*^9}},ExpressionUUID->"a2a376b8-27c9-4077-8a9d-\
f5795f72191a"],
Cell[BoxData[{
RowBox[{
RowBox[{"Clear", "[", "makePointAnchorLocator", "]"}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"makePointAnchorLocator", "[",
RowBox[{
RowBox[{
RowBox[{"Verbatim", "[", "Dynamic", "]"}], "[", "locatorManager_",
"]"}], ",", "\[IndentingNewLine]",
RowBox[{"pt", ":",
RowBox[{"{",
RowBox[{"_", ",", "_"}], "}"}]}], ",", "\[IndentingNewLine]",
RowBox[{"obj", ":",
RowBox[{"_Graphics", "|", "None", "|", "Automatic"}], ":",
"Automatic"}], ",", "\[IndentingNewLine]",
RowBox[{"ops___", "?", "OptionQ"}]}], "]"}], ":=", "\[IndentingNewLine]",
RowBox[{"Last", "[", "\[IndentingNewLine]",
RowBox[{"makeAnchorLocator", "[", "\[IndentingNewLine]",
RowBox[{
RowBox[{"Dynamic", "[", "locatorManager", "]"}], ",",
"\[IndentingNewLine]", "pt", ",", "\[IndentingNewLine]", "obj", ",",
"\[IndentingNewLine]", "ops"}], "\[IndentingNewLine]", "]"}],
"\[IndentingNewLine]", "]"}]}], ";"}]}], "Input",
CellChangeTimes->{{3.713227201798317*^9, 3.713227690967429*^9}, {
3.713227812731427*^9, 3.7132278406453247`*^9}, {3.7132282314570017`*^9,
3.713228232017095*^9}, {3.713228847089028*^9, 3.713228852697071*^9}, {
3.71322890481822*^9, 3.713228921040502*^9}, 3.713229025240568*^9, {
3.7132290630946903`*^9, 3.7132290665907097`*^9}, {3.713229232034008*^9,
3.713229235016835*^9}, {3.713229321343973*^9, 3.713229350486541*^9}, {
3.7132294045055428`*^9, 3.713229426126197*^9}, {3.7132295728860807`*^9,
3.713229603529524*^9}, {3.713229649850581*^9, 3.713229653457581*^9}, {
3.713229694020955*^9, 3.713229697597122*^9}, {3.713230351034625*^9,
3.7132304042575197`*^9}, {3.713230818915436*^9, 3.713230827059285*^9}, {
3.713231501519269*^9, 3.713231759497718*^9}, {3.7132318139726686`*^9,
3.71323181573138*^9}, {3.713232342814711*^9, 3.713232350142837*^9}, {
3.7132324355111227`*^9, 3.713232436045239*^9}, {3.713232899819097*^9,
3.71323290081623*^9}, 3.71323326333377*^9, {3.713233337985713*^9,
3.713233370587306*^9}, {3.713233404683819*^9, 3.713233415145102*^9}, {
3.713234043679048*^9, 3.7132340638889637`*^9}, {3.713234144044382*^9,
3.71323416496874*^9}, {3.713234586782607*^9, 3.71323458877442*^9}, {
3.713234782099221*^9, 3.713234789746552*^9}, {3.713235904245676*^9,
3.713235906353299*^9}, {3.713235938587966*^9, 3.713235940416852*^9},
3.7132359826995564`*^9, {3.713236262140388*^9, 3.713236263961977*^9}, {
3.713236312644367*^9, 3.713236314163307*^9}, {3.7132366687111397`*^9,
3.713236674555966*^9}, {3.713238376249807*^9, 3.713238376382818*^9}, {
3.713240106429369*^9, 3.71324011953722*^9}, {3.713243170266246*^9,
3.7132431746708183`*^9}},ExpressionUUID->"fc1ca4ab-59d0-4ccf-940f-\
05db2eee8c2f"]
}, Closed]],
Cell[CellGroupData[{
Cell["Block Anchors", "Subsubsection",
CellChangeTimes->{{3.7132312142719193`*^9,
3.713231227671761*^9}},ExpressionUUID->"6e08e079-d0b5-4fe8-91c6-\
c7b602722792"],
Cell[BoxData[{
RowBox[{
RowBox[{
RowBox[{"makeBlockAnchorLocatorGraphic", "[", "\[IndentingNewLine]",
RowBox[{
"locatorManager_", ",", "\[IndentingNewLine]", "obj_", ",",
"\[IndentingNewLine]", "locs_", ",", "\[IndentingNewLine]", "uuids_"}],
"\[IndentingNewLine]", "]"}], ":=", "\[IndentingNewLine]",
RowBox[{"DynamicModule", "[", "\[IndentingNewLine]",
RowBox[{
RowBox[{"{", "dragPos", "}"}], ",", "\[IndentingNewLine]",
RowBox[{"EventHandler", "[", "\[IndentingNewLine]",
RowBox[{
RowBox[{"Dynamic", "[", "\[IndentingNewLine]",
RowBox[{
RowBox[{"Replace", "[",
RowBox[{"obj", ",", "\[IndentingNewLine]",
RowBox[{"Automatic", "\[RuleDelayed]", "\[IndentingNewLine]",
RowBox[{"$defaultLocatorObjects", "[", "\"\<Block\>\"", "]"}]}]}],
"\[IndentingNewLine]", "]"}], "[",
RowBox[{
RowBox[{"Dynamic", "[", "locatorManager", "]"}], ",", "uuids"}],
"]"}], "\[IndentingNewLine]", "]"}], ",", "\[IndentingNewLine]",
RowBox[{"{", "\[IndentingNewLine]",
RowBox[{
RowBox[{"\"\<MouseDown\>\"", "\[RuleDelayed]", "\[IndentingNewLine]",
RowBox[{"If", "[",
RowBox[{
RowBox[{
RowBox[{"locatorManager", "[",
RowBox[{"First", "[", "uuids", "]"}], "]"}], "[",
"\"\<Draggable\>\"", "]"}], ",", "\[IndentingNewLine]",
RowBox[{"dragPos", "=",
RowBox[{"MousePosition", "[", "\"\<Graphics\>\"", "]"}]}]}],
"\[IndentingNewLine]", "]"}]}], ",", "\[IndentingNewLine]",
RowBox[{
"\"\<MouseDragged\>\"", "\[RuleDelayed]", "\[IndentingNewLine]",
RowBox[{"If", "[",
RowBox[{
RowBox[{
RowBox[{"locatorManager", "[",
RowBox[{"First", "[", "uuids", "]"}], "]"}], "[",
"\"\<Draggable\>\"", "]"}], ",", "\[IndentingNewLine]",
RowBox[{"With", "[",
RowBox[{
RowBox[{"{",
RowBox[{"mpos", "=",
RowBox[{"MousePosition", "[", "\"\<Graphics\>\"", "]"}]}],
"}"}], ",", "\[IndentingNewLine]",
RowBox[{"If", "[",
RowBox[{
RowBox[{"ListQ", "@", "mpos"}], ",", "\[IndentingNewLine]",
RowBox[{"If", "[",
RowBox[{
RowBox[{"ListQ", "@", "dragPos"}], ",",
"\[IndentingNewLine]",
RowBox[{
RowBox[{"callAnchorLocatorEvent", "[",
RowBox[{"locatorManager", ",", "\[IndentingNewLine]",
RowBox[{"First", "[", "uuids", "]"}], ",",
"\[IndentingNewLine]", "\"\<Move\>\"", ",",
"\[IndentingNewLine]",
RowBox[{"mpos", "-", "dragPos"}], ",",
"\[IndentingNewLine]", "True", ",", "\[IndentingNewLine]",
"True", ",", "\[IndentingNewLine]", "True"}],
"\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]",
RowBox[{"dragPos", "=", "mpos"}]}]}],
"\[IndentingNewLine]", "]"}]}], "\[IndentingNewLine]",
"]"}]}], "\[IndentingNewLine]", "]"}]}], "\[IndentingNewLine]",
"]"}]}], ",", "\[IndentingNewLine]",
RowBox[{"\"\<MouseUp\>\"", "\[RuleDelayed]", "\[IndentingNewLine]",
RowBox[{"If", "[",
RowBox[{
RowBox[{
RowBox[{"locatorManager", "[",
RowBox[{"First", "[", "uuids", "]"}], "]"}], "[",
"\"\<Draggable\>\"", "]"}], ",", "\[IndentingNewLine]",
RowBox[{"dragPos", "=."}]}], "\[IndentingNewLine]", "]"}]}], ",",
"\[IndentingNewLine]",
RowBox[{"PassEventsDown", "\[Rule]", "True"}]}],
"\[IndentingNewLine]", "}"}]}], "\[IndentingNewLine]", "]"}]}],
"\[IndentingNewLine]", "]"}]}], ";"}], "\[IndentingNewLine]",
RowBox[{"makeBlockAnchorLocatorGraphic", "~", "SetAttributes", "~",
"HoldAllComplete"}]}], "Input",
CellChangeTimes->{{3.7132941117128153`*^9, 3.7132941760893497`*^9}, {
3.713305353326425*^9, 3.713305357116538*^9}, {3.713305420574606*^9,
3.713305422506289*^9},
3.713305569750061*^9},ExpressionUUID->"dd185b2c-a278-4882-812a-\
4d1ee005c5a3"],
Cell[BoxData[{
RowBox[{
RowBox[{"Clear", "[", "makeBlockAnchorLocator", "]"}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"makeBlockAnchorLocator", "[",
RowBox[{
RowBox[{
RowBox[{"Verbatim", "[", "Dynamic", "]"}], "[", "locatorManager_",
"]"}], ",", "\[IndentingNewLine]",
RowBox[{"pts", ":",
RowBox[{"{",
RowBox[{
RowBox[{"{",
RowBox[{"_", ",", "_"}], "}"}], ".."}], "}"}]}], ",",
"\[IndentingNewLine]",
RowBox[{"obj", ":",
RowBox[{"_Function", "|", "Automatic"}], ":", "Automatic"}], ",",
"\[IndentingNewLine]",
RowBox[{"ops___", "?", "OptionQ"}]}], "]"}], ":=", "\[IndentingNewLine]",
RowBox[{"With", "[",
RowBox[{
RowBox[{"{", "\[IndentingNewLine]",
RowBox[{"locs", "=", "\[IndentingNewLine]",
RowBox[{"MapIndexed", "[", "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"makeAnchorLocator", "[", "\[IndentingNewLine]",
RowBox[{
RowBox[{"Dynamic", "[", "locatorManager", "]"}], ",",
"\[IndentingNewLine]", "#", ",", "\[IndentingNewLine]",
"Automatic", ",", "\[IndentingNewLine]",
RowBox[{"\"\<Port\>\"", "\[Rule]",
RowBox[{"First", "[", "#2", "]"}]}], ",", "\[IndentingNewLine]",
RowBox[{"\"\<Type\>\"", "\[Rule]", "\"\<Block\>\""}], ",",
"\[IndentingNewLine]", "ops"}], "\[IndentingNewLine]", "]"}],
"&"}], ",", "\[IndentingNewLine]", "pts"}], "\[IndentingNewLine]",
"]"}]}], "\[IndentingNewLine]", "}"}], ",", "\[IndentingNewLine]",
RowBox[{"With", "[",
RowBox[{
RowBox[{"{",
RowBox[{"uuids", "=",
RowBox[{"First", "/@", "locs"}]}], "}"}], ",", "\[IndentingNewLine]",
RowBox[{
RowBox[{"Map", "[", "\[IndentingNewLine]",
RowBox[{
RowBox[{"Function", "[", "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"locatorManager", "[",
RowBox[{"#", ",", "\"\<Connected\>\""}], "]"}], "=",
"\[IndentingNewLine]",
RowBox[{"DeleteCases", "[",
RowBox[{"uuids", ",", "#"}], "]"}]}], ";"}],
"\[IndentingNewLine]", "]"}], ",", "\[IndentingNewLine]",
"uuids"}], "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]",
RowBox[{"With", "[",
RowBox[{
RowBox[{"{",
RowBox[{"umain", "=",
RowBox[{"First", "[", "uuids", "]"}]}], "}"}], ",",
"\[IndentingNewLine]",
RowBox[{"Map", "[", "\[IndentingNewLine]",
RowBox[{
RowBox[{"Function", "[", "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"locatorManager", "[",
RowBox[{"#", ",", "\"\<Expression\>\""}], "]"}], ":=",
"\[IndentingNewLine]",
RowBox[{"locatorManager", "[",
RowBox[{"umain", ",", "\"\<Expression\>\""}], "]"}]}], ";",
"\[IndentingNewLine]",
RowBox[{
RowBox[{"locatorManager", "[",
RowBox[{"#", ",", "\"\<MetaInformation\>\""}], "]"}], ":=",
"\[IndentingNewLine]",
RowBox[{"locatorManager", "[",
RowBox[{"umain", ",", "\"\<MetaInformation\>\""}], "]"}]}],
";"}], "\[IndentingNewLine]", "]"}], ",", "\[IndentingNewLine]",
RowBox[{"Rest", "@", "uuids"}]}], "\[IndentingNewLine]", "]"}]}],
"\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]",
RowBox[{"With", "[",
RowBox[{
RowBox[{"{", "\[IndentingNewLine]",
RowBox[{"graphic", "=", "\[IndentingNewLine]",
RowBox[{
"makeBlockAnchorLocatorGraphic", "[", "\[IndentingNewLine]",
RowBox[{
"locatorManager", ",", "\[IndentingNewLine]", "obj", ",",
"\[IndentingNewLine]", "locs", ",", "\[IndentingNewLine]",
"uuids"}], "\[IndentingNewLine]", "]"}]}],
"\[IndentingNewLine]", "}"}], ",", "\[IndentingNewLine]",
RowBox[{
RowBox[{"Map", "[", "\[IndentingNewLine]",
RowBox[{
RowBox[{"Function", "[", "\[IndentingNewLine]",
RowBox[{
RowBox[{"locatorManager", "[",
RowBox[{"#", ",", "\"\<BlockGraphics\>\""}], "]"}], "=",
"graphic"}], "\[IndentingNewLine]", "]"}], ",",
"\[IndentingNewLine]", "uuids"}], "\[IndentingNewLine]", "]"}],
";", "\[IndentingNewLine]",
RowBox[{"Prepend", "[",
RowBox[{
RowBox[{"Last", "/@", "locs"}], ",", "graphic"}], "]"}]}]}],
"\[IndentingNewLine]", "]"}]}]}], "\[IndentingNewLine]", "]"}]}],
"\[IndentingNewLine]", "]"}]}], ";"}]}], "Input",
CellChangeTimes->{{3.713227201798317*^9, 3.713227690967429*^9}, {
3.713227812731427*^9, 3.7132278406453247`*^9}, {3.7132282314570017`*^9,
3.713228232017095*^9}, {3.713228847089028*^9, 3.713228852697071*^9}, {
3.71322890481822*^9, 3.713228921040502*^9}, 3.713229025240568*^9, {
3.7132290630946903`*^9, 3.7132290665907097`*^9}, {3.713229232034008*^9,
3.713229235016835*^9}, {3.713229321343973*^9, 3.713229350486541*^9}, {
3.7132294045055428`*^9, 3.713229426126197*^9}, {3.7132295728860807`*^9,
3.713229629361644*^9}, {3.7132296652450457`*^9, 3.7132296679209127`*^9}, {
3.713229711887294*^9, 3.713229803903804*^9}, {3.713229871720335*^9,
3.713229955185218*^9}, {3.713230215280076*^9, 3.713230230823292*^9},
3.713230289556528*^9, {3.713230448603547*^9, 3.713230473362968*^9}, {
3.713230509825856*^9, 3.713230515842642*^9}, {3.713230549044636*^9,
3.713230574691016*^9}, {3.7132307200301037`*^9, 3.713230800108395*^9}, {
3.713230858316209*^9, 3.713230880937529*^9}, {3.7132309464606857`*^9,
3.713230953011409*^9}, {3.7132309906839943`*^9, 3.713231019160523*^9}, {
3.713231067240533*^9, 3.7132311218143883`*^9}, 3.71323227208962*^9, {
3.713232357894129*^9, 3.713232359765841*^9}, {3.713233571699675*^9,
3.7132335724444304`*^9}, 3.7132341863403254`*^9, {3.7132347976927433`*^9,
3.713234799540444*^9}, {3.7132359216926603`*^9, 3.7132359305473146`*^9}, {
3.713236003520735*^9, 3.7132360301281443`*^9}, {3.71323701384239*^9,
3.7132370408549957`*^9}, {3.713237080829969*^9, 3.7132371761872377`*^9}, {
3.713237212521388*^9, 3.7132372630747213`*^9}, {3.713237439113563*^9,
3.713237585919742*^9}, {3.7132376199992437`*^9, 3.713237684136973*^9}, {
3.713237894461072*^9, 3.7132379226734133`*^9}, {3.713238003335374*^9,
3.713238008015836*^9}, {3.713238380451632*^9, 3.713238381450348*^9}, {
3.713240061334852*^9, 3.713240062612836*^9}, {3.713242434819536*^9,
3.71324243594785*^9}, {3.713242696831584*^9, 3.713242699179324*^9},
3.7132427335243196`*^9, {3.7132433920209618`*^9, 3.71324341025111*^9}, {
3.7132435257719803`*^9, 3.713243541112919*^9}, {3.713243592633327*^9,
3.713243593511485*^9}, {3.71327125286485*^9, 3.7132712841849623`*^9}, {
3.713294075128627*^9, 3.71329410606651*^9}, {3.7132941618866787`*^9,
3.7132942371438093`*^9}, {3.7132944494322033`*^9, 3.713294454016251*^9},
3.713294904269929*^9, {3.713325565768618*^9,
3.713325622850185*^9}},ExpressionUUID->"c0366a77-c6c9-4ca3-a17a-\
c6a8a143a680"]
}, Closed]],
Cell[CellGroupData[{
Cell["Line Anchors", "Subsubsection",
CellChangeTimes->{{3.7132312142719193`*^9,
3.71323123227975*^9}},ExpressionUUID->"745a464a-47c7-48c5-b49c-\
a20c62d508ce"],
Cell[BoxData[{
RowBox[{
RowBox[{"Clear", "[", "makeLineAnchorLocator", "]"}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"makeLineAnchorLocator", "[",
RowBox[{
RowBox[{
RowBox[{"Verbatim", "[", "Dynamic", "]"}], "[", "locatorManager_", "]"}],
",", "\[IndentingNewLine]",
RowBox[{"pts", ":",
RowBox[{"{",
RowBox[{
RowBox[{"{",
RowBox[{"_", ",", "_"}], "}"}], ",",
RowBox[{"{",
RowBox[{"_", ",", "_"}], "}"}]}], "}"}]}], ",", "\[IndentingNewLine]",
RowBox[{"obj", ":",
RowBox[{"_Function", "|", "Automatic"}], ":", "Automatic"}], ",",
"\[IndentingNewLine]",
RowBox[{"ops___", "?", "OptionQ"}]}], "]"}], ":=", "\[IndentingNewLine]",
RowBox[{"makeBlockAnchorLocator", "[", "\[IndentingNewLine]",
RowBox[{
RowBox[{"Dynamic", "[", "locatorManager", "]"}], ",",
"\[IndentingNewLine]", "pts", ",", "\[IndentingNewLine]",
RowBox[{"Replace", "[",
RowBox[{"obj", ",", "\[IndentingNewLine]",
RowBox[{"Automatic", "\[RuleDelayed]", "\[IndentingNewLine]",
RowBox[{"Function", "[",
RowBox[{
RowBox[{"$defaultLocatorObjects", "[", "\"\<Line\>\"", "]"}], "[",
"##", "]"}], "]"}]}]}], "\[IndentingNewLine]", "]"}], ",",
"\[IndentingNewLine]",
RowBox[{"\"\<Type\>\"", "\[Rule]", "\"\<Line\>\""}], ",",
"\[IndentingNewLine]", "ops"}], "\[IndentingNewLine]", "]"}]}]}], "Input",\
CellChangeTimes->{{3.713227201798317*^9, 3.713227690967429*^9}, {
3.713227812731427*^9, 3.7132278406453247`*^9}, {3.7132282314570017`*^9,
3.713228232017095*^9}, {3.713228847089028*^9, 3.713228852697071*^9}, {
3.71322890481822*^9, 3.713228921040502*^9}, 3.713229025240568*^9, {
3.7132290630946903`*^9, 3.7132290665907097`*^9}, {3.713229232034008*^9,
3.713229235016835*^9}, {3.713229321343973*^9, 3.713229350486541*^9}, {
3.7132294045055428`*^9, 3.713229426126197*^9}, {3.7132295728860807`*^9,
3.713229629361644*^9}, {3.7132296652450457`*^9, 3.7132296679209127`*^9}, {
3.713229711887294*^9, 3.713229803903804*^9}, {3.713229871720335*^9,
3.713229955185218*^9}, {3.713230215280076*^9, 3.713230230823292*^9},
3.713230289556528*^9, {3.713230448603547*^9, 3.713230473362968*^9}, {
3.713230509825856*^9, 3.713230515842642*^9}, {3.713230549044636*^9,
3.713230574691016*^9}, {3.7132307200301037`*^9, 3.713230800108395*^9}, {
3.713230858316209*^9, 3.713230880937529*^9}, {3.7132309464606857`*^9,
3.713230953011409*^9}, {3.713230994770899*^9, 3.713231064070983*^9}, {
3.713231129942738*^9, 3.713231173473384*^9}, {3.713232363396633*^9,
3.71323236514886*^9}, {3.713233128011938*^9,
3.713233137084429*^9}},ExpressionUUID->"ac6fd530-a003-47c2-a795-\
1697d1be33ee"]
}, Closed]],
Cell[CellGroupData[{
Cell["Set Position", "Subsubsection",
CellChangeTimes->{{3.713232666545225*^9,
3.713232670163343*^9}},ExpressionUUID->"03a00daf-3f21-4b14-8854-\
f2238a76c3a7"],
Cell[BoxData[{
RowBox[{
RowBox[{"Clear", "[", "setAnchorLocatorPositionConnected", "]"}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"setAnchorLocatorPositionConnected", "[",
RowBox[{
"locatorManager_", ",", "\[IndentingNewLine]", "uuid_", ",",
"\[IndentingNewLine]", "pos_", ",", "\[IndentingNewLine]", "shift_", ",",
"\[IndentingNewLine]", "connected_"}], "\[IndentingNewLine]", "]"}], ":=",
"\[IndentingNewLine]",
RowBox[{"With", "[",
RowBox[{
RowBox[{"{",
RowBox[{"shf", "=", "\[IndentingNewLine]",
RowBox[{"If", "[",
RowBox[{
RowBox[{"shift", "//", "TrueQ"}], ",", "\[IndentingNewLine]", "pos",
",", "\[IndentingNewLine]",
RowBox[{"pos", "-",
RowBox[{
RowBox[{"locatorManager", "[", "uuid", "]"}], "[",
"\"\<Position\>\"", "]"}]}]}], "\[IndentingNewLine]", "]"}]}],
"}"}], ",", "\[IndentingNewLine]",
RowBox[{"Map", "[", "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"setAnchorLocatorPosition", "[",
RowBox[{
"locatorManager", ",", "\[IndentingNewLine]", "#", ",",
"\[IndentingNewLine]", "shf", ",", "\[IndentingNewLine]", "True",
",", "\[IndentingNewLine]", "False", ",", "\[IndentingNewLine]",
"True"}], "\[IndentingNewLine]", "]"}], "&"}], ",",
"\[IndentingNewLine]", "connected"}], "\[IndentingNewLine]", "]"}]}],
"\[IndentingNewLine]", "]"}]}], ";"}], "\[IndentingNewLine]",
RowBox[{"setAnchorLocatorPositionConnected", "~", "SetAttributes", "~",
"HoldFirst"}]}], "Input",
CellChangeTimes->{{3.7132421505582333`*^9, 3.713242197554549*^9}, {
3.713242523992565*^9, 3.71324252773424*^9}, {3.713242627044468*^9,
3.713242629308704*^9}},ExpressionUUID->"010d786e-8352-419a-8042-\
e8163d904daa"],
Cell[BoxData[{
RowBox[{
RowBox[{"Clear", "[", "setAnchorLocatorPosition", "]"}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"setAnchorLocatorPosition", "[",
RowBox[{
"locatorManager_", ",", "\[IndentingNewLine]", "uuid_", ",",
"\[IndentingNewLine]", "pos_", ",", "\[IndentingNewLine]", "shift_", ",",
"\[IndentingNewLine]", "moveConnected_", ",", "\[IndentingNewLine]",
"moveBound_"}], "\[IndentingNewLine]", "]"}], ":=",
"\[IndentingNewLine]",
RowBox[{"(", "\[IndentingNewLine]",
RowBox[{
RowBox[{"If", "[",
RowBox[{
RowBox[{
RowBox[{"moveConnected", "&&",
RowBox[{
RowBox[{"locatorManager", "[", "uuid", "]"}], "[",
"\"\<ConnectedMove\>\"", "]"}]}], "//", "TrueQ"}], ",",
"\[IndentingNewLine]",
RowBox[{
RowBox[{"setAnchorLocatorPositionConnected", "[",
RowBox[{
"locatorManager", ",", "\[IndentingNewLine]", "uuid", ",",
"\[IndentingNewLine]", "pos", ",", "\[IndentingNewLine]", "shift",
",", "\[IndentingNewLine]",
RowBox[{
RowBox[{"locatorManager", "[", "uuid", "]"}], "[",
"\"\<Connected\>\"", "]"}]}], "\[IndentingNewLine]", "]"}],
";"}]}], "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]",
RowBox[{"If", "[",
RowBox[{
RowBox[{
RowBox[{"(",
RowBox[{"moveBound", "&&",
RowBox[{
RowBox[{
RowBox[{"locatorManager", "[", "uuid", "]"}], "[", "\"\<Type\>\"",
"]"}], "===", "\"\<Block\>\""}]}], ")"}], "//", "TrueQ"}], ",",
"\[IndentingNewLine]",
RowBox[{
RowBox[{"setAnchorLocatorPositionConnected", "[",
RowBox[{
"locatorManager", ",", "\[IndentingNewLine]", "uuid", ",",
"\[IndentingNewLine]", "pos", ",", "\[IndentingNewLine]", "shift",
",", "\[IndentingNewLine]",
RowBox[{"Select", "[",
RowBox[{
RowBox[{
RowBox[{"locatorManager", "[", "uuid", "]"}], "[",
"\"\<Bound\>\"", "]"}], ",", "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{
RowBox[{"locatorManager", "[", "#", "]"}], "[", "\"\<Type\>\"",
"]"}], "=!=", "\"\<Block\>\""}], "&"}]}],
"\[IndentingNewLine]", "]"}]}], "\[IndentingNewLine]", "]"}],
";"}]}], "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]",
RowBox[{
RowBox[{"If", "[",
RowBox[{
RowBox[{"shift", "//", "TrueQ"}], ",", "\[IndentingNewLine]", "AddTo",
",", "\[IndentingNewLine]", "Set"}], "\[IndentingNewLine]", "]"}],
"[",
RowBox[{
RowBox[{"locatorManager", "[",
RowBox[{"uuid", ",", "\"\<Position\>\""}], "]"}], ",", "pos"}],
"]"}]}], "\[IndentingNewLine]", ")"}]}], ";"}], "\[IndentingNewLine]",
RowBox[{"setAnchorLocatorPosition", "~", "SetAttributes", "~",
"HoldFirst"}]}], "Input",
CellChangeTimes->{{3.713232667459991*^9, 3.7132326995308523`*^9}, {
3.71323360494764*^9, 3.713233627032423*^9}, {3.713234493254407*^9,
3.713234522604314*^9}, {3.713237316680588*^9, 3.7132373726669416`*^9}, {
3.71323740993596*^9, 3.713237413814583*^9}, {3.713237723579142*^9,
3.713237735154428*^9}, {3.71323808502678*^9, 3.713238147054913*^9}, {
3.71323827423212*^9, 3.713238275604363*^9}, {3.713238468826336*^9,
3.71323846904775*^9}, {3.713241999583379*^9, 3.7132420305503197`*^9}, {
3.713242085750393*^9, 3.7132421048210297`*^9}, {3.713242219123752*^9,
3.713242348176128*^9}, {3.713242557422927*^9, 3.7132425806687727`*^9},
3.7132426727576027`*^9, {3.71324333263829*^9,
3.713243357372905*^9}},ExpressionUUID->"9baceb44-06e9-4210-8f69-\
e3dfb54086ff"]
}, Closed]],
Cell[CellGroupData[{
Cell["Call Event", "Subsubsection",
CellChangeTimes->{{3.713231775390699*^9,
3.713231776996914*^9}},ExpressionUUID->"bb6dde4c-961e-4da6-b0bf-\
f59378bba849"],
Cell[BoxData[{
RowBox[{
RowBox[{"Clear", "[", "callAnchorLocatorEvent", "]"}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"callAnchorLocatorEvent", "[",
RowBox[{
"locatorManager_", ",", "\[IndentingNewLine]", "uuid_", ",",
"\[IndentingNewLine]", "event_", ",", "\[IndentingNewLine]", "args___"}],
"\[IndentingNewLine]", "]"}], ":=", "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"locatorManager", "[",
RowBox[{"uuid", ",", "\"\<Events\>\""}], "]"}], "[", "event", "]"}],
"[", "\[IndentingNewLine]",
RowBox[{
"locatorManager", ",", "\[IndentingNewLine]", "uuid", ",",
"\[IndentingNewLine]", "args"}], "]"}]}], ";"}], "\[IndentingNewLine]",
RowBox[{"callAnchorLocatorEvent", "~", "SetAttributes", "~",
"HoldAllComplete"}]}], "Input",
CellChangeTimes->{{3.71323178482367*^9, 3.7132318365567827`*^9}, {
3.7132323687391577`*^9, 3.713232373220827*^9}, {3.7132325570755177`*^9,
3.713232571032836*^9}, {3.7132326247486687`*^9, 3.713232628541559*^9}, {
3.713233632203313*^9, 3.71323363788829*^9}, {3.7132337293421297`*^9,
3.713233734722851*^9}},ExpressionUUID->"99022137-098b-4c6a-9a75-\
8f7afe11e6a0"]
}, Closed]],
Cell[CellGroupData[{
Cell["Update Bound", "Subsubsection",
CellChangeTimes->{{3.7132312142719193`*^9, 3.713231239895584*^9}, {
3.713304290410331*^9,
3.713304291034724*^9}},ExpressionUUID->"ed65552e-dbb7-4884-a85f-\
554fd157775c"],
Cell[BoxData[{
RowBox[{
RowBox[{"Clear", "[", "updateAnchorLocatorBound", "]"}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"updateAnchorLocatorBound", "[",
RowBox[{
"locatorManager_", ",", "\[IndentingNewLine]", "pos_", ",",
"\[IndentingNewLine]", "radii_"}], "\[IndentingNewLine]", "]"}], ":=",
"\[IndentingNewLine]",
RowBox[{"With", "[",
RowBox[{
RowBox[{"{", "\[IndentingNewLine]",
RowBox[{"binds", "=", "\[IndentingNewLine]",
RowBox[{
RowBox[{"KeyValueMap", "[", "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"#", "\[Rule]", "\[IndentingNewLine]",
RowBox[{"Keys", "@", "\[IndentingNewLine]",
RowBox[{"With", "[",
RowBox[{
RowBox[{"{",
RowBox[{
RowBox[{"p", "=", "#2"}], ",",
RowBox[{"r", "=",
RowBox[{"radii", "[", "#", "]"}]}]}], "}"}], ",",
"\[IndentingNewLine]",
RowBox[{"Select", "[",
RowBox[{
RowBox[{
RowBox[{
RowBox[{"Norm", "[",
RowBox[{"#", "-", "p"}], "]"}], "&"}], "/@",
RowBox[{"KeyDrop", "[",
RowBox[{"pos", ",", "#"}], "]"}]}], ",",
"\[IndentingNewLine]",
RowBox[{
RowBox[{"#", "<", "r"}], "&"}]}], "\[IndentingNewLine]",
"]"}]}], "\[IndentingNewLine]", "]"}]}]}], "&"}], ",",
"\[IndentingNewLine]", "pos"}], "\[IndentingNewLine]", "]"}], "//",
"Association"}]}], "\[IndentingNewLine]", "}"}], ",",
"\[IndentingNewLine]",
RowBox[{"KeyValueMap", "[", "\[IndentingNewLine]",
RowBox[{
RowBox[{"Function", "[",
RowBox[{
RowBox[{"locatorManager", "[",
RowBox[{"#", ",", "\"\<Bound\>\""}], "]"}], "=", "#2"}], "]"}], ",",
"\[IndentingNewLine]", "binds"}], "\[IndentingNewLine]", "]"}]}],
"\[IndentingNewLine]", "]"}]}], ";"}], "\[IndentingNewLine]",
RowBox[{"updateAnchorLocatorBound", "~", "SetAttributes", "~",
"HoldFirst"}]}], "Input",
CellChangeTimes->{{3.713229253979273*^9, 3.713229259797985*^9}, {
3.71323118087364*^9, 3.713231195423149*^9}, {3.713231273456266*^9,
3.713231292260737*^9}, {3.713231391152926*^9, 3.7132313990332527`*^9},
3.713232025796075*^9, {3.7132321108869257`*^9, 3.713232110894368*^9}, {
3.713232376611967*^9, 3.7132323784160624`*^9}, {3.713232836499318*^9,
3.713232837330277*^9}, {3.713233039230133*^9,
3.713233041596265*^9}},ExpressionUUID->"c8867a3f-48c2-40de-b050-\
b724956c1128"]
}, Closed]],
Cell[CellGroupData[{
Cell["Update Positions", "Subsubsection",
CellChangeTimes->{{3.7132312142719193`*^9, 3.713231239895584*^9}, {
3.7132321407963*^9,
3.71323214786764*^9}},ExpressionUUID->"07471eec-2c7f-4d8a-8134-\
2b24d36ce381"],
Cell[BoxData[{
RowBox[{
RowBox[{"Clear", "[", "updateAnchorLocatorPositions", "]"}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"updateAnchorLocatorPositions", "[",
RowBox[{
"locatorManager_", ",", "\[IndentingNewLine]", "movableAnchors_"}],
"\[IndentingNewLine]", "]"}], ":=", "\[IndentingNewLine]",
RowBox[{"Map", "[", "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"With", "[",
RowBox[{
RowBox[{"{",
RowBox[{"moveTo", "=",
RowBox[{"locatorManager", "[",
RowBox[{"#", ",", "\"\<Bound\>\""}], "]"}]}], "}"}], ",",
"\[IndentingNewLine]",
RowBox[{"If", "[",
RowBox[{
RowBox[{
RowBox[{"Length", "[", "moveTo", "]"}], ">", "0"}], ",",
"\[IndentingNewLine]",
RowBox[{
RowBox[{"locatorManager", "[",
RowBox[{"#", ",", "\"\<Position\>\""}], "]"}], "=",
"\[IndentingNewLine]",
RowBox[{"Mean", "[", "\[IndentingNewLine]",
RowBox[{"Lookup", "[", "\[IndentingNewLine]",
RowBox[{
RowBox[{"Lookup", "[",
RowBox[{"locatorManager", ",", "moveTo"}], "]"}], ",",
"\[IndentingNewLine]", "\"\<Position\>\""}],
"\[IndentingNewLine]", "]"}], "\[IndentingNewLine]", "]"}]}]}],
"\[IndentingNewLine]", "]"}]}], "\[IndentingNewLine]", "]"}], "&"}],
",", "\[IndentingNewLine]", "movableAnchors"}], "\[IndentingNewLine]",
"]"}]}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
"updateAnchorLocatorPositions", "~", "SetAttributes", "~", "HoldFirst"}],
";"}]}], "Input",
CellChangeTimes->{{3.713231438008128*^9, 3.713231468678978*^9}, {
3.713231880196204*^9, 3.713232084298999*^9}, {3.7132323815493927`*^9,
3.713232383428541*^9}, {3.713232804821047*^9,
3.713232806369892*^9}},ExpressionUUID->"c8216add-9962-4157-9a3e-\
76dfb941a3e8"]
}, Closed]],
Cell[CellGroupData[{
Cell["Update Locators", "Subsubsection",
CellChangeTimes->{{3.713232150491685*^9,
3.7132321536116867`*^9}},ExpressionUUID->"e1d89394-3a7b-42f0-bfd6-\
bc00144a8807"],
Cell[BoxData[{
RowBox[{
RowBox[{"Clear", "[", "updateAnchorLocators", "]"}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"updateAnchorLocators", "[", "locatorManager_", "]"}], ":=",
"\[IndentingNewLine]",
RowBox[{"Module", "[", "\[IndentingNewLine]",
RowBox[{
RowBox[{"{", "\[IndentingNewLine]",
RowBox[{
RowBox[{"pos", "=",
RowBox[{
RowBox[{
RowBox[{"#", "[", "\"\<Position\>\"", "]"}], "&"}], "/@",
"locatorManager"}]}], ",", "\[IndentingNewLine]",
RowBox[{"radii", "=",
RowBox[{
RowBox[{
RowBox[{"#", "[", "\"\<AttractionRadius\>\"", "]"}], "&"}], "/@",
"locatorManager"}]}], ",", "\[IndentingNewLine]",
RowBox[{"movableAnchors", "=", "\[IndentingNewLine]",
RowBox[{"Keys", "@",
RowBox[{"Select", "[",
RowBox[{"locatorManager", ",",
RowBox[{
RowBox[{"MatchQ", "[",
RowBox[{
RowBox[{"#", "[", "\"\<Type\>\"", "]"}], ",",
RowBox[{"\"\<Point\>\"", "|", "\"\<Line\>\""}]}], "]"}],
"&"}]}], "]"}]}]}]}], "\[IndentingNewLine]", "}"}], ",",