| | |
| | | private static final Color HANDHELD_BOUNDARY_FILL = new Color(51, 153, 255, 60); |
| | | private static final Color HANDHELD_BOUNDARY_BORDER = new Color(0, 100, 0, 220); |
| | | private static final Color HANDHELD_BOUNDARY_POINT = new Color(0, 100, 0); |
| | | private static final double BASE_WORLD_MARKER_SIZE = 0.27d; // halve the base diameter for subtler markers |
| | | private static final double MIN_PIXEL_DIAMETER = 3.0d; |
| | | private static final double MAX_PIXEL_DIAMETER = 9.0d; |
| | | private static volatile double cachedMarkerPixelDiameter = -1.0d; |
| | | |
| | | private adddikuaiyulan() { |
| | | } |
| | |
| | | public static void drawPreview(Graphics2D g2d, |
| | | List<Point2D.Double> previewPoints, |
| | | double scale, |
| | | boolean previewActive) { |
| | | boolean previewActive, |
| | | double diameterScale) { |
| | | if (!previewActive) { |
| | | cachedMarkerPixelDiameter = -1.0d; |
| | | } |
| | | |
| | | if (g2d == null || !previewActive || previewPoints == null || previewPoints.isEmpty()) { |
| | | return; |
| | | } |
| | |
| | | g2d.fill(path); |
| | | } |
| | | |
| | | float outlineWidth =0.1f; |
| | | float outlineWidth = 0.1f; |
| | | g2d.setStroke(new BasicStroke(outlineWidth, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND)); |
| | | g2d.setColor(HANDHELD_BOUNDARY_BORDER); |
| | | g2d.draw(path); |
| | | |
| | | double markerSize = 0.2d; |
| | | double markerRadius = markerSize / 2.0d; |
| | | if (cachedMarkerPixelDiameter <= 0.0d) { |
| | | double previousPixelDiameter = Math.abs(BASE_WORLD_MARKER_SIZE * scale); |
| | | if (previousPixelDiameter <= 0.0d) { |
| | | previousPixelDiameter = MIN_PIXEL_DIAMETER; |
| | | } |
| | | cachedMarkerPixelDiameter = Math.max(MIN_PIXEL_DIAMETER, |
| | | Math.min(MAX_PIXEL_DIAMETER, previousPixelDiameter)); |
| | | } |
| | | |
| | | double effectiveScale = Math.max(0.01d, scale); |
| | | double markerSize = cachedMarkerPixelDiameter / effectiveScale; |
| | | double normalizedScale = Double.isFinite(diameterScale) && diameterScale > 0.0d ? diameterScale : 1.0d; |
| | | markerSize *= normalizedScale; |
| | | double markerRadius = markerSize / 2.0d; |
| | | |
| | | for (Point2D.Double point : previewPoints) { |
| | | if (point == null || !Double.isFinite(point.x) || !Double.isFinite(point.y)) { |