Skip to content
This repository has been archived by the owner on Jan 12, 2024. It is now read-only.

Commit

Permalink
working towards feature state with no id
Browse files Browse the repository at this point in the history
  • Loading branch information
yuletide committed Dec 16, 2019
1 parent 03572bf commit 5601ffc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
1 change: 0 additions & 1 deletion ui/src/components/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ class App extends React.Component {
activeItem: item
});
};
onListHighlight = item => {};
render() {
return (
<div>
Expand Down
18 changes: 9 additions & 9 deletions ui/src/components/Map.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import React from 'react';
import mapboxgl from 'mapbox-gl';
// import mapboxgl from 'mapbox-gl';
// we are using a dev build so we can set feature id's from a string property
import mapboxgl from '../lib/mapbox-gl';
import './Map.css';
import bbox from '@turf/bbox';
import { featureCollection, feature } from '@turf/helpers';
Expand All @@ -19,7 +21,8 @@ class Map extends React.Component {
data: {
type: 'FeatureCollection',
features: []
}
},
promoteId: { original: 'filename' }
});

this.theMap.addLayer({
Expand All @@ -39,14 +42,11 @@ class Map extends React.Component {

this.theMap.on('mouseenter', 'content', e => {
// Change the cursor style as a UI indicator.
const id = e.features[0].id;
console.log(id);
const feature = e.features[0];
console.log(feature);
// console.log(e.features[0]);
this.theMap.getCanvas().style.cursor = 'pointer';
this.theMap.setFeatureState(
{ source: 'content', id },
{ active: true }
);
this.theMap.setFeatureState(feature, { active: true });
// this.props.onHighlight(id);
});

Expand All @@ -69,7 +69,7 @@ class Map extends React.Component {
if (images.length) {
//geojson style
const features = this.props.images.map(image => {
return feature(image.geo.geometry, {}, { id: image.filename });
return feature(image.geo.geometry, image);
});
console.log(features);

Expand Down

0 comments on commit 5601ffc

Please sign in to comment.