Skip to content

Commit 8a02fb3

Browse files
committed
Rotation transformation for thumbnails on map view
1 parent ab4b5bc commit 8a02fb3

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

ui/src/components/MapView.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ const Container = styled('div')`
6464
border-radius: 50%;
6565
box-shadow: 0 5px 12px rgba(0, 0, 0, 0.5);
6666
background: rgba(255, 255, 255, 0.25);
67+
overflow: hidden;
6768
}
6869
`
6970

@@ -120,11 +121,11 @@ const MapView = ({
120121
return null
121122
}
122123

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

@@ -133,7 +134,7 @@ const MapView = ({
133134
photo.location ? (
134135
<Marker
135136
key={`marker-${photo.id}`}
136-
icon={getMarkerIcon(photo.thumbnail)}
137+
icon={getMarkerIcon(photo.thumbnail, photo.rotation)}
137138
position={[photo.location[0], photo.location[1]]}
138139
eventHandlers={{
139140
click: () => {

ui/src/containers/BrowseContainer.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,7 @@ const BrowseContainer = (props) => {
309309
id: photo.node.id,
310310
thumbnail: `/thumbnailer/photo/256x256_cover_q50/${photo.node.id}/`,
311311
location: photo.node.location,
312+
rotation: photo.node.rotation,
312313
}))
313314
}
314315

0 commit comments

Comments
 (0)