diff --git a/packages/web-app-preview/src/App.vue b/packages/web-app-preview/src/App.vue index e6cf664a78..8a8256a493 100644 --- a/packages/web-app-preview/src/App.vue +++ b/packages/web-app-preview/src/App.vue @@ -35,10 +35,6 @@ v-else-if="activeMediaFileCached.isImage" :file="activeMediaFileCached" :current-image-rotation="currentImageRotation" - :current-image-zoom="currentImageZoom" - :current-image-position-x="currentImagePositionX" - :current-image-position-y="currentImagePositionY" - @pan-zoom-change="onPanZoomChanged" /> { if ( - unref(props.currentFileContext.routeQuery)['q_share-visibility'] === 'hidden' && + unref(props.currentFileContext.routeQuery)?.['q_share-visibility'] === 'hidden' && !(file as IncomingShareResource).hidden ) { return false } if ( - unref(props.currentFileContext.routeQuery)['q_share-visibility'] !== 'hidden' && + unref(props.currentFileContext.routeQuery)?.['q_share-visibility'] !== 'hidden' && (file as IncomingShareResource).hidden ) { return false @@ -415,7 +412,6 @@ export default defineComponent({ this.isAutoPlayEnabled = false } - this.currentImageZoom = 1 this.currentImageRotation = 0 } }, diff --git a/packages/web-app-preview/src/components/MediaControls.vue b/packages/web-app-preview/src/components/MediaControls.vue index 3c50f8ca16..0487eaad6b 100644 --- a/packages/web-app-preview/src/components/MediaControls.vue +++ b/packages/web-app-preview/src/components/MediaControls.vue @@ -51,7 +51,7 @@ class="preview-controls-image-shrink raw-hover-surface p-1" appearance="raw" :aria-label="imageShrinkDescription" - @click="imageShrink" + @click="$emit('setShrink')" > @@ -60,7 +60,7 @@ class="preview-controls-image-zoom raw-hover-surface p-1" appearance="raw" :aria-label="imageZoomDescription" - @click="imageZoom" + @click="$emit('setZoom')" > @@ -71,7 +71,7 @@ class="preview-controls-rotate-left raw-hover-surface p-1" appearance="raw" :aria-label="imageRotateLeftDescription" - @click="imageRotateLeft" + @click="$emit('setRotationLeft')" > @@ -80,7 +80,7 @@ class="preview-controls-rotate-right raw-hover-surface p-1" appearance="raw" :aria-label="imageRotateRightDescription" - @click="imageRotateRight" + @click="$emit('setRotationRight')" > @@ -143,17 +143,15 @@ export default defineComponent({ type: Boolean, default: true }, - currentImageZoom: { - type: Number, - default: 1 - }, currentImageRotation: { type: Number, default: 0 } }, emits: [ - 'setRotation', + 'setRotationLeft', + 'setRotationRight', + 'setShrink', 'setZoom', 'toggleFullScreen', 'toggleNext', @@ -161,13 +159,9 @@ export default defineComponent({ 'resetImage', 'deleteResource' ], - setup(props, { emit }) { + setup(props) { const { $gettext } = useGettext() - const currentZoomDisplayValue = computed(() => { - return `${(props.currentImageZoom * 100).toFixed(0)}%` - }) - const ariaHiddenFileCount = computed(() => { return $gettext('%{ displayIndex } of %{ availableMediaFiles }', { displayIndex: (props.activeIndex + 1).toString(), @@ -181,23 +175,6 @@ export default defineComponent({ }) }) - const calculateZoom = (zoom: number, factor: number) => { - return Math.round(zoom * factor * 20) / 20 - } - const imageShrink = () => { - emit('setZoom', Math.max(0.1, calculateZoom(props.currentImageZoom, 0.8))) - } - const imageZoom = () => { - const maxZoomValue = calculateZoom(9, 1.25) - emit('setZoom', Math.min(calculateZoom(props.currentImageZoom, 1.25), maxZoomValue)) - } - const imageRotateLeft = () => { - emit('setRotation', props.currentImageRotation === -270 ? 0 : props.currentImageRotation - 90) - } - const imageRotateRight = () => { - emit('setRotation', props.currentImageRotation === 270 ? 0 : props.currentImageRotation + 90) - } - const resourceDeleteDescription = computed(() => { return $gettext('Delete (%{key})', { key: isMacOs() ? $gettext('⌘ + Backspace') : $gettext('Del') @@ -205,23 +182,18 @@ export default defineComponent({ }) return { - currentZoomDisplayValue, screenreaderFileCount, ariaHiddenFileCount, resourceDeleteDescription, enterFullScreenDescription: $gettext('Enter full screen mode'), exitFullScreenDescription: $gettext('Exit full screen mode'), - imageShrinkDescription: $gettext('Shrink the image'), - imageZoomDescription: $gettext('Enlarge the image'), + imageShrinkDescription: $gettext('Shrink the image (⇧ + Mouse wheel)'), + imageZoomDescription: $gettext('Enlarge the image (⇧ + Mouse wheel)'), imageResetDescription: $gettext('Reset'), imageRotateLeftDescription: $gettext('Rotate the image 90 degrees to the left'), imageRotateRightDescription: $gettext('Rotate the image 90 degrees to the right'), previousDescription: $gettext('Show previous media file in folder'), - nextDescription: $gettext('Show next media file in folder'), - imageShrink, - imageZoom, - imageRotateLeft, - imageRotateRight + nextDescription: $gettext('Show next media file in folder') } } }) diff --git a/packages/web-app-preview/src/components/Sources/MediaImage.vue b/packages/web-app-preview/src/components/Sources/MediaImage.vue index 591416a1d1..1b1f9c83c9 100644 --- a/packages/web-app-preview/src/components/Sources/MediaImage.vue +++ b/packages/web-app-preview/src/components/Sources/MediaImage.vue @@ -5,15 +5,24 @@ :src="file.url" :alt="file.name" :data-id="file.id" - class="max-w-full max-h-full pt-4 cursor-move object-contain" - :style="`transform: rotate(${currentImageRotation}deg)`" + class="max-w-full max-h-full pt-4" />