Component library

One behavior engine, two placement sources.

The overlay layer contains protected Smart Components and client-authored Annotation primitives. Every component can be toggled and styled without changing the underlying image; point markers and Annotations can also support local movement and reset.

Smart Components

Course-aware placement without course-data exposure.

Smart Component 01

Tee marker

Mark the measured starting point for a hole with the built-in transparent PNG or a client-hosted PNG.

Read component guide →
Smart Component 02

Flag marker

Place a flag at the measured center-green pixel while keeping the underlying graphic clean.

Read component guide →
Smart Component 04

Approach rings

Draw measured distance rings around center green without embedding them in the downloadable graphic.

Read component guide →
Smart Component 05

Approach markers

Place labeled yardage circles on the protected fairway centerline.

Read component guide →
Smart Component 06

Grids

Overlay a yardage-accurate grid from green center or measured green dimensions across the image, on the green, or around a softly faded green buffer.

Read component guide →
Smart Component 07

Green elevation heatmap

Visualize meaningful high and low putting-surface terrain without baking it into the graphic.

Read component guide →
Smart Component 08

Green downhill arrows

Show protected putting-surface fall direction as fluid paths or a traditional arrow grid.

Read component guide →
Smart Component 09

Green measurements

Draw mapped green depth and width from edge to edge with optional yardage labels outside the surface.

Read component guide →
Smart Component 10

Teeboxes

Show scorecard-colored dots at the protected locations of the hole's teeboxes.

Read component guide →
Smart Component 11

Teeboxes legend

Add a compact, scorecard-colored hole and yardage legend without baking it into the graphic.

Read component guide →
Smart Component 12

Hole number

Place one prominent hole badge on a Hole graphic or label every hole on a complete Course graphic.

Read component guide →
Smart Component 13

Shot dispersion

Connect a configurable hole start to a direct-radius target with an empirical handicap- and distance-scaled dispersion finish.

Read component guide →
Smart Component 14

Hole centerline

Draw the measured multi-point tee-to-flag route as the lowest locked Smart Component layer.

Read component guide →
Smart Component 15

Hole spine

Connect tee, dogleg, and center green with two straight lowest-layer segments.

Read component guide →
Smart Component 16

Fairway widths

Draw tee-shot-bearing widths at 220–260 carry yards or the full fairway-following 10-yard profile.

Read component guide →

Annotation primitives

Build client-owned ideas from local pixels.

Image, shape, and text Annotations never call the protected sidecar. The client supplies their starting image pixels and the SDK supplies the shared component behavior.

Primitive 02

Shape annotation

Add a local circle, square, or diamond without loading another asset.

Read primitive guide →
Primitive 03

Text annotation

Place a short client-authored text block directly in the component layer.

Read primitive guide →

Shared view API

Build your own controls around the mounted view.

Graphics JS does not prescribe a toolbar or editor UI. Your application owns the controls and calls the view methods that correspond to its product experience.

await view.setSmartComponents([
  { type: "tee", movable: true },
  { type: "flag", movable: false },
]);

await view.addSmartComponent({
  id: "approach-100",
  type: "approach-markers",
  yardages: [100],
  style: { color: "#FF0000" },
});
await view.addSmartComponent({
  id: "approach-150",
  type: "approach-markers",
  yardages: [150],
  style: { color: "#FFFFFF" },
});

// All of these update the local DOM without rendering another image.
view.setSmartComponentVisible("tee", false);
view.setSmartComponentMovable("flag", true);
view.setSmartComponentStyle({ type: "flag", style: { size: 56 } });
view.resetSmartComponentPosition("tee");

// Client-authored primitives use client-provided image pixels.
view.setAnnotations([{
  type: "annotation",
  id: "preferred-miss",
  position: { x: 420, y: 610 },
  movable: true,
  content: { type: "shape", shape: "diamond" },
}]);
setSmartComponentsReconcile and cache desired protected placements
addSmartComponent / removeSmartComponentAppend or remove one independently identified instance
setSmartComponentVisibleToggle a Smart Component immediately
setSmartComponentMovableEnable point-marker or Shot dispersion endpoint movement
resetSmartComponentPositionRestore the protected original pixel or endpoint pair
setSmartComponentStyleUpdate local component presentation
setSmartComponentImageApply or remove a custom HTTPS PNG
setAnnotationsReplace client-authored local primitives
setAnnotationVisible / MovableControl local behavior immediately
resetAnnotationPositionRestore the client-provided starting pixel
setAnnotationStyle / removeAnnotationUpdate or remove a primitive

setSmartComponents removes absent components locally, retains unchanged placements and DOM, and requests only new or placement-affecting definitions. Types may repeat, up to 64 total instances per request. Give repeated instances explicit id values when later controls should target only one; a type selector continues to affect every instance of that type. addSmartComponent and removeSmartComponent provide incremental equivalents. Identical removed definitions are restored from the mounted view's bounded cache. Pass { force: true } as the options argument only when every requested definition must be resolved again. The earlier setOverlays and setOverlay* names remain compatibility aliases during the beta.

Shared events

Connect components to application behavior.

EventWhen it firesDetail
caddie100:overlayclickA marker or Shot dispersion endpoint is activated without completing a drag.placement
caddie100:overlaypositionchangeA movable marker is dragged, moved by keyboard, or reset.placement, originalPosition, source
caddie100:shotdispersionpositionchangeOne Shot dispersion endpoint is dragged, moved by keyboard, or reset.placement, endpoint, originalPosition, source
caddie100:overlayimagestatusA custom marker PNG loads or fails.id, type, url, status
caddie100:componentclickA point marker, Shot dispersion endpoint, or Annotation is activated.source, placement
caddie100:componentpositionchangeA movable point marker or Annotation is dragged, moved by keyboard, or reset.source, placement, originalPosition, sourceAction
caddie100:componentimagestatusAn Image Annotation PNG loads or fails.source, id, url, status