aboutsummaryrefslogtreecommitdiff
path: root/src/content/presenters/ScrollPresenter.ts
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2020-05-02 17:25:56 +0900
committerGitHub <noreply@github.com>2020-05-02 17:25:56 +0900
commit5df0537bcf65a341e79852b1b30379c73318529c (patch)
treeaee5efe52412855f620cb514a13a2c14373f27b7 /src/content/presenters/ScrollPresenter.ts
parent685f2b7b69218b06b5bb676069e35f79c5048c9b (diff)
parent75abd90ecb8201ad845b266f96220d8adfe19b2d (diff)
Merge pull request #749 from ueokande/qa-0.28
QA 0.28
Diffstat (limited to 'src/content/presenters/ScrollPresenter.ts')
-rw-r--r--src/content/presenters/ScrollPresenter.ts20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/content/presenters/ScrollPresenter.ts b/src/content/presenters/ScrollPresenter.ts
index 387ab62..f1a6402 100644
--- a/src/content/presenters/ScrollPresenter.ts
+++ b/src/content/presenters/ScrollPresenter.ts
@@ -1,4 +1,4 @@
-import * as doms from '../../shared/utils/dom';
+import * as doms from "../../shared/utils/dom";
const SCROLL_DELTA_X = 64;
const SCROLL_DELTA_Y = 64;
@@ -9,13 +9,19 @@ let lastTimeoutId: number | null = null;
const isScrollableStyle = (element: Element): boolean => {
const { overflowX, overflowY } = window.getComputedStyle(element);
- return !(overflowX !== 'scroll' && overflowX !== 'auto' &&
- overflowY !== 'scroll' && overflowY !== 'auto');
+ return !(
+ overflowX !== "scroll" &&
+ overflowX !== "auto" &&
+ overflowY !== "scroll" &&
+ overflowY !== "auto"
+ );
};
const isOverflowed = (element: Element): boolean => {
- return element.scrollWidth > element.clientWidth ||
- element.scrollHeight > element.clientHeight;
+ return (
+ element.scrollWidth > element.clientWidth ||
+ element.scrollHeight > element.clientHeight
+ );
};
// Find a visiable and scrollable element by depth-first search. Currently
@@ -73,7 +79,7 @@ class Scroller {
this.element.scrollTo({
left: x,
top: y,
- behavior: 'smooth',
+ behavior: "smooth",
});
this.prepareReset();
}
@@ -94,7 +100,7 @@ class Scroller {
}
}
-export type Point = { x: number, y: number };
+export type Point = { x: number; y: number };
export default interface ScrollPresenter {
getScroll(): Point;