commit
831538e37b
3 changed files with 3802 additions and 3074 deletions
6809
package-lock.json
generated
6809
package-lock.json
generated
File diff suppressed because it is too large
Load diff
14
package.json
14
package.json
|
@ -28,11 +28,11 @@
|
|||
"babel-preset-preact": "^1.1.0",
|
||||
"babel-preset-stage-2": "^6.24.1",
|
||||
"chai": "^4.2.0",
|
||||
"css-loader": "^2.1.0",
|
||||
"eslint": "^5.13.0",
|
||||
"css-loader": "^2.1.1",
|
||||
"eslint": "^5.15.1",
|
||||
"eslint-plugin-react": "^7.12.4",
|
||||
"html-webpack-plugin": "^3.2.0",
|
||||
"karma": "^4.0.0",
|
||||
"karma": "^4.0.1",
|
||||
"karma-firefox-launcher": "^1.1.0",
|
||||
"karma-html2js-preprocessor": "^1.1.0",
|
||||
"karma-mocha": "^1.3.0",
|
||||
|
@ -40,7 +40,7 @@
|
|||
"karma-sinon": "^1.0.5",
|
||||
"karma-sourcemap-loader": "^0.3.7",
|
||||
"karma-webpack": "^3.0.5",
|
||||
"mocha": "^5.2.0",
|
||||
"mocha": "^6.0.2",
|
||||
"node-sass": "^4.11.0",
|
||||
"preact": "^8.4.2",
|
||||
"preact-redux": "^2.0.3",
|
||||
|
@ -49,9 +49,9 @@
|
|||
"sass-loader": "^7.1.0",
|
||||
"sinon-chrome": "^2.3.2",
|
||||
"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",
|
||||
"webpack": "^4.20.2",
|
||||
"webpack-cli": "^3.1.2"
|
||||
"webpack": "^4.29.6",
|
||||
"webpack-cli": "^3.2.3"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,29 +62,22 @@ class Scroller {
|
|||
}
|
||||
|
||||
scrollTo(x, y) {
|
||||
let behavior = this.smooth ? 'smooth' : 'auto';
|
||||
window.scrollTo({
|
||||
left: x,
|
||||
top: y,
|
||||
behavior: behavior,
|
||||
});
|
||||
if (!this.smooth) {
|
||||
this.element.scrollTo(x, y);
|
||||
return;
|
||||
}
|
||||
this.element.scrollTo({
|
||||
left: x,
|
||||
top: y,
|
||||
behavior: 'smooth',
|
||||
});
|
||||
this.prepareReset();
|
||||
}
|
||||
|
||||
scrollBy(x, y) {
|
||||
let behavior = this.smooth ? 'smooth' : 'auto';
|
||||
window.scrollBy({
|
||||
left: x,
|
||||
top: y,
|
||||
behavior: behavior,
|
||||
});
|
||||
if (!this.smooth) {
|
||||
return;
|
||||
}
|
||||
this.prepareReset();
|
||||
let left = this.element.scrollLeft + x;
|
||||
let top = this.element.scrollTop + y;
|
||||
this.scrollTo(left, top);
|
||||
}
|
||||
|
||||
prepareReset() {
|
||||
|
|
Reference in a new issue