(Window.Event<?> event, Box box)
| 112 | } |
| 113 | |
| 114 | static public boolean intersects(Window.Event<?> event, Box box) { |
| 115 | Rect frame = box.properties.get(Box.frame); |
| 116 | if (frame == null) return false; |
| 117 | |
| 118 | Optional<Drawing> drawing = box.find(Drawing.drawing, box.both()) |
| 119 | .findFirst(); |
| 120 | if (!drawing.isPresent()) return false; |
| 121 | |
| 122 | Object o = event.after; |
| 123 | if (o instanceof Window.HasPosition) { |
| 124 | Optional<Vec2> o2 = ((Window.HasPosition) o).position(); |
| 125 | if (!o2.isPresent()) return false; |
| 126 | |
| 127 | return frame.intersects(drawing.get() |
| 128 | .windowSystemToDrawingSystem(o2.get())); |
| 129 | } |
| 130 | |
| 131 | return false; |
| 132 | } |
| 133 | |
| 134 | /** |
| 135 | * call this to request a redraw at the next available animation cycle |
no test coverage detected