()
| 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); |
nothing calls this directly
no test coverage detected