@@ -189,12 +189,38 @@ function animateToOffsets(targetOffsetX, targetOffsetY, duration = 300) {
189189
190190// Show photo view after image loads
191191function showPhotoView ( photo ) {
192+ const photoView = document . getElementById ( 'photo-view' ) ;
192193 const imgElement = document . getElementById ( 'photo-image' ) ;
193194 const img = new Image ( ) ;
194195
195196 img . onload = ( ) => {
196197 imgElement . src = photo . imageHighRes ;
197198 document . body . classList . add ( 'show-photo-view' ) ;
199+ if ( photo . imageX == 0 ) {
200+ if ( photo . imageY == 0 ) {
201+ photoView . style . transform = 'translate(0%, 0%)' ;
202+ photoView . style . top = '0%' ;
203+ photoView . style . left = '0%' ;
204+ } else {
205+ photoView . style . transform = 'translate(0%, -50%)' ;
206+ photoView . style . top = '50%' ;
207+ photoView . style . left = '0%' ;
208+ }
209+ } else if ( photo . imageX == MAP_COLS - 1 ) {
210+ if ( photo . imageY == MAP_ROWS - 1 ) {
211+ photoView . style . transform = 'translate(-100%, -100%)' ;
212+ photoView . style . top = '100%' ;
213+ photoView . style . left = '100%' ;
214+ } else {
215+ photoView . style . transform = 'translate(-50%, -100%)' ;
216+ photoView . style . top = '50%' ;
217+ photoView . style . left = '100%' ;
218+ }
219+ } else {
220+ photoView . style . transform = 'translate(-50%, -50%)' ;
221+ photoView . style . top = '50%' ;
222+ photoView . style . left = '50%' ;
223+ }
198224 } ;
199225
200226 img . onerror = ( ) => {
0 commit comments