Skip to content

Commit

Permalink
feat: add zoomBy method #34
Browse files Browse the repository at this point in the history
  • Loading branch information
daybrush committed Sep 29, 2022
1 parent c5d485a commit f7f4584
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/infinite-viewer/src/InfiniteViewerManager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,18 @@ class InfiniteViewer extends EventEmitter<InfiniteViewerEvents> {
return this.scrollBy(x - this.getScrollLeft(), y - this.getScrollTop(), options);
}
}
/**
* Set viewer zoom by the given amount
*/
public zoomBy(deltaZoom: number, options?: AnimationOptions) {
this._pauseZoomAnimation();

if (!options || !options.duration) {
this._setZoom(this.zoom + deltaZoom);
} else {
this._startZoomAnimation(deltaZoom, options);
}
}
/**
* Set viewer zoom
*/
Expand Down

0 comments on commit f7f4584

Please sign in to comment.