4141 :enable-swipe =" canSwipe && ! editing "
4242 :has-next =" hasNext "
4343 :has-previous =" hasPrevious "
44- :inline-actions =" canEdit ? 1 : 0 "
44+ :inline-actions =" ( canEdit ? 1 : 0 ) + ( canRotate ? 2 : 0 ) "
4545 :spread-navigation =" true "
4646 :style =" { width: isSidebarShown ? ` ${sidebarPosition }px ` : null } "
4747 :name =" currentFile .basename "
6161 </template >
6262 {{ t('viewer', 'Edit') }}
6363 </NcActionButton >
64+ <NcActionButton v-if =" canRotate "
65+ :close-after-click =" false "
66+ :aria-label =" t (' viewer' , ' Rotate counterclockwise' )"
67+ @click =" rotateLeft " >
68+ <template #icon >
69+ <RotateLeft :size =" 20 " />
70+ </template >
71+ {{ t('viewer', 'Rotate counterclockwise') }}
72+ </NcActionButton >
73+ <NcActionButton v-if =" canRotate "
74+ :close-after-click =" false "
75+ :aria-label =" t (' viewer' , ' Rotate clockwise' )"
76+ @click =" rotateRight " >
77+ <template #icon >
78+ <RotateRight :size =" 20 " />
79+ </template >
80+ {{ t('viewer', 'Rotate clockwise') }}
81+ </NcActionButton >
6482 <!-- Menu items -->
6583 <NcActionButton :close-after-click =" true "
6684 @click =" toggleFullScreen " >
148166 :is-full-screen =" isFullscreen"
149167 :is-sidebar-shown =" isSidebarShown"
150168 :loaded.sync =" currentFile.loaded"
169+ :rotation =" rotation"
151170 class =" viewer__file viewer__file--active"
152171 @update:editing =" toggleEditor"
153172 @error =" currentFailed" />
@@ -207,6 +226,8 @@ import Fullscreen from 'vue-material-design-icons/Fullscreen.vue'
207226import FullscreenExit from ' vue-material-design-icons/FullscreenExit.vue'
208227import Pencil from ' vue-material-design-icons/PencilOutline.vue'
209228import DockRight from ' vue-material-design-icons/DockRight.vue'
229+ import RotateLeft from ' vue-material-design-icons/RotateLeft.vue'
230+ import RotateRight from ' vue-material-design-icons/RotateRight.vue'
210231
211232import ' @nextcloud/dialogs/style.css'
212233
@@ -229,6 +250,8 @@ export default defineComponent({
229250 NcActionLink,
230251 NcModal,
231252 Pencil,
253+ RotateLeft,
254+ RotateRight,
232255 },
233256
234257 mixins: [isFullscreen, isMobile],
@@ -251,6 +274,7 @@ export default defineComponent({
251274 comparisonFile: null ,
252275 nextFile: {},
253276 fileList: [],
277+ rotation: 0 ,
254278 sortingConfig: null ,
255279
256280 // States
@@ -333,6 +357,10 @@ export default defineComponent({
333357 return [' image/jpeg' , ' image/png' , ' image/webp' ].includes (this .currentFile ? .mime )
334358 },
335359
360+ canRotate () {
361+ return this .isImage && ! this .comparisonFile
362+ },
363+
336364 sidebarOpenFilePath () {
337365 try {
338366 const relativePath = this .currentFile ? .davPath ? .split (defaultRootPath)[1 ]
@@ -1062,7 +1090,16 @@ export default defineComponent({
10621090 /**
10631091 * Open previous available file
10641092 */
1093+ rotateLeft() {
1094+ this.rotation = ((this.rotation - 90) + 360) % 360
1095+ },
1096+
1097+ rotateRight() {
1098+ this.rotation = (this.rotation + 90) % 360
1099+ },
1100+
10651101 previous() {
1102+ this.rotation = 0
10661103 this.currentIndex--
10671104 if (this.currentIndex < 0) {
10681105 this.currentIndex = this.fileList.length - 1
@@ -1078,6 +1115,7 @@ export default defineComponent({
10781115 * Open next available file
10791116 */
10801117 next() {
1118+ this.rotation = 0
10811119 this.currentIndex++
10821120 if (this.currentIndex > this.fileList.length - 1) {
10831121 this.currentIndex = 0
0 commit comments