optimise image change

This commit is contained in:
infeng 2016-10-17 17:23:11 +08:00
parent 44e6a4d5e0
commit 104ef64873
2 changed files with 6 additions and 8 deletions

View File

@ -51,13 +51,6 @@ class App extends React.Component<any, any> {
| 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

View File

@ -17,9 +17,14 @@ export default class ViewerNav extends React.Component<ViewerNavProps, any> {
}
render() {
let marginLeft = (Math.ceil(this.props.images.length / 2) - this.props.activeIndex - 1) * 1.5 * 30;
let listStyle = {
marginLeft: `${marginLeft}px`,
};
return (
<div className={`${this.props.prefixCls}-navbar`}>
<ul className={`${this.props.prefixCls}-list`}>
<ul className={`${this.props.prefixCls}-list ${this.props.prefixCls}-transition`} style={listStyle}>
{this.props.images.map((item, index) =>
<li
key={index}