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

Method Drawing

src/main/java/fieldbox/boxes/Drawing.java:80–112  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

78 static int autoDirty = 0;
79
80 public Drawing() {
81 this.properties.putToMap(IO.onPreparingToSave, "__checkWindowSpace__", () -> {
82 System.out.println(" handling window space boxes ");
83
84 Map<Box, Rect> oldFrames = new LinkedHashMap<>();
85
86 this.breadthFirstAll(this.allDownwardsFrom()).forEach(x -> {
87 if (x.properties.has(frame))
88 oldFrames.put(x, x.properties.get(frame).duplicate());
89 });
90
91 updateWindowSpaceBoxes(translation, new Vec2(0, 0), lastDimensions, lastDimensions, scale, new Vec2(1, 1));
92
93 this.properties.putToMap(IO.onFinishingSaving, "__checkWindowSpace__", () -> {
94 RunLoop.main.delayTicks(() -> {
95 System.out.println(" undoing window space boxes ");
96 this.breadthFirstAll(this.allDownwardsFrom()).forEach(x -> {
97 if (oldFrames.containsKey(x))
98 x.properties.put(frame, oldFrames.get(x));
99 });
100 oldFrames.clear();
101 Drawing.dirty(this);
102 }, 1);
103 });
104
105 });
106
107 this.properties.putToMap(Boxes.insideRunLoop, "main.autoDirty", () -> {
108 if (autoDirty-- > 0)
109 dirty(this);
110 return true;
111 });
112 }
113
114 static public boolean intersects(Window.Event<?> event, Box box) {
115 Rect frame = box.properties.get(Box.frame);

Callers

nothing calls this directly

Calls 14

dirtyMethod · 0.95
putToMapMethod · 0.80
breadthFirstAllMethod · 0.80
allDownwardsFromMethod · 0.80
delayTicksMethod · 0.80
duplicateMethod · 0.65
getMethod · 0.65
printlnMethod · 0.45
forEachMethod · 0.45
hasMethod · 0.45
putMethod · 0.45

Tested by

no test coverage detected