mirror of
https://github.com/infeng/react-viewer.git
synced 2025-12-08 17:36:40 +00:00
optimise image change
This commit is contained in:
parent
44e6a4d5e0
commit
104ef64873
@ -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
|
||||
|
||||
@ -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}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user