(Window.Event<Window.MouseState> e)
| 205 | } |
| 206 | |
| 207 | protected Mouse.Dragger button0(Window.Event<Window.MouseState> e) { |
| 208 | if (!e.after.keyboardState.keysDown.contains(GLFW_KEY_G)) return null; |
| 209 | |
| 210 | Vec2 point = new Vec2(e.after.mx, e.after.my); |
| 211 | |
| 212 | Optional<Box> hit = breadthFirst(both()).filter(b -> frame(b) != null) |
| 213 | .filter(x -> !x.properties.isTrue(Box.hidden, false)) |
| 214 | .filter(b -> frame(b).intersects(point)) |
| 215 | .sorted((a, b) -> Float.compare(order(frame(a)), order(frame(b)))) |
| 216 | .findFirst(); |
| 217 | |
| 218 | if (hit.isPresent()) { |
| 219 | e.properties.put(Window.consumed, true); |
| 220 | |
| 221 | Box origin = hit.get(); |
| 222 | |
| 223 | return new Mouse.Dragger() { |
| 224 | @Override |
| 225 | public boolean update(Window.Event<Window.MouseState> e, boolean termination) { |
| 226 | |
| 227 | Vec2 point = new Vec2(e.after.mx, e.after.my); |
| 228 | |
| 229 | Optional<Box> hit = breadthFirst(both()).filter(x -> !x.properties.isTrue(Box.hidden, false)) |
| 230 | .filter(b -> frame(b) != null) |
| 231 | .filter(b -> frame(b).intersects(point)) |
| 232 | .sorted((a, b) -> Float.compare(order(frame(a)), order(frame(b)))) |
| 233 | .findFirst(); |
| 234 | |
| 235 | if (hit.isPresent() && hit.get() != origin) { |
| 236 | showCompleteDrag(origin, hit.get()); |
| 237 | if (termination) { |
| 238 | completeDrag(origin, hit.get()); |
| 239 | } |
| 240 | } else { |
| 241 | showIncompleteDrag(origin, point, false); |
| 242 | if (termination) { |
| 243 | Dispatch.this.properties.removeFromMap(frameDrawing, "__ongoingDrag__"); |
| 244 | } |
| 245 | } |
| 246 | |
| 247 | |
| 248 | return true; |
| 249 | } |
| 250 | |
| 251 | |
| 252 | }; |
| 253 | } |
| 254 | if (this.properties.removeFromMap(frameDrawing, "__ongoingDrag__") != null | this.properties.removeFromMap(frameDrawing, "__ongoingDrag__2") != null) |
| 255 | Drawing.dirty(this); |
| 256 | |
| 257 | return null; |
| 258 | } |
| 259 | |
| 260 | protected void showIncompleteDrag(Box start, Vec2 to, boolean speculative) { |
| 261 | if (!speculative) |
no test coverage detected