diff --git a/README.md b/README.md index 87d1b51..fd882ef 100644 --- a/README.md +++ b/README.md @@ -51,13 +51,6 @@ class App extends React.Component { | images | string[] | [] | image source array | true | | activeIndex | number | 0 | active image index | false | -## TODO - -- [ ] add button icon -- [ ] add toolbar -- [X] optimize image zoom -- [ ] optimise image change - ## License MIT diff --git a/src/ViewerNav.tsx b/src/ViewerNav.tsx index ad8563c..bcef142 100644 --- a/src/ViewerNav.tsx +++ b/src/ViewerNav.tsx @@ -17,9 +17,14 @@ export default class ViewerNav extends React.Component { } render() { + let marginLeft = (Math.ceil(this.props.images.length / 2) - this.props.activeIndex - 1) * 1.5 * 30; + let listStyle = { + marginLeft: `${marginLeft}px`, + }; + return (
-
    +
      {this.props.images.map((item, index) =>