Merge branch 'fix/photoswipe-animation' into 'develop'
[PR]: Fix image zoom animation on Photoswipe opening See merge request firefish/firefish!10521
This commit is contained in:
commit
614830f866
8 changed files with 39 additions and 9 deletions
|
@ -91,6 +91,8 @@ const isThumbnailAvailable = computed(() => {
|
||||||
border: 0;
|
border: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
> .icon-sub {
|
> .icon-sub {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|
|
@ -53,8 +53,11 @@ const props = defineProps<{
|
||||||
}
|
}
|
||||||
|
|
||||||
> .thumbnail {
|
> .thumbnail {
|
||||||
|
display: flex;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
transition: all 0.5s ease;
|
transition: all 0.5s ease;
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,11 @@
|
||||||
:title="title"
|
:title="title"
|
||||||
:type="type"
|
:type="type"
|
||||||
:alt="alt"
|
:alt="alt"
|
||||||
:class="{ cover }"
|
:class="{
|
||||||
|
cover,
|
||||||
|
wide: largestDimension === 'width',
|
||||||
|
tall: largestDimension === 'height'
|
||||||
|
}"
|
||||||
:style="{ 'object-fit': cover ? 'cover' : null }"
|
:style="{ 'object-fit': cover ? 'cover' : null }"
|
||||||
loading="lazy"
|
loading="lazy"
|
||||||
@load="onLoad"
|
@load="onLoad"
|
||||||
|
@ -32,6 +36,7 @@ const props = withDefaults(
|
||||||
title?: string | null;
|
title?: string | null;
|
||||||
size?: number;
|
size?: number;
|
||||||
cover?: boolean;
|
cover?: boolean;
|
||||||
|
largestDimension?: "width" | "height";
|
||||||
}>(),
|
}>(),
|
||||||
{
|
{
|
||||||
src: null,
|
src: null,
|
||||||
|
@ -68,17 +73,27 @@ onMounted(() => {
|
||||||
canvas,
|
canvas,
|
||||||
img {
|
img {
|
||||||
display: block;
|
display: block;
|
||||||
width: 100%;
|
max-width: 100%;
|
||||||
height: 100%;
|
max-height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
canvas {
|
canvas {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
inset: 0;
|
inset: 0;
|
||||||
object-fit: cover;
|
object-fit: cover;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
img {
|
img {
|
||||||
object-fit: contain;
|
object-fit: contain;
|
||||||
|
|
||||||
|
&.wide {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.tall {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
:alt="media.comment"
|
:alt="media.comment"
|
||||||
:type="media.type"
|
:type="media.type"
|
||||||
:cover="false"
|
:cover="false"
|
||||||
|
:largest-dimension="largestDimension"
|
||||||
/>
|
/>
|
||||||
<div v-if="media.type === 'image/gif'" class="gif">GIF</div>
|
<div v-if="media.type === 'image/gif'" class="gif">GIF</div>
|
||||||
</a>
|
</a>
|
||||||
|
@ -120,6 +121,11 @@ const mediaType = computed(() => {
|
||||||
: props.media.type;
|
: props.media.type;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let largestDimension: 'width'|'height';
|
||||||
|
|
||||||
|
if (props.media.type.startsWith('image') && props.media.properties?.width && props.media.properties?.height) {
|
||||||
|
largestDimension = props.media.properties.width > props.media.properties.height ? 'width' : 'height'
|
||||||
|
}
|
||||||
function captionPopup() {
|
function captionPopup() {
|
||||||
os.alert({
|
os.alert({
|
||||||
type: "info",
|
type: "info",
|
||||||
|
@ -202,7 +208,7 @@ watch(
|
||||||
}
|
}
|
||||||
|
|
||||||
> a {
|
> a {
|
||||||
display: block;
|
display: flex;
|
||||||
cursor: zoom-in;
|
cursor: zoom-in;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
@ -211,6 +217,9 @@ watch(
|
||||||
background-size: contain;
|
background-size: contain;
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
&:focus-visible {
|
&:focus-visible {
|
||||||
border: 2px solid var(--accent);
|
border: 2px solid var(--accent);
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,7 +75,7 @@ onMounted(() => {
|
||||||
}),
|
}),
|
||||||
gallery: gallery.value,
|
gallery: gallery.value,
|
||||||
children: ".image",
|
children: ".image",
|
||||||
thumbSelector: ".image",
|
thumbSelector: ".image img",
|
||||||
loop: false,
|
loop: false,
|
||||||
padding:
|
padding:
|
||||||
window.innerWidth > 500
|
window.innerWidth > 500
|
||||||
|
|
|
@ -30,8 +30,7 @@ const image = props.hpml.page.attachedFiles.find(
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.lzyxtsnt {
|
.lzyxtsnt {
|
||||||
> img {
|
display: flex;
|
||||||
max-width: 100%;
|
justify-content: center;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -149,7 +149,6 @@ import { computed, defineComponent, inject, watch } from "vue";
|
||||||
import MkButton from "@/components/MkButton.vue";
|
import MkButton from "@/components/MkButton.vue";
|
||||||
import * as os from "@/os";
|
import * as os from "@/os";
|
||||||
import MkContainer from "@/components/MkContainer.vue";
|
import MkContainer from "@/components/MkContainer.vue";
|
||||||
import ImgWithBlurhash from "@/components/MkImgWithBlurhash.vue";
|
|
||||||
import MkPagination from "@/components/MkPagination.vue";
|
import MkPagination from "@/components/MkPagination.vue";
|
||||||
import MkGalleryPostPreview from "@/components/MkGalleryPostPreview.vue";
|
import MkGalleryPostPreview from "@/components/MkGalleryPostPreview.vue";
|
||||||
import MkFollowButton from "@/components/MkFollowButton.vue";
|
import MkFollowButton from "@/components/MkFollowButton.vue";
|
||||||
|
|
|
@ -98,6 +98,9 @@ onMounted(() => {
|
||||||
grid-gap: 6px;
|
grid-gap: 6px;
|
||||||
|
|
||||||
> .img {
|
> .img {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
position: relative;
|
position: relative;
|
||||||
height: 128px;
|
height: 128px;
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
|
|
Loading…
Reference in a new issue