enhance: スクロールしないと閉じられないように
This commit is contained in:
parent
dce3925e81
commit
479b40deee
|
@ -5409,6 +5409,10 @@ export interface Locale extends ILocale {
|
||||||
* フォルダを作って整理することもできます。
|
* フォルダを作って整理することもできます。
|
||||||
*/
|
*/
|
||||||
"driveAboutTip": string;
|
"driveAboutTip": string;
|
||||||
|
/**
|
||||||
|
* スクロールして閉じる
|
||||||
|
*/
|
||||||
|
"scrollToClose": string;
|
||||||
"_chat": {
|
"_chat": {
|
||||||
/**
|
/**
|
||||||
* まだメッセージはありません
|
* まだメッセージはありません
|
||||||
|
|
|
@ -1347,6 +1347,7 @@ readonly: "読み取り専用"
|
||||||
goToDeck: "デッキへ戻る"
|
goToDeck: "デッキへ戻る"
|
||||||
federationJobs: "連合ジョブ"
|
federationJobs: "連合ジョブ"
|
||||||
driveAboutTip: "ドライブでは、過去にアップロードしたファイルの一覧が表示されます。<br>\nノートに添付する際に再利用したり、あとで投稿するファイルを予めアップロードしておくこともできます。<br>\n<b>ファイルを削除すると、今までそのファイルを使用した全ての場所(ノート、ページ、アバター、バナー等)からも見えなくなるので注意してください。</b><br>\nフォルダを作って整理することもできます。"
|
driveAboutTip: "ドライブでは、過去にアップロードしたファイルの一覧が表示されます。<br>\nノートに添付する際に再利用したり、あとで投稿するファイルを予めアップロードしておくこともできます。<br>\n<b>ファイルを削除すると、今までそのファイルを使用した全ての場所(ノート、ページ、アバター、バナー等)からも見えなくなるので注意してください。</b><br>\nフォルダを作って整理することもできます。"
|
||||||
|
scrollToClose: "スクロールして閉じる"
|
||||||
|
|
||||||
_chat:
|
_chat:
|
||||||
noMessagesYet: "まだメッセージはありません"
|
noMessagesYet: "まだメッセージはありません"
|
||||||
|
|
|
@ -16,15 +16,21 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<span :class="$style.title">{{ announcement.title }}</span>
|
<span :class="$style.title">{{ announcement.title }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div :class="$style.text"><Mfm :text="announcement.text"/></div>
|
<div :class="$style.text"><Mfm :text="announcement.text"/></div>
|
||||||
|
<div ref="bottomEl"></div>
|
||||||
<div :class="$style.footer">
|
<div :class="$style.footer">
|
||||||
<MkButton primary full @click="ok">{{ i18n.ts.ok }}</MkButton>
|
<MkButton
|
||||||
|
primary
|
||||||
|
full
|
||||||
|
:disabled="!hasReachedBottom"
|
||||||
|
@click="ok"
|
||||||
|
>{{ hasReachedBottom ? i18n.ts.close : i18n.ts.scrollToClose }}</MkButton>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</MkModal>
|
</MkModal>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { onMounted, useTemplateRef } from 'vue';
|
import { onMounted, ref, useTemplateRef } from 'vue';
|
||||||
import * as Misskey from 'misskey-js';
|
import * as Misskey from 'misskey-js';
|
||||||
import * as os from '@/os.js';
|
import * as os from '@/os.js';
|
||||||
import { misskeyApi } from '@/utility/misskey-api.js';
|
import { misskeyApi } from '@/utility/misskey-api.js';
|
||||||
|
@ -34,12 +40,12 @@ import { i18n } from '@/i18n.js';
|
||||||
import { $i } from '@/i.js';
|
import { $i } from '@/i.js';
|
||||||
import { updateCurrentAccountPartial } from '@/accounts.js';
|
import { updateCurrentAccountPartial } from '@/accounts.js';
|
||||||
|
|
||||||
const props = withDefaults(defineProps<{
|
const props = defineProps<{
|
||||||
announcement: Misskey.entities.Announcement;
|
announcement: Misskey.entities.Announcement;
|
||||||
}>(), {
|
}>();
|
||||||
});
|
|
||||||
|
|
||||||
const rootEl = useTemplateRef('rootEl');
|
const rootEl = useTemplateRef('rootEl');
|
||||||
|
const bottomEl = useTemplateRef('bottomEl');
|
||||||
const modal = useTemplateRef('modal');
|
const modal = useTemplateRef('modal');
|
||||||
|
|
||||||
async function ok() {
|
async function ok() {
|
||||||
|
@ -74,7 +80,34 @@ function onBgClick() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const hasReachedBottom = ref(false);
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
if (bottomEl.value && rootEl.value) {
|
||||||
|
const bottomElRect = bottomEl.value.getBoundingClientRect();
|
||||||
|
const rootElRect = rootEl.value.getBoundingClientRect();
|
||||||
|
if (
|
||||||
|
bottomElRect.top >= rootElRect.top &&
|
||||||
|
bottomElRect.top <= (rootElRect.bottom - 66) // 66 ≒ 75 * 0.9 (modalのアニメーション分)
|
||||||
|
) {
|
||||||
|
hasReachedBottom.value = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const observer = new IntersectionObserver(entries => {
|
||||||
|
for (const entry of entries) {
|
||||||
|
if (entry.isIntersecting) {
|
||||||
|
hasReachedBottom.value = true;
|
||||||
|
observer.disconnect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
root: rootEl.value,
|
||||||
|
rootMargin: '0px 0px -75px 0px',
|
||||||
|
});
|
||||||
|
|
||||||
|
observer.observe(bottomEl.value);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue