1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-07-25 09:45:04 +02:00
This commit is contained in:
syuilo
2026-07-11 17:31:52 +09:00
parent d55112ec7b
commit 5d92214ccc
2 changed files with 8 additions and 1 deletions

View File

@@ -206,7 +206,7 @@ function calcContentRenderingSize(content: Content) {
}
const contentRenderingSize = calcContentRenderingSize(props.content);
const contentRenderingRect = contentRenderingSize != null ? {
const getContentRenderingRect = () => contentRenderingSize != null ? {
left: (window.innerWidth - contentRenderingSize.width + padding.left - padding.right) / 2,
top: (window.innerHeight - contentRenderingSize.height + padding.top - padding.bottom) / 2,
width: contentRenderingSize.width,
@@ -217,6 +217,7 @@ const transform = ref({ x: 0, y: 0, scale: 1 });
// 元のimg要素の位置・サイズ(とobject-fitの設定値)を取得して、そこからneutralの位置にアニメーションするためのscaleとtranslationを計算する
function getScaleAndTranslationForSourceElement() {
const sourceElement = props.content.sourceElement;
const contentRenderingRect = getContentRenderingRect();
if (sourceElement == null || contentRenderingRect == null) return null;
return calculateSourceTransform({

View File

@@ -88,6 +88,12 @@ const contentsOffset = ref(currentIndex.value * -window.innerWidth);
const enableSlideTransition = ref(false);
let currentScrollLeft = contentsOffset.value;
// TODO: unmountで解除
window.addEventListener('resize', () => {
screenWidth.value = window.innerWidth;
scrollToCurrentIndex();
});
function onHorizontalSwipe(offset: number) {
if (currentIndex.value === 0 && offset > 0) { // これ以上戻れない
contentsOffset.value = currentScrollLeft + (offset / 3);