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

Method update

src/main/java/fieldbox/boxes/plugins/Dispatch.java:224–249  ·  view source on GitHub ↗
(Window.Event<Window.MouseState> e, boolean termination)

Source from the content-addressed store, hash-verified

222
223 return new Mouse.Dragger() {
224 @Override
225 public boolean update(Window.Event<Window.MouseState> e, boolean termination) {
226
227 Vec2 point = new Vec2(e.after.mx, e.after.my);
228
229 Optional<Box> hit = breadthFirst(both()).filter(x -> !x.properties.isTrue(Box.hidden, false))
230 .filter(b -> frame(b) != null)
231 .filter(b -> frame(b).intersects(point))
232 .sorted((a, b) -> Float.compare(order(frame(a)), order(frame(b))))
233 .findFirst();
234
235 if (hit.isPresent() && hit.get() != origin) {
236 showCompleteDrag(origin, hit.get());
237 if (termination) {
238 completeDrag(origin, hit.get());
239 }
240 } else {
241 showIncompleteDrag(origin, point, false);
242 if (termination) {
243 Dispatch.this.properties.removeFromMap(frameDrawing, "__ongoingDrag__");
244 }
245 }
246
247
248 return true;
249 }
250
251
252 };

Callers

nothing calls this directly

Calls 13

frameMethod · 0.95
orderMethod · 0.95
showCompleteDragMethod · 0.95
completeDragMethod · 0.95
showIncompleteDragMethod · 0.95
breadthFirstMethod · 0.80
isTrueMethod · 0.80
isPresentMethod · 0.80
removeFromMapMethod · 0.80
getMethod · 0.65
bothMethod · 0.45
intersectsMethod · 0.45

Tested by

no test coverage detected