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

Method newBoxPair

src/main/java/fieldbox/boxes/plugins/BoxPair.java:251–279  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

249
250
251 public void newBoxPair()
252 {
253 salt ++;
254
255 Box b1 = new Box();
256 Box b2 = new Box();
257
258 b1.connect(b2);
259 root.connect(b1);
260 b1.properties.put(Box.name, "Untitled");
261 b2.properties.put(Box.name, "");
262
263 FieldBoxWindow window = root.find(Boxes.window, root.both()).findFirst().get();
264 Window.MouseState mouse = window.getCurrentMouseState();
265
266
267 double cx = mouse.mx;
268 double cy = mouse.my;
269 b1.properties.put(Box.frame, new Rect(cx-w/2, cy-h/2, w, h));
270 b2.properties.put(Box.frame, new Rect(cx-w/2, cy+gap, w, h/3));
271
272 b1.properties.put(f, b2);
273 b2.properties.put(m, b1);
274
275 b1.properties.put(isPaired, true);
276 b2.properties.put(isPaired, true);
277
278 b2.properties.put(FrameManipulation.lockHeight, true);
279 }
280}

Callers 1

BoxPairMethod · 0.95

Calls 7

connectMethod · 0.95
getCurrentMouseStateMethod · 0.80
getMethod · 0.65
connectMethod · 0.45
putMethod · 0.45
findMethod · 0.45
bothMethod · 0.45

Tested by

no test coverage detected