(List<Pair<Box, Rect>> frames, Vec2 start, Window.Event<Window.MouseState> initiation)
| 227 | return MarkingMenus.runMenu(box, point, menuSpec); |
| 228 | } |
| 229 | |
| 230 | return null; |
| 231 | } |
| 232 | |
| 233 | private Mouse.Dragger chordAt(List<Pair<Box, Rect>> frames, Vec2 start, Window.Event<Window.MouseState> initiation) { |
| 234 | |
| 235 | boolean[] once = {false}; |
| 236 | |
| 237 | |
| 238 | this.properties.putToMap(StatusBar.statuses, "__chordfeedback__", |
| 239 | () -> "Drag to start multiple boxes"); |
| 240 | |
| 241 | return (e, end) -> { |
| 242 | |
| 243 | Vec2 point = new Vec2(e.after.mx, e.after.my); |
| 244 | chordOver(frames, start, point, end); |
| 245 | |
| 246 | if (end && !once[0]) { |
| 247 | |
| 248 | List<Triple<Vec2, Float, Box>> intersections = intersectionsFor( |
| 249 | frames, start, point); |
| 250 | |
| 251 | intersections = intersections.stream().filter(x -> x != null).filter(x -> x.third != null).sorted((a, b) -> Double.compare(a.second, b.second)).collect(Collectors |
| 252 | .toList()); |
| 253 | |
| 254 | once[0] = true; |
| 255 | |
| 256 | List<Triple<Vec2, Float, Box>> finalIntersections = intersections; |
| 257 | for (int i = 0; i < finalIntersections.size(); i++) { |
| 258 | int finalI = i; |
| 259 | RunLoop.main.delayTicks(() -> { |
| 260 | if (finalIntersections.get(finalI) == null) return; |
| 261 | |
| 262 | Box b = finalIntersections.get(finalI).third; |
| 263 | |
| 264 | Vec2 p = finalIntersections.get(finalI).first; |
| 265 | |
| 266 | fieldlinker.AsMap in = Initiators.get(b, () -> p.x, () -> p.y); |
| 267 | |
| 268 | Execution exec = RemoteEditor.getExecution(b, Execution.code); |
| 269 | if (exec != null) |
| 270 | exec.support(b, Execution.code).begin(b, Collections.singletonMap("_t", in)); |
| 271 | |
| 272 | // b.first(Execution.execution) |
| 273 | // .ifPresent(x -> x.support(b, Execution.code) |
| 274 | // .begin(b, Collections.singletonMap("_t", in))); |
| 275 | }, i); |
| 276 | } |
| 277 | |
| 278 | long count = intersections.stream() |
| 279 | .filter(x -> x != null) |
| 280 | .count(); |
| 281 | |
| 282 | this.properties.putToMap(StatusBar.statuses, "__chordfeedback__", |
| 283 | () -> "Drag started " + (count == 0 ? "" : (count == 1 ? "this " : "these ") + count + " box" + (count == 1 ? "" : "es"))); |
| 284 | |
| 285 | RunLoop.main.delay( |
| 286 | () -> this.properties.removeFromMap(StatusBar.statuses, |
no test coverage detected