Merge pull request #547 from ueokande/qa-0.21

QA 0.21
This commit is contained in:
Shin'ya Ueoka 2019-03-23 08:21:05 +00:00 committed by GitHub
commit 831538e37b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 3802 additions and 3074 deletions

6837
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -28,11 +28,11 @@
"babel-preset-preact": "^1.1.0", "babel-preset-preact": "^1.1.0",
"babel-preset-stage-2": "^6.24.1", "babel-preset-stage-2": "^6.24.1",
"chai": "^4.2.0", "chai": "^4.2.0",
"css-loader": "^2.1.0", "css-loader": "^2.1.1",
"eslint": "^5.13.0", "eslint": "^5.15.1",
"eslint-plugin-react": "^7.12.4", "eslint-plugin-react": "^7.12.4",
"html-webpack-plugin": "^3.2.0", "html-webpack-plugin": "^3.2.0",
"karma": "^4.0.0", "karma": "^4.0.1",
"karma-firefox-launcher": "^1.1.0", "karma-firefox-launcher": "^1.1.0",
"karma-html2js-preprocessor": "^1.1.0", "karma-html2js-preprocessor": "^1.1.0",
"karma-mocha": "^1.3.0", "karma-mocha": "^1.3.0",
@ -40,7 +40,7 @@
"karma-sinon": "^1.0.5", "karma-sinon": "^1.0.5",
"karma-sourcemap-loader": "^0.3.7", "karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^3.0.5", "karma-webpack": "^3.0.5",
"mocha": "^5.2.0", "mocha": "^6.0.2",
"node-sass": "^4.11.0", "node-sass": "^4.11.0",
"preact": "^8.4.2", "preact": "^8.4.2",
"preact-redux": "^2.0.3", "preact-redux": "^2.0.3",
@ -49,9 +49,9 @@
"sass-loader": "^7.1.0", "sass-loader": "^7.1.0",
"sinon-chrome": "^2.3.2", "sinon-chrome": "^2.3.2",
"style-loader": "^0.23.1", "style-loader": "^0.23.1",
"web-ext": "github:ueokande/web-ext#patched-2.9.1", "web-ext": "github:ueokande/web-ext#patched-3.0.0",
"webextensions-api-fake": "^0.5.1", "webextensions-api-fake": "^0.5.1",
"webpack": "^4.20.2", "webpack": "^4.29.6",
"webpack-cli": "^3.1.2" "webpack-cli": "^3.2.3"
} }
} }

View file

@ -62,29 +62,22 @@ class Scroller {
} }
scrollTo(x, y) { scrollTo(x, y) {
let behavior = this.smooth ? 'smooth' : 'auto';
window.scrollTo({
left: x,
top: y,
behavior: behavior,
});
if (!this.smooth) { if (!this.smooth) {
this.element.scrollTo(x, y);
return; return;
} }
this.element.scrollTo({
left: x,
top: y,
behavior: 'smooth',
});
this.prepareReset(); this.prepareReset();
} }
scrollBy(x, y) { scrollBy(x, y) {
let behavior = this.smooth ? 'smooth' : 'auto'; let left = this.element.scrollLeft + x;
window.scrollBy({ let top = this.element.scrollTop + y;
left: x, this.scrollTo(left, top);
top: y,
behavior: behavior,
});
if (!this.smooth) {
return;
}
this.prepareReset();
} }
prepareReset() { prepareReset() {