Skip to content

Commit

Permalink
Support selecting a detection in the URL hash
Browse files Browse the repository at this point in the history
(closes #1515)

This commit also includes a bunch of cleanup and work to prepare for
improving how we show the detections and the photos, re: #1514
  • Loading branch information
bhousel committed Aug 28, 2024
1 parent a6ebdf9 commit 1598638
Show file tree
Hide file tree
Showing 5 changed files with 228 additions and 109 deletions.
26 changes: 15 additions & 11 deletions modules/behaviors/SelectBehavior.js
Original file line number Diff line number Diff line change
Expand Up @@ -390,18 +390,22 @@ export class SelectBehavior extends AbstractBehavior {
// Clicked on a Mapillary object detection or traffic sign..
// Open the Mapillary viewer with an image showing that object/sign
if (data.type === 'detection') {
const service = context.services.mapillary;
if (!service?.started) return;

const layerID = target.layerID;
map.centerEase(data.loc);
service.getDetectionsAsync(dataID)
.then(detections => {
if (!detections.length) return;
const imageID = detections[0].image.id;
photos.selectPhoto('mapillary', imageID);
//todo: check on the asyncness of this code
// service.highlightDetection(detections[0]);
});
photos.selectDetection(layerID, dataID);
return;
// const service = context.services.mapillary;
// if (!service?.started) return;
//
// map.centerEase(data.loc);
// service.getDetectionsAsync(dataID)
// .then(detections => {
// if (!detections.length) return;
// const imageID = detections[0].image.id;
// photos.selectPhoto('mapillary', imageID);
// //todo: check on the asyncness of this code
// // service.highlightDetection(detections[0]);
// });
}
}

Expand Down
Loading

0 comments on commit 1598638

Please sign in to comment.