Skip to content

Commit 6c0489a

Browse files
committed
Provide clearer orientation text values.
1 parent 78da4b2 commit 6c0489a

File tree

3 files changed

+46
-49
lines changed

3 files changed

+46
-49
lines changed

index.html

+10-13
Original file line numberDiff line numberDiff line change
@@ -91,19 +91,16 @@ <h3>Options</h3>
9191
<p>
9292
<label for="orientation">Orientation:</label>
9393
<select id="orientation">
94-
<option value="0">true: according to the EXIF orientation value</option>
95-
<option value="1">1: top-left (original)</option>
96-
<option value="2">2: top-right (horizontal flip)</option>
97-
<option value="3">3: bottom-right (180° rotate left)</option>
98-
<option value="4">4: bottom-left (vertical flip)</option>
99-
<option value="5"
100-
>5: left-top (vertical flip + 90° rotate right)</option
101-
>
102-
<option value="6">6: right-top (90° rotate right)</option>
103-
<option value="7"
104-
>7: right-bottom (horizontal flip + 90° rotate right)</option
105-
>
106-
<option value="8">8: left-bottom (90° rotate left)</option>
94+
<option value="-1">undefined: Browser default</option>
95+
<option value="0" selected>true: Automatic</option>
96+
<option value="1">1: Original</option>
97+
<option value="2">2: Horizontal flip</option>
98+
<option value="3">3: Rotate 180° CCW</option>
99+
<option value="4">4: Vertical flip</option>
100+
<option value="5">5: Vertical flip + Rotate 90° CW</option>
101+
<option value="6">6: Rotate 90° CW</option>
102+
<option value="7">7: Horizontal flip + Rotate 90° CW</option>
103+
<option value="8">8: Rotate 90° CCW</option>
107104
</select>
108105
</p>
109106
<p>

js/load-image-exif-map.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -319,14 +319,14 @@
319319
6: 'B'
320320
},
321321
Orientation: {
322-
1: 'top-left',
323-
2: 'top-right',
324-
3: 'bottom-right',
325-
4: 'bottom-left',
326-
5: 'left-top',
327-
6: 'right-top',
328-
7: 'right-bottom',
329-
8: 'left-bottom'
322+
1: 'Original',
323+
2: 'Horizontal flip',
324+
3: 'Rotate 180° CCW',
325+
4: 'Vertical flip',
326+
5: 'Vertical flip + Rotate 90° CW',
327+
6: 'Rotate 90° CW',
328+
7: 'Horizontal flip + Rotate 90° CW',
329+
8: 'Rotate 90° CCW'
330330
}
331331
}
332332

js/load-image-orientation.js

+28-28
Original file line numberDiff line numberDiff line change
@@ -258,45 +258,45 @@ Exif orientation values to correctly display the letter F:
258258
// auto-oriented images
259259
switch (autoOrientation) {
260260
case 2:
261-
// horizontal flip
261+
// Horizontal flip
262262
right = options.left
263263
left = options.right
264264
break
265265
case 3:
266-
// 180° rotate left
266+
// 180° Rotate CCW
267267
top = options.bottom
268268
right = options.left
269269
bottom = options.top
270270
left = options.right
271271
break
272272
case 4:
273-
// vertical flip
273+
// Vertical flip
274274
top = options.bottom
275275
bottom = options.top
276276
break
277277
case 5:
278-
// horizontal flip + 90° rotate left
278+
// Horizontal flip + 90° Rotate CCW
279279
top = options.left
280280
right = options.bottom
281281
bottom = options.right
282282
left = options.top
283283
break
284284
case 6:
285-
// 90° rotate left
285+
// 90° Rotate CCW
286286
top = options.left
287287
right = options.top
288288
bottom = options.right
289289
left = options.bottom
290290
break
291291
case 7:
292-
// vertical flip + 90° rotate left
292+
// Vertical flip + 90° Rotate CCW
293293
top = options.right
294294
right = options.top
295295
bottom = options.left
296296
left = options.bottom
297297
break
298298
case 8:
299-
// 90° rotate right
299+
// 90° Rotate CW
300300
top = options.right
301301
right = options.bottom
302302
bottom = options.left
@@ -320,45 +320,45 @@ Exif orientation values to correctly display the letter F:
320320
// Account for defined browser orientation:
321321
switch (orientation) {
322322
case 2:
323-
// horizontal flip
323+
// Horizontal flip
324324
newOptions.right = left
325325
newOptions.left = right
326326
break
327327
case 3:
328-
// 180° rotate left
328+
// 180° Rotate CCW
329329
newOptions.top = bottom
330330
newOptions.right = left
331331
newOptions.bottom = top
332332
newOptions.left = right
333333
break
334334
case 4:
335-
// vertical flip
335+
// Vertical flip
336336
newOptions.top = bottom
337337
newOptions.bottom = top
338338
break
339339
case 5:
340-
// vertical flip + 90° rotate right
340+
// Vertical flip + 90° Rotate CW
341341
newOptions.top = left
342342
newOptions.right = bottom
343343
newOptions.bottom = right
344344
newOptions.left = top
345345
break
346346
case 6:
347-
// 90° rotate right
347+
// 90° Rotate CW
348348
newOptions.top = right
349349
newOptions.right = bottom
350350
newOptions.bottom = left
351351
newOptions.left = top
352352
break
353353
case 7:
354-
// horizontal flip + 90° rotate right
354+
// Horizontal flip + 90° Rotate CW
355355
newOptions.top = right
356356
newOptions.right = top
357357
newOptions.bottom = left
358358
newOptions.left = bottom
359359
break
360360
case 8:
361-
// 90° rotate left
361+
// 90° Rotate CCW
362362
newOptions.top = left
363363
newOptions.right = top
364364
newOptions.bottom = right
@@ -398,38 +398,38 @@ Exif orientation values to correctly display the letter F:
398398
// Reset automatic browser orientation:
399399
switch (autoOrientation) {
400400
case 2:
401-
// horizontal flip
401+
// Horizontal flip
402402
ctx.translate(sourceWidth, 0)
403403
ctx.scale(-1, 1)
404404
break
405405
case 3:
406-
// 180° rotate left
406+
// 180° Rotate CCW
407407
ctx.translate(sourceWidth, sourceHeight)
408408
ctx.rotate(Math.PI)
409409
break
410410
case 4:
411-
// vertical flip
411+
// Vertical flip
412412
ctx.translate(0, sourceHeight)
413413
ctx.scale(1, -1)
414414
break
415415
case 5:
416-
// horizontal flip + 90° rotate left
416+
// Horizontal flip + 90° Rotate CCW
417417
ctx.rotate(-0.5 * Math.PI)
418418
ctx.scale(-1, 1)
419419
break
420420
case 6:
421-
// 90° rotate left
421+
// 90° Rotate CCW
422422
ctx.rotate(-0.5 * Math.PI)
423423
ctx.translate(-sourceWidth, 0)
424424
break
425425
case 7:
426-
// vertical flip + 90° rotate left
426+
// Vertical flip + 90° Rotate CCW
427427
ctx.rotate(-0.5 * Math.PI)
428428
ctx.translate(-sourceWidth, sourceHeight)
429429
ctx.scale(1, -1)
430430
break
431431
case 8:
432-
// 90° rotate right
432+
// 90° Rotate CW
433433
ctx.rotate(0.5 * Math.PI)
434434
ctx.translate(0, -sourceHeight)
435435
break
@@ -441,38 +441,38 @@ Exif orientation values to correctly display the letter F:
441441
}
442442
switch (orientation) {
443443
case 2:
444-
// horizontal flip
444+
// Horizontal flip
445445
ctx.translate(width, 0)
446446
ctx.scale(-1, 1)
447447
break
448448
case 3:
449-
// 180° rotate left
449+
// 180° Rotate CCW
450450
ctx.translate(width, height)
451451
ctx.rotate(Math.PI)
452452
break
453453
case 4:
454-
// vertical flip
454+
// Vertical flip
455455
ctx.translate(0, height)
456456
ctx.scale(1, -1)
457457
break
458458
case 5:
459-
// vertical flip + 90° rotate right
459+
// Vertical flip + 90° Rotate CW
460460
ctx.rotate(0.5 * Math.PI)
461461
ctx.scale(1, -1)
462462
break
463463
case 6:
464-
// 90° rotate right
464+
// 90° Rotate CW
465465
ctx.rotate(0.5 * Math.PI)
466466
ctx.translate(0, -height)
467467
break
468468
case 7:
469-
// horizontal flip + 90° rotate right
469+
// Horizontal flip + 90° Rotate CW
470470
ctx.rotate(0.5 * Math.PI)
471471
ctx.translate(width, -height)
472472
ctx.scale(-1, 1)
473473
break
474474
case 8:
475-
// 90° rotate left
475+
// 90° Rotate CCW
476476
ctx.rotate(-0.5 * Math.PI)
477477
ctx.translate(-width, 0)
478478
break

0 commit comments

Comments
 (0)