Smart Component 13

Shot dispersion.

Shot dispersion starts at the authored tee by default, or at a client-selected tee name or longitude,latitude coordinate. It prefers the point where the start-centered yardage radius intersects the protected fairway centerline. When no usable intersection exists, including on a Par 3 without mapped fairway geometry, it places the same radius on the direct bearing toward green center. Graphics JS renders two movable endpoints, a dashed connector, and a target finish sized by an empirical handicap curve.

type: "shot-dispersion"component: caddie-shot-dispersionProtected placement

Usage

Add the shot dispersion 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.

const view = await caddie.mount(container, graphicRequest, [
  {
    type: "shot-dispersion",
    yardage: 260,
    from: "Blue", // Optional tee name or "longitude,latitude"; omit for the authored tee.
    handicap: golfer.handicapIndex, // Optional; defaults to 12 and caps to 1–20.
    movable: true,
    style: { strokeColor: "#FFFFFF", strokeWidth: 3, pointSize: 22, teePointColor: "#07110D", targetPointColor: "#00AEEF", dispersionColor: "#39B54A", dispersionOpacity: 0.4, showLabels: true, labelPosition: "target-top", labelPrecision: "rounded" },
  },
]);

view.setSmartComponentMovable("shot-dispersion", true);
view.resetSmartComponentPosition("shot-dispersion");

Defaults

Built-in presentation.

SubjectHole
StartAuthored tee
Distance260-yard direct radius
Handicap12
TargetFairway intersection · green-bearing fallback
MovementBoth endpoints movable

Component options

Configure behavior and presentation.

OptionTypeDefaultDescription
type"shot-dispersion"RequiredRequests a direct-radius target, preferring the fairway centerline with a green-center-bearing fallback.
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.
yardagenumber260Direct start-centered radius from 10 through 400 yards.
fromstringAuthored teeOptional case-insensitive tee name or WGS 84 longitude,latitude starting point.
handicapnumber12Optional golfer handicap. Decimal values are supported and numeric values are capped from 1 through 20.
movablebooleantrueEnables pointer dragging and arrow-key movement for both endpoints.
style.strokeColor#RRGGBB"#FFFFFF"Dashed connector color.
style.strokeWidthnumber3Non-scaling dashed-line width from 1 through 12 image pixels. Lateral label leaders use the same width and dash sizing.
style.pointSizenumber22Visible endpoint diameter from 12 through 48 image pixels.
style.teePointColor#RRGGBB"#07110D"Tee-point fill color.
style.targetPointColor#RRGGBB"#00AEEF"Target-point fill color.
style.pointColor#RRGGBB"#00AEEF"Deprecated compatibility alias for style.targetPointColor.
style.pointOutlineColor#RRGGBB"#FFFFFF"Endpoint outline color.
style.dispersionColor#RRGGBB"#39B54A"Color of the gradient that fades backward from the target.
style.dispersionOpacitynumber0.4Target-end fade opacity from 0 through 1.
style.showLabelsbooleantrueShows the client-calculated live yardage pill.
style.showLabelbooleanDeprecatedCompatibility alias for style.showLabels.
style.labelPosition"target-top" | "line-center" | "target-left" | "target-right" | "sticky-left" | "sticky-right""target-top"Places the yardage pill above the target, at line center, halfway toward a horizontal image edge, or flush against one. Sticky pills have only their inward side rounded.
style.labelPrecision"rounded" | "measured""rounded"Shows whole live yards by default. Measured preserves one decimal place as the endpoints move.
style.labelSizenumber16Positive whole-number yardage label text size in image pixels with no upper limit.
style.labelColor#RRGGBB"#FFFFFF"Yardage label text color.
style.labelBackgroundColor#RRGGBB"#07110D"Yardage pill background color.
style.labelXPaddingnumber9Horizontal pill padding from 0 through 32 image pixels.
style.labelYPaddingnumber7Vertical pill padding from 0 through 20 image pixels.
style.labelGapnumber8Gap below the above-target pill, or clearance between a lateral leader and the target point, from 0 through 40 pixels.

Behavior

Important implementation details.

  • The target is found with a circle/segment intersection. It does not walk the requested distance around centerline bends.
  • If no usable fairway-centerline intersection exists, the target remains at the requested radius on the straight bearing from the selected start toward green center.
  • A from value uses the same strict coordinate parsing and tee-name matching as Fairway widths; only final protected endpoint pixels are returned.
  • The live yardage pill uses a protected initial pixel/yard calibration and recalculates locally as either point moves; it makes no additional server request.
  • The empirical lateral model interpolates handicap-specific sigma-angle and side-dispersion multipliers; its result is applied independently to the left and right sides.
  • Tee and target fill colors can be changed independently without moving or rebuilding either endpoint.
  • Moving either endpoint updates the 60%-opacity dashed connector immediately and does not rebuild the clean course image.
  • The target bar, double-width carry segment, and 25% backward fade recalculate from the live point-to-point distance.
  • The visible fade starts at roughly three-quarters of the target width and uses thin white side borders that fade toward the tee.
  • The initial two image pixels are retained locally so reset needs no new overlay request.
  • caddie100:shotdispersionpositionchange identifies the moved tee or target endpoint and reports its protected original pixel after a drag, keyboard move, or reset.
Protected course dataComponent responses contain only artifact-bound image pixels and safe presentation values. They do not include longitude, latitude, course geometry, affine transforms, control points, or the internal render sidecar.