MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / Dispatch

Method Dispatch

src/main/java/fieldbox/boxes/plugins/Dispatch.java:42–128  ·  view source on GitHub ↗
(Box root)

Source from the content-addressed store, hash-verified

40 long allFrameHashSalt = 0;
41
42 public Dispatch(Box root) {
43 this.root = root;
44 this.properties.put(Planes.plane, "__always__");
45 this.properties.putToMap(Mouse.onMouseDown, "__dispatch__", this);
46 this.properties.putToMap(Mouse.onMouseMove, "__dispatch__", this);
47 this.properties.putToMap(Keyboard.onKeyDown, "__dispatch__", this);
48
49 this.properties.putToMap(FLineDrawing.frameDrawing, "__allTopology__", FrameChangedHash.getCached(this,
50 (b, was) -> {
51
52 FLine f = new FLine();
53
54 breadthFirst(both()).filter(x -> x.properties.has(Box.frame))
55 .filter(x -> !x.properties.isTrue(
56 Box.hidden, false))
57 .forEach(x -> {
58 if (Planes.on(root, x) < 1) return;
59 if (x.properties.isTrue(shyConnections, false))
60 return;
61
62 int n = 0;
63 for (Box x2 : new ArrayList<>(x.children())) {
64 if (x2.properties.has(Box.frame) && Planes.on(root, x2) >= 1 && (!x2.properties.isTrue(shyConnections, false))) {
65
66
67 ensureBox(x, x2);
68
69 if (n++ > 25)
70 break; // TODO: indicate that we're giving up making boxes for things with more than 25 children
71 }
72
73 }
74
75 });
76
77 return f;
78
79// }, b -> allFrameHash()));
80 }, () -> allFrameHashSalt));
81 this.properties.putToMap(FLineDrawing.frameDrawing, "__allTopologySelected__", FrameChangedHash.getCached(this, (b, was) -> {
82
83 FLine f = new FLine();
84
85 breadthFirst(both()).filter(x -> x.properties.has(Box.frame))
86 .filter(x -> !x.properties.isTrue(Box.hidden, false))
87 .filter(x -> x.properties.isTrue(Mouse.isSelected, false))
88 .forEach(x -> {
89 if (x.disconnected) return;
90 if (Planes.on(root, x) < 1) return;
91 if (x instanceof DispatchBox) return;
92
93 int n = 0;
94 for (Box x2 : new ArrayList<>(x.children())) {
95 if (x2 instanceof DispatchBox) continue;
96 if (x2.properties.has(Box.frame) && x2.properties.has(Box.name) && x2.properties.get(Box.name).trim().length() > 0 && !x2.disconnected && Planes.on
97 (root, x2) >= 1 && !x2.properties.isTrue(Box.hidden, false) && (x2.properties.isTrue(Mouse.isSelected, false) || !x2.properties.isTrue
98 (shyConnections, false))) {
99 float d1 = x.properties.getFloat(Box.depth, 0f);

Callers

nothing calls this directly

Calls 15

getCachedMethod · 0.95
onMethod · 0.95
ensureBoxMethod · 0.95
arcMethod · 0.95
putToMapMethod · 0.80
breadthFirstMethod · 0.80
isTrueMethod · 0.80
childrenMethod · 0.80
getFloatMethod · 0.80
putAllMethod · 0.80
parentsMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected