mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-07-25 09:45:04 +02:00
wip
This commit is contained in:
@@ -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({
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user