summaryrefslogtreecommitdiff
path: root/src/web/app/desktop
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2017-11-19 00:07:36 +0900
committersyuilo <syuilotan@yahoo.co.jp>2017-11-19 00:07:36 +0900
commit5f9c97fad3eacd200434a9711ac1f94128878f36 (patch)
treeb4dfdbbfda9d7df4455a29210d1a5cf73592b8d1 /src/web/app/desktop
parentいい感じに (diff)
downloadmisskey-5f9c97fad3eacd200434a9711ac1f94128878f36.tar.gz
misskey-5f9c97fad3eacd200434a9711ac1f94128878f36.tar.bz2
misskey-5f9c97fad3eacd200434a9711ac1f94128878f36.zip
Refactor
Diffstat (limited to 'src/web/app/desktop')
-rw-r--r--src/web/app/desktop/scripts/scroll-follower.ts10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/web/app/desktop/scripts/scroll-follower.ts b/src/web/app/desktop/scripts/scroll-follower.ts
index e99f125cc0..05072958ce 100644
--- a/src/web/app/desktop/scripts/scroll-follower.ts
+++ b/src/web/app/desktop/scripts/scroll-follower.ts
@@ -32,8 +32,8 @@ export default class ScrollFollower {
const windowTop = window.scrollY + this.topPadding;
const rect = this.follower.getBoundingClientRect();
- //const followerHeight = rect.height + this.containerTop;
const followerBottom = (rect.top + window.scrollY) + rect.height;
+ const screenHeight = window.innerHeight - this.topPadding;
// スクロールの上部(+余白)がフォロワーコンテナの上部よりも上方にある
if (window.scrollY + this.topPadding < this.containerTop) {
@@ -43,15 +43,19 @@ export default class ScrollFollower {
}
// スクロールの下部がフォロワーの下部よりも下方にある かつ 表示領域の縦幅がフォロワーの縦幅よりも狭い
- if (windowBottom > followerBottom && rect.height > (window.innerHeight - this.topPadding)) {
+ if (windowBottom > followerBottom && rect.height > screenHeight) {
// フォロワーの下部をスクロール下部に合わせる
const top = (windowBottom - rect.height) - this.containerTop;
(this.follower.parentNode as any).style.marginTop = `${top}px`;
+ return;
+ }
+
// スクロールの上部(+余白)がフォロワーの上部よりも上方にある または 表示領域の縦幅がフォロワーの縦幅よりも広い
- } else if ((windowTop < rect.top + window.scrollY || rect.height < (window.innerHeight - this.topPadding))) {
+ if (windowTop < rect.top + window.scrollY || rect.height < screenHeight) {
// フォロワーの上部をスクロール上部(+余白)に合わせる
const top = windowTop - this.containerTop;
(this.follower.parentNode as any).style.marginTop = `${top}px`;
+ return;
}
}
}