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

Method chordOver

src/main/java/fieldbox/boxes/plugins/Chorder.java:297–402  ·  view source on GitHub ↗
(List<Pair<Box, Rect>> frames, Vec2 start, Vec2 end, boolean termination)

Source from the content-addressed store, hash-verified

295 }
296
297 protected float order(Rect r) {
298 return Math.abs(r.w) + Math.abs(r.h);
299 }
300
301 private void chordOver(List<Pair<Box, Rect>> frames, Vec2 start, Vec2 end, boolean termination) {
302
303
304 properties.putToMap(frameDrawing, "__feedback__chorder", expires(box -> {
305 FLine f = new FLine();
306 f.moveTo(start.x, start.y, 0);
307 f.lineTo(end.x, end.y, 0);
308 f.attributes.put(color, new Vec4(0.5f, 0.95f, 0.6f, 0.15f));
309 f.attributes.put(thicken, new BasicStroke(3.5f));
310 f.attributes.put(layer, "__main__.fast");
311
312 return f;
313 }, termination ? 50 : -1));
314 properties.putToMap(frameDrawing, "__feedback__chorderC", expires(box -> {
315 FLine f = new FLine();
316 f.moveTo(start.x, start.y, 0);
317 f.lineTo(end.x, end.y, 0);
318 f.attributes.put(color, new Vec4(0.5f, 0.95f, 0.6f, 0.5f));
319 f.attributes.put(thicken, new BasicStroke(1.5f));
320 f.attributes.put(layer, "__main__.fast");
321
322 return f;
323 }, termination ? 50 : -1));
324
325 List<Triple<Vec2, Float, Box>> i = intersectionsFor(frames, start, end);
326
327 long count = i.stream()
328 .filter(x -> x != null)
329 .count();
330 if (count > 0) this.properties.putToMap(StatusBar.statuses, "__chordfeedback__",
331 () -> "Release to start " + (count == 0 ? "" : (count == 1 ? "this " : "these ") + count + " box" + (count == 1 ? "" : "es")));
332 else this.properties.putToMap(StatusBar.statuses, "__chordfeedback__",
333 () -> "Drag to start multiple boxes");
334
335 properties.putToMap(frameDrawing, "__feedback__chorderbox", expires(box -> {
336
337 FLine f = new FLine();
338
339 i.stream()
340 .filter(x -> x != null)
341 .forEach((x) -> {
342
343 Rect fr = frame(x.third);
344
345 f.rect(fr.x, fr.y, fr.w, fr.h).depthTo(x.third);
346
347 });
348
349 f.attributes.put(strokeColor, new Vec4(0.5f, 0.75f, 0.5f, -0.5f));
350 f.attributes.put(thicken, new BasicStroke(10.5f));
351 f.attributes.put(layer, "__main__.fast");
352
353 return f;
354

Callers 1

chordAtMethod · 0.95

Calls 15

moveToMethod · 0.95
lineToMethod · 0.95
intersectionsForMethod · 0.95
frameMethod · 0.95
rectMethod · 0.95
normalizeMethod · 0.95
dirtyMethod · 0.95
putToMapMethod · 0.80
expiresMethod · 0.80
countMethod · 0.80
depthToMethod · 0.80
getFloatMethod · 0.80

Tested by

no test coverage detected