(Vec2 center, MenuSpecification m)
| 313 | } |
| 314 | |
| 315 | public List<Position> show(Vec2 center, MenuSpecification m) { |
| 316 | center.x = (int) center.x; |
| 317 | center.y = (int) center.y; |
| 318 | List<Position> over = new ArrayList<Position>(); |
| 319 | |
| 320 | TextDrawing t = this.find(TextDrawing.textDrawing, both()) |
| 321 | .findFirst() |
| 322 | .orElseThrow(() -> new IllegalArgumentException(" got to be able to draw text to draw a menuSpecs")); |
| 323 | TextDrawing.FontSupport defaultFont = t.getDefaultFont(); |
| 324 | |
| 325 | float scale = 75; |
| 326 | |
| 327 | FLine textLine = new FLine(); |
| 328 | textLine.attributes.put(hasText, true); |
| 329 | double maxHeight = 0; |
| 330 | |
| 331 | |
| 332 | SimpleVoronoi v = new SimpleVoronoi(); |
| 333 | Map<Position, SimpleVoronoi.Pnt> sites = new HashMap<>(); |
| 334 | for (Map.Entry<Position, MenuItem> e : m.items.entrySet()) { |
| 335 | sites.put(e.getKey(), v.add(new Vec2(e.getKey().pos.x * scale, e.getKey().pos.y * scale))); |
| 336 | } |
| 337 | sites.put(null, v.add(new Vec2(0,0))); |
| 338 | |
| 339 | |
| 340 | |
| 341 | |
| 342 | float outset = 10; |
| 343 | |
| 344 | List<Area> areas = new ArrayList<>(); |
| 345 | FLine centerLine = new FLine(); |
| 346 | float cr = 5; |
| 347 | centerLine.rect(center.x - cr, center.y - cr, cr * 2, cr * 2); |
| 348 | this.properties.putToMap(frameDrawing, "center", box -> centerLine); |
| 349 | centerLine.attributes.put(filled, true); |
| 350 | centerLine.attributes.put(fillColor, new Vec4(1, 1, 1, 0.9f)); |
| 351 | centerLine.attributes.put(strokeColor, new Vec4(0, 0, 0, 0.1f)); |
| 352 | |
| 353 | centerLine.attributes.put(filled, true); |
| 354 | |
| 355 | centerLine.attributes.put(layer, "glass2"); |
| 356 | |
| 357 | areas.add(new Area(FLinesAndJavaShapes.flineToJavaShape(centerLine))); |
| 358 | |
| 359 | Map<FLine, FLine> toLabels = new LinkedHashMap<>(); |
| 360 | Map<FLine, FLine> toBoxes = new LinkedHashMap<>(); |
| 361 | |
| 362 | for (Map.Entry<Position, MenuItem> e : m.items.entrySet()) { |
| 363 | textLine.moveTo(center.x + e.getKey().pos.x * scale, center.y + e.getKey().pos.y * scale); |
| 364 | |
| 365 | log("debug.markingmenus", () -> e.getKey() + " " + e.getKey().pos); |
| 366 | |
| 367 | String lab = e.getValue().label; |
| 368 | |
| 369 | if (e.getValue().submenu != null && !lab.endsWith("...")) lab = lab + "..."; |
| 370 | |
| 371 | textLine.node().attributes.put(text, lab); |
| 372 | textLine.attributes.put(layer, "glass2"); |
no test coverage detected