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

Method drawNow

src/main/java/fieldbox/boxes/Drawing.java:605–654  ·  view source on GitHub ↗
(Box root)

Source from the content-addressed store, hash-verified

603 public boolean freezeDraw = false;
604
605 public void drawNow(Box root) {
606 Boolean q = root.properties.remove(needRepaint);
607 if (q == null || !q) return;
608
609 if (freezeDraw) return;
610
611 drawCount++;
612
613
614 find(Boxes.window, both()).findFirst()
615 .ifPresent(x -> {
616 nextDimensions = new Vec2(x.getWidth(), x.getHeight());
617 });
618
619 if (translationNext != null || (lastDimensions != null && !Util.safeEq(lastDimensions, nextDimensions)) || scaleNext != null) {
620 updateWindowSpaceBoxes(translation, translationNext == null ? translation : translationNext, lastDimensions == null ? nextDimensions : lastDimensions, nextDimensions, scale,
621 scaleNext == null ? scale : scaleNext);
622
623 translation.x = (translationNext == null ? translation : translationNext).x;
624 translation.y = (translationNext == null ? translation : translationNext).y;
625 translationNext = null;
626
627 scale.x = (scaleNext == null ? scale : scaleNext).x;
628 scale.y = (scaleNext == null ? scale : scaleNext).y;
629 scaleNext = null;
630
631 }
632
633 try (AutoCloseable ignored = closeable(bracketableList)) {
634 insideDrawing = true;
635 root.find(drawers, root.both())
636 .collect(Collectors.toList())
637 .stream()
638 .flatMap(x -> x.stream()).collect(Collectors.toList()) // avoid concurrent modification
639 .stream()
640 .forEach(x -> x.draw(this));
641 } catch (Exception e) {
642 System.err.println(" exception thrown during drawing ");
643 e.printStackTrace();
644 } finally {
645 insideDrawing = false;
646 }
647
648 find(Boxes.window, both()).findFirst()
649 .ifPresent(x -> {
650 lastDimensions = new Vec2(x.getWidth(), x.getHeight());
651 });
652
653
654 }
655
656
657 private void lateDrawNow(Box root) {

Callers 1

installMethod · 0.95

Calls 13

safeEqMethod · 0.95
closeableMethod · 0.80
collectMethod · 0.80
drawMethod · 0.65
removeMethod · 0.45
findMethod · 0.45
bothMethod · 0.45
getWidthMethod · 0.45
getHeightMethod · 0.45
forEachMethod · 0.45
streamMethod · 0.45

Tested by

no test coverage detected