Skip to content

Commit 7175edd

Browse files
committed
fix: dotted detections display
1 parent f5c83f2 commit 7175edd

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

examples/live-examples-nextjs/src/app/tasks/object-detection/page.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,12 @@ export default function ObjectDetection() {
225225
// Handle results from the worker
226226
useEffect(() => {
227227
if (lastResult?.detections && map.current) {
228-
MapUtils.displayDetections(map.current, lastResult.detections);
228+
MapUtils.displayDetections(map.current, lastResult.detections, {
229+
"line-color": "#FFD400", // Yellow - visible and high contrast
230+
"line-width": 3,
231+
"line-dasharray": [1, 1], // dotted/dashed appearance
232+
"line-opacity": 1.0,
233+
},"line");
229234
setDetections(lastResult.detections);
230235
}
231236
if (lastResult?.geoRawImage?.bounds && map.current) {

examples/live-examples-nextjs/src/utils/mapUtils.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export class MapUtils {
1111
map: maplibregl.Map,
1212
detections: GeoJSON.FeatureCollection,
1313
paint = MapUtils.defaultDetectionsPaint,
14+
type: "symbol" | "fill" | "line" | "raster" | "circle" | "heatmap" | "fill-extrusion" | "hillshade" | "color-relief" | "background" = "fill",
1415
) {
1516
if (!map) return;
1617

@@ -29,7 +30,7 @@ export class MapUtils {
2930
// Add a layer to display the detections
3031
map.addLayer({
3132
id: "detections-layer",
32-
type: "fill",
33+
type: type,
3334
source: "detections",
3435
paint: paint,
3536
});

0 commit comments

Comments
 (0)