From ec29ae17dfcb54316e54bc1f1235318343bfb6bd Mon Sep 17 00:00:00 2001 From: infeng Date: Wed, 19 Oct 2016 14:42:57 +0800 Subject: [PATCH] add keyboard support --- README.md | 12 ++++++++++ src/ViewerCore.tsx | 59 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) diff --git a/README.md b/README.md index f5e9c54..ad82b5c 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,18 @@ class App extends React.Component { | activeIndex | number | 0 | active image index | false | | zIndex | number | 1000 | Viewer css z-index | false | +## Keyboard support + +- `Esc`: Close viewer. +- `←`: View the previous image. +- `→`: View the next image. +- `↑`: Zoom in the image. +- `↓`: Zoom out the image. +- `Ctrl + 1`: Reset the image. +- `Ctrl + ←`: Rotate left the image. +- `Ctrl + →`: Rotate right the image. + + ## License MIT diff --git a/src/ViewerCore.tsx b/src/ViewerCore.tsx index ad12feb..8b4c575 100644 --- a/src/ViewerCore.tsx +++ b/src/ViewerCore.tsx @@ -52,6 +52,7 @@ export default class ViewerCore extends React.Component