Skip to content

Commit

Permalink
Rotation transformation for thumbnails on map view
Browse files Browse the repository at this point in the history
  • Loading branch information
damianmoore committed Mar 24, 2022
1 parent ab4b5bc commit 8a02fb3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
9 changes: 5 additions & 4 deletions ui/src/components/MapView.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ const Container = styled('div')`
border-radius: 50%;
box-shadow: 0 5px 12px rgba(0, 0, 0, 0.5);
background: rgba(255, 255, 255, 0.25);
overflow: hidden;
}
`

Expand Down Expand Up @@ -120,11 +121,11 @@ const MapView = ({
return null
}

const getMarkerIcon = (photoThumbnail) => {
return new L.Icon({
iconUrl: photoThumbnail,
const getMarkerIcon = (photoThumbnail, rotation) => {
return new L.divIcon({
iconSize: new L.Point(50, 50),
className: 'leaflet-custom-icon',
html: `<img src="${photoThumbnail}" width="100%" height="100%" style="transform: rotate(${rotation}deg)" />`,
})
}

Expand All @@ -133,7 +134,7 @@ const MapView = ({
photo.location ? (
<Marker
key={`marker-${photo.id}`}
icon={getMarkerIcon(photo.thumbnail)}
icon={getMarkerIcon(photo.thumbnail, photo.rotation)}
position={[photo.location[0], photo.location[1]]}
eventHandlers={{
click: () => {
Expand Down
1 change: 1 addition & 0 deletions ui/src/containers/BrowseContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ const BrowseContainer = (props) => {
id: photo.node.id,
thumbnail: `/thumbnailer/photo/256x256_cover_q50/${photo.node.id}/`,
location: photo.node.location,
rotation: photo.node.rotation,
}))
}

Expand Down

0 comments on commit 8a02fb3

Please sign in to comment.