Skip to content

Commit

Permalink
fix(Watcher): add scrollBy method
Browse files Browse the repository at this point in the history
  • Loading branch information
daybrush committed Feb 20, 2018
1 parent 345c210 commit 3641a31
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Watcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
removeEvent,
scroll,
scrollTo,
scrollBy,
} from "./utils";

export default class Watcher {
Expand Down Expand Up @@ -36,6 +37,12 @@ export default class Watcher {
this._prevPos = status._prevPos;
applyScrollPos && this.scrollTo(status.scrollPos);
}
scrollBy(pos) {
const arrPos = this._renderer.options.isVertical ? [0, pos] : [pos, 0];

scrollBy(this._renderer.view, ...arrPos);
this.setScrollPos();
}
scrollTo(pos) {
const arrPos = this._renderer.options.isVertical ? [0, pos] : [pos, 0];

Expand Down

0 comments on commit 3641a31

Please sign in to comment.