Developers/Graphics JS/Components/Approach fairway arcs

Smart Component 24

Approach fairway arcs.

Approach fairway arcs accepts normalized club targets and resolves every distanceYards value as a true metric radius around the green. The protected resolver selects the first outward centerline crossing, the fairway polygon containing that crossing, and the outermost boundary intersections bracketing the centerline. Club and plays-like values are display-only and never alter geometry.

type: "approach-fairway-arcs"component: caddie-approach-fairway-arcsProtected placement

Usage

Add the approach fairway arcs to a graphic.

Include the component in the initial mount call, reconcile it through view.setSmartComponents, or append it with view.addSmartComponent. Types may repeat. Give repeated instances stable id values to style, show, hide, move, reset, or remove one instance independently. The selected Smart Component type, instance ID, render receipt, and protected selection options such as yardages, grid spacing, coverage, measured origin, buffer distance, detail, limits, or targets are sent to the overlay service. Marker-image origins, images, presentation styles, supported labels, and movement remain local.

await view.setSmartComponents([
  {
    type: "approach-fairway-arcs",
    targets: [
      { club: "9i", distanceYards: 120, playsLikeYards: 123 },
      { club: "7i", distanceYards: 140, playsLikeYards: 143 },
    ],
    fairwayBuffer: { distance: 15, unit: "yards" },
    selection: {
      interval: 2,
      preserveShortest: true,
      preserveLongest: true,
      minimumLabelSpacing: 18,
    },
    labels: { clubSide: "auto", playsLikeSide: "opposite" },
  },
]);

Defaults

Built-in presentation.

SubjectsHole · Green
OriginGreen center
GeometryTrue radius · connected fairway
Club selectionEvery other · shortest/longest protected
LabelsClub edge · plays-like opposite
Reference scale350px wide

Component options

Configure behavior and presentation.

OptionTypeDefaultDescription
type"approach-fairway-arcs"RequiredRequests protected club approach arcs for a Hole or Green graphic.
idstringAutomaticOptional stable 1–64 character instance ID using letters, numbers, underscores, or hyphens. Use IDs to independently control repeated Smart Components of the same type.
targetsApproachFairwayArcTarget[]RequiredOne through 12 already-normalized club targets. distanceYards controls the physical radius; playsLikeYards is optional display-only text.
fairwayBuffer{ distance: number; unit?: "yards" | "meters" }No bufferApplies a signed -100 through 100 yard or meter offset before resolving radial intersections. Positive expands every edge and negative contracts every edge. Unit defaults to yards.
selection.intervalnumber2Retains every nth distance-sorted club after always considering the shortest and longest preservation rules.
selection.preserveShortestbooleantrueRetains the shortest approach reference.
selection.preserveLongestbooleantrueReplaces the final selected intermediate club when necessary to retain the longest club.
selection.minimumLabelSpacingnumber18Minimum same-side label separation at the 350px reference width. Collision thinning preserves the shortest and attempts to retain the longest arc.
labels.clubSide"auto" | "left" | "right""auto"Uses one shared club-label side. Auto compares median left and right endpoint clearance and resolves exact ties to the right.
labels.playsLikeSide"opposite""opposite"Places each available plays-like value on the edge opposite the club label.
style.strokeColorGraphicColor"#5A7A5C"Dark segment, leader, endpoint, and label color.
style.alternateStrokeColorGraphicColor"rgba(255, 255, 255, 0.96)"Contrast color used for complementary dash segments between the primary-color segments; no continuous under-stroke is drawn.
style.strokeWidthnumber1.55Stroke width at the 350px reference width; it scales uniformly with graphic width.
style.dashLengthnumber2.6One shared dash length for every arc and leader at the 350px reference width.
style.dashGapnumber2.6One shared dash gap for every arc and leader at the 350px reference width.
style.endpoint"dot" | "none""dot"Shows or hides the small fairway/leader junction dots.
style.labelSizenumber14.5Club and plays-like label size at the 350px reference width.
style.labelColorGraphicColor"#5A7A5C"Club and plays-like label fill.
style.labelOutlineColorGraphicColor"rgba(255, 255, 255, 0.96)"Substantial contrast outline behind both label types.
style.labelOutlineWidthnumber4.25Label contrast-stroke width from 0 through 16 image pixels at the 350px reference width.

Behavior

Important implementation details.

  • Supply already-normalized targets. If strategy samples are aggregated upstream, distanceYards should be the median direct green-centered ground distance per lowercase club and playsLikeYards should be the rounded mean of valid adjusted values.
  • The renderer never uses playsLikeYards as the circle radius. Elevation, weather, or other adjustments remain presentation-only.
  • The protected response contains only artifact-bound arc pixels, centerline crossings, endpoints, resolved label sides, ground radii, and safe labels. Fairway polygons, source coordinates, and transforms stay server-side.
  • All line, dash, endpoint, leader, and typography dimensions scale from the same 350px reference width; dash cadence never depends on local fairway width or arc length.
Protected course dataThe response contains only final fairway-clipped arc pixels, edge and centerline-crossing pixels, resolved label sides, distance values, and safe display strings. Fairway polygons, source elevations, tee identities, longitude, latitude, affine transforms, and the internal render sidecar remain server-side.