Merge pull request #547 from ueokande/qa-0.21

QA 0.21
jh-changes
Shin'ya Ueoka 6 years ago committed by GitHub
commit 831538e37b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10941
      package-lock.json
  2. 14
      package.json
  3. 25
      src/content/scrolls.js

10941
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -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"
} }
} }

@ -62,31 +62,24 @@ 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.prepareReset(); this.element.scrollTo({
}
scrollBy(x, y) {
let behavior = this.smooth ? 'smooth' : 'auto';
window.scrollBy({
left: x, left: x,
top: y, top: y,
behavior: behavior, behavior: 'smooth',
}); });
if (!this.smooth) {
return;
}
this.prepareReset(); this.prepareReset();
} }
scrollBy(x, y) {
let left = this.element.scrollLeft + x;
let top = this.element.scrollTop + y;
this.scrollTo(left, top);
}
prepareReset() { prepareReset() {
scrolling = true; scrolling = true;
if (lastTimeoutId) { if (lastTimeoutId) {