()
| 16 | private float offsetX = 0, offsetY = 0; |
| 17 | |
| 18 | @SneakyThrows |
| 19 | public FigmaScene() { |
| 20 | uiFont = new Font(inter, 11); |
| 21 | uiFont.setSubpixel(true); |
| 22 | metrics.put(uiFont, uiFont.getMetrics()); |
| 23 | |
| 24 | uiFontSmall = new Font(inter, 9); |
| 25 | uiFontSmall.setSubpixel(true); |
| 26 | metrics.put(uiFontSmall, uiFontSmall.getMetrics()); |
| 27 | |
| 28 | try (var medium = FontMgr.getDefault().makeFromFile(file("fonts/InterHinted-Bold.ttf"));) { |
| 29 | uiFontBold = new Font(medium, 11); |
| 30 | uiFontBold.setSubpixel(true); |
| 31 | metrics.put(uiFontBold, uiFontBold.getMetrics()); |
| 32 | } |
| 33 | // Typeface uiTypefaceBold = FontMgr.getDefault().matchFamilyStyle("System Font", FontStyle.BOLD); |
| 34 | |
| 35 | icons.put("Search", new PathBuilder().moveTo(0, 0.5f).rLineTo(14, 0).moveTo(0, 5.5f).rLineTo(14, 0).moveTo(0, 10.5f).rLineTo(14, 0).build()); |
| 36 | icons.put("Move", new PathBuilder().moveTo(0.5f, 0.5f).lineTo(3, 13).lineTo(6, 9).lineTo(11, 7).closePath().build()); |
| 37 | icons.put("Chevron", new PathBuilder().lineTo(3, 3).lineTo(6, 0).build()); |
| 38 | icons.put("Frame", new PathBuilder().moveTo(3.5f, 0).lineTo(3.5f, 16).moveTo(12.5f, 0).lineTo(12.5f, 16).moveTo(0, 3.5f).lineTo(16, 3.5f).moveTo(0, 12.5f).lineTo(16, 12.5f).build()); |
| 39 | icons.put("Rectangle", new PathBuilder().addRect(Rect.makeXYWH(0.5f, 0.5f, 15, 15)).build()); |
| 40 | icons.put("Pen Stroke", new PathBuilder().lineTo(2.5f, 9).rCubicTo(1, 3, 3, 3, 6.5f, 3).lineTo(11, 14).lineTo(14, 11).lineTo(12, 9).rCubicTo(0, -3.5f, 0, -5.5f, -3, -6.5f).lineTo(0, 0).moveTo(0, 0).lineTo(6, 6).build()); |
| 41 | icons.put("Pen Fill", new PathBuilder().addCircle(7, 7, 1.5f).build()); |
| 42 | icons.put("Text", new PathBuilder().moveTo(0, 4).lineTo(0, 0.5f).lineTo(12.5f, 0.5f).lineTo(12.5f, 4).moveTo(6.5f, 0.5f).lineTo(6.5f, 15.5f).moveTo(3, 15.5f).rLineTo(7, 0).build()); |
| 43 | icons.put("Hand Tool", new PathBuilder().moveTo(4.5f, 11).lineTo(2.5f, 10).rCubicTo(-2f, -1f, -3.5f, 1f, -2f, 2.5f).cubicTo(1f, 13f, 7f, 19.5f, 9f, 19.5f).lineTo(12, 19.5f).rCubicTo(2f, 0f, 4.5f, -2.5f, 4.5f, -5f).lineTo(16.5f, 6).rCubicTo(0, -2, -3, -2, -3, 0).lineTo(13.5f, 9).lineTo(13.5f, 3).rCubicTo(0, -2, -3, -2, -3, 0).lineTo(10.5f, 9).lineTo(10.5f, 2).rCubicTo(0, -2, -3, -2, -3, 0).lineTo(7.5f, 9).lineTo(7.5f, 4).rCubicTo(0, -2, -3, -2, -3, 0).closePath().build()); |
| 44 | icons.put("Comments", new PathBuilder().moveTo(0, 15.5f).lineTo(5.5f, 14.36f).cubicTo(6.54f, 15.19f, 7.74f, 15.5f, 9, 15.5f).cubicTo(13.14f, 15.5f, 16.5f, 12.14f, 16.5f, 8f).cubicTo(16.5f, 3.86f, 13.14f, 0.5f, 9, 0.5f).cubicTo(4.86f, 0.5f, 1.5f, 3.86f, 1.5f, 8).cubicTo(1.5f, 9.26f, 1.81f, 10.46f, 2.37f, 11.5f).closePath().build()); |
| 45 | icons.put("Reset", new PathBuilder().moveTo(28.5f, 19.5f).lineTo(20.5f, 11.5f).lineTo(12.5f, 19.5f).lineTo(20.5f, 27.5f).lineTo(24.5f, 23.5f).moveTo(21, 17).lineTo(18.5f, 19.5f).lineTo(21, 22).moveTo(18.5f, 19.5f).lineTo(22, 19.5f).cubicTo(26, 19.5f, 29.5f, 24.5f, 26, 29).build()); |
| 46 | icons.put("Component", new PathBuilder().moveTo(23, 15).rLineTo(-3, -3).rLineTo(-3, 3).rLineTo(3, 3).closePath().moveTo(18, 20).rLineTo(-3, -3).rLineTo(-3, 3).rLineTo(3, 3).closePath().moveTo(23, 25).rLineTo(-3, -3).rLineTo(-3, 3).rLineTo(3, 3).closePath().moveTo(28, 20).rLineTo(-3, -3).rLineTo(-3, 3).rLineTo(3, 3).closePath().build()); |
| 47 | icons.put("Mask Stroke", new PathBuilder().addCircle(20, 20, 7.5f).build()); |
| 48 | icons.put("Mask Fill", new PathBuilder().moveTo(16.75f, 13.24f).cubicTo(14.24f, 14.45f, 12.5f, 17.02f, 12.5f, 20).cubicTo(12.5f, 22.98f, 14.24f, 25.55f, 16.75f, 26.76f).cubicTo(19.26f, 25.55f, 21, 22.98f, 21, 20).cubicTo(21, 17.02f, 19.26f, 14.45f, 16.75f, 13.24f).build()); |
| 49 | icons.put("Union", new PathBuilder().moveTo(13, 12).lineTo(13, 23).lineTo(18, 23).lineTo(18, 28).lineTo(29, 28).lineTo(29, 17).lineTo(24, 17).lineTo(24, 12).closePath().build()); |
| 50 | avatar = Image.makeDeferredFromEncodedBytes(Files.readAllBytes(java.nio.file.Path.of(file("images/IMG_5563.png")))); |
| 51 | icons.put("Present", new PathBuilder().moveTo(15.5f, 15).lineTo(15.5f, 25).lineTo(23, 20).closePath().build()); |
| 52 | icons.put("Layer Frame", new PathBuilder().moveTo(3.5f, 0.5f).lineTo(3.5f, 11.5f).moveTo(8.5f, 0.5f).lineTo(8.5f, 11.5f).moveTo(0.5f, 3.5f).lineTo(11.5f, 3.5f).moveTo(0.5f, 8.5f).lineTo(11.5f, 8.5f).build()); |
| 53 | icons.put("Layer Image", new PathBuilder().addRRect(RRect.makeXYWH(0.5f, 0.5f, 11, 11, 1)).addCircle(8, 4, 1.5f).moveTo(0.5f, 8.5f).lineTo(3.5f, 5.5f).lineTo(9.5f, 11.5f).build()); |
| 54 | icons.put("Layer Rect", new PathBuilder().addRect(Rect.makeLTRB(1.5f, 4, 10.5f, 8)).build()); |
| 55 | icons.put("Layer Comp", new PathBuilder().moveTo(6, 0.5f).lineTo(11.5f, 6).lineTo(6, 11.5f).lineTo(0.5f, 6).closePath().build()); |
| 56 | icons.put("Align Left Stroke", new PathBuilder().moveTo(2.5f, 1.5f).lineTo(2.5f, 14.5f).build()); |
| 57 | icons.put("Align Left Fill", new PathBuilder().addRect(Rect.makeLTRB(5, 4.5f, 15, 6.5f)).addRect(Rect.makeLTRB(5, 9.5f, 11, 11.5f)).build()); |
| 58 | icons.put("Align Center Stroke", new PathBuilder().moveTo(8, 1.5f).lineTo(8, 14.5f).build()); |
| 59 | icons.put("Align Center Fill", new PathBuilder().addRect(Rect.makeLTRB(2.5f, 4.5f, 13.5f, 6.5f)).addRect(Rect.makeLTRB(4.5f, 9.5f, 11, 11.5f)).build()); |
| 60 | icons.put("Align Right Stroke", new PathBuilder().moveTo(14.5f, 1.5f).lineTo(14.5f, 14.5f).build()); |
| 61 | icons.put("Align Right Fill", new PathBuilder().addRect(Rect.makeLTRB(2, 4.5f, 12, 6.5f)).addRect(Rect.makeLTRB(6, 9.5f, 12, 11.5f)).build()); |
| 62 | icons.put("Align Top Stroke", new PathBuilder().moveTo(1.5f, 2.5f).lineTo(14.5f, 2.5f).build()); |
| 63 | icons.put("Align Top Fill", new PathBuilder().addRect(Rect.makeLTRB(4.5f, 5f, 6.5f, 15f)).addRect(Rect.makeLTRB(9.5f, 5f, 11.5f, 11f)).build()); |
| 64 | icons.put("Align Middle Stroke", new PathBuilder().moveTo(1.5f, 8f).lineTo(14.5f, 8f).build()); |
| 65 | icons.put("Align Middle Fill", new PathBuilder().addRect(Rect.makeLTRB(4.5f, 2.5f, 6.5f, 13.5f)).addRect(Rect.makeLTRB(9.5f, 4.5f, 11.5f, 11.5f)).build()); |
| 66 | icons.put("Align Bottom Stroke", new PathBuilder().moveTo(1.5f, 14.5f).lineTo(14.5f, 14.5f).build()); |
| 67 | icons.put("Align Bottom Fill", new PathBuilder().addRect(Rect.makeLTRB(4.5f, 2f, 6.5f, 12f)).addRect(Rect.makeLTRB(9.5f, 6f, 11.5f, 12f)).build()); |
| 68 | icons.put("Align More Stroke", new PathBuilder().moveTo(2.5f, 1.5f).lineTo(2.5f, 14.5f).moveTo(13.5f, 1.5f).lineTo(13.5f, 14.5f).build()); |
| 69 | icons.put("Align More Fill", new PathBuilder().addRect(Rect.makeLTRB(7, 4.5f, 9, 11.5f)).build()); |
| 70 | |
| 71 | icons.put("Angle", new PathBuilder().moveTo(4.5f, 4).lineTo(4.5f, 11.5f).lineTo(12, 11.5f).moveTo(4.5f, 7.5f).cubicTo(7, 7.5f, 8.5f, 9, 8.5f, 11.5f).build()); |
| 72 | icons.put("Radius", new PathBuilder().moveTo(13, 4.5f).lineTo(9f, 4.5f).cubicTo(6.5f, 4.5f, 4.5f, 6.5f, 4.5f, 9f).lineTo(4.5f, 13).build()); |
| 73 | icons.put("Constrain", new PathBuilder().moveTo(10.5f, 6f).lineTo(10.5f, 4f).cubicTo(10.5f, 2.62f, 9.38f, 1.5f, 8f, 1.5f).cubicTo(6.62f, 1.5f, 5.5f, 2.62f, 5.5f, 4).lineTo(5.5f, 6).moveTo(5.5f, 10).lineTo(5.5f, 12).cubicTo(5.5f, 13.38f, 6.62f, 14.5f, 8, 14.5f).cubicTo(9.38f, 14.5f, 10.5f, 13.38f, 10.5f, 12).lineTo(10.5f, 10).build()); |
| 74 | icons.put("Corners", new PathBuilder().moveTo(6, 3.5f).lineTo(3.5f, 3.5f).lineTo(3.5f, 6).moveTo(3.5f, 10).lineTo(3.5f, 12.5f).lineTo(6, 12.5f).moveTo(10, 12.5f).lineTo(12.5f, 12.5f).lineTo(12.5f, 10).moveTo(12.5f, 6).lineTo(12.5f, 3.5f).lineTo(10, 3.5f).build()); |
| 75 | icons.put("Unchecked", new PathBuilder().addRRect(RRect.makeXYWH(2.5f, 2.5f, 11, 11, 2)).build()); |
nothing calls this directly
no test coverage detected