Dot
A small circle marking a point, sized in pixels
import { Dot, SphereMap } from "gistda-sphere-react";
<SphereMap center={{ lon: 100.5018, lat: 13.7563 }} style={{ height: 400 }} zoom={12}>
<Dot position={{ lon: 100.5018, lat: 13.7563 }} lineColor="red" lineWidth={12} title="Bangkok" />
<Dot position={{ lon: 100.52, lat: 13.77 }} lineColor="blue" lineWidth={8} title="Point B" />
</SphereMap>Unlike a Circle, whose radius is a distance on the ground, a dot keeps the same size on screen at every zoom level. lineWidth sets its diameter in pixels.
Props
| Prop | Type | Description |
|---|---|---|
position | Location | Required. Where the dot is. Changing it moves the dot without re-creating it. |
onDrop | (dot, location) => void | A draggable dot was dropped at location. |
Dots also take the shape props, such as lineColor, lineWidth, draggable and title.
Ref
| Method | Description |
|---|---|
getDot() | The underlying sphere.Dot. |
getPosition() / setPosition(location) | Read or move the dot. |
contains, intersects, within, distanceTo, updateStyle, togglePopup, toGeoJSON | As for polygons. |
setPosition and dragging move the dot until the position prop changes to a new location. As with markers, keep the location in state, for example from onDrop, if the dot should stay where it was moved.