Skip to content

Commit d02032d

Browse files
committed
chore: tslint error
1 parent 69d3ec7 commit d02032d

File tree

3 files changed

+14
-17
lines changed

3 files changed

+14
-17
lines changed

src/ViewerCore.tsx

+11-14
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export default class ViewerCore extends React.Component<ViewerProps, ViewerCoreS
102102
}
103103
}
104104

105-
handleClose = (e) => {
105+
handleClose = () => {
106106
this.props.onClose();
107107
}
108108

@@ -133,14 +133,14 @@ export default class ViewerCore extends React.Component<ViewerProps, ViewerCoreS
133133
core.addEventListener(
134134
'transitionend',
135135
this.handleTransitionEnd,
136-
false
136+
false,
137137
);
138138
// Though onWheel can be directly used on the div "viewerCore", to be able to
139139
// prevent default action, a listener is added here instead
140140
(this.refs['viewerCore'] as HTMLDivElement).addEventListener(
141141
'mousewheel',
142142
this.handleMouseScroll,
143-
false
143+
false,
144144
);
145145
if (this.containerHeight === 0) {
146146
this.setInlineContainerHeight();
@@ -325,7 +325,7 @@ export default class ViewerCore extends React.Component<ViewerProps, ViewerCoreS
325325
if (activeImage.downloadUrl) {
326326
location.href = activeImage.downloadUrl;
327327
}
328-
};
328+
}
329329

330330
handleScaleX = (newScale: 1 | -1) => {
331331
this.setState({
@@ -347,8 +347,6 @@ export default class ViewerCore extends React.Component<ViewerProps, ViewerCoreS
347347
let imgCenterXY = this.getImageCenterXY();
348348
let diffX = targetX - imgCenterXY.x;
349349
let diffY = targetY - imgCenterXY.y;
350-
// when image width is 0, set original width
351-
let reset = false;
352350
let top = 0;
353351
let left = 0;
354352
let width = 0;
@@ -358,9 +356,8 @@ export default class ViewerCore extends React.Component<ViewerProps, ViewerCoreS
358356
if (this.state.width === 0) {
359357
const [imgWidth, imgHeight] = this.getImgWidthHeight(
360358
this.state.imageWidth,
361-
this.state.imageHeight
359+
this.state.imageHeight,
362360
);
363-
reset = true;
364361
left = (this.containerWidth - imgWidth) / 2;
365362
top = (this.containerHeight - this.footerHeight - imgHeight) / 2;
366363
width = this.state.width + imgWidth;
@@ -467,14 +464,14 @@ export default class ViewerCore extends React.Component<ViewerProps, ViewerCoreS
467464
}
468465
}
469466

470-
handleTransitionEnd = e => {
467+
handleTransitionEnd = () => {
471468
if (!this.state.transitionEnd || this.state.visibleStart) {
472469
this.setState({
473470
visibleStart: false,
474471
transitionEnd: true,
475472
});
476473
}
477-
};
474+
}
478475

479476
bindEvent(remove: boolean = false) {
480477
let funcName = 'addEventListener';
@@ -491,7 +488,7 @@ export default class ViewerCore extends React.Component<ViewerProps, ViewerCoreS
491488
(this.refs['viewerCore'] as HTMLDivElement).removeEventListener(
492489
'transitionend',
493490
this.handleTransitionEnd,
494-
false
491+
false,
495492
);
496493
}
497494

@@ -506,7 +503,7 @@ export default class ViewerCore extends React.Component<ViewerProps, ViewerCoreS
506503
this.containerWidth / 2,
507504
(this.containerHeight - this.footerHeight) / 2,
508505
-1,
509-
(this.state.scaleX > 0 ? 1 : -1) * this.state.scaleX - 0.11
506+
(this.state.scaleX > 0 ? 1 : -1) * this.state.scaleX - 0.11,
510507
);
511508
setTimeout(() => {
512509
document.body.style.overflow = '';
@@ -534,7 +531,7 @@ export default class ViewerCore extends React.Component<ViewerProps, ViewerCoreS
534531

535532
handleCanvasMouseDown = e => {
536533
this.props.onMaskClick(e);
537-
};
534+
}
538535

539536
getActiveImage = (activeIndex = undefined) => {
540537
let activeImg: ImageDecorator = {
@@ -555,7 +552,7 @@ export default class ViewerCore extends React.Component<ViewerProps, ViewerCoreS
555552
}
556553

557554
return activeImg;
558-
};
555+
}
559556

560557
handleMouseScroll = (e) => {
561558
if (this.props.disableMouseZoom) {

src/ViewerNav.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export default class ViewerNav extends React.Component<ViewerNavProps, any> {
2323
render() {
2424
let marginLeft = `calc(50% - ${this.props.activeIndex + 1} * 31px)`;
2525
let listStyle = {
26-
marginLeft: marginLeft
26+
marginLeft: marginLeft,
2727
};
2828

2929
return (
@@ -36,7 +36,7 @@ export default class ViewerNav extends React.Component<ViewerNavProps, any> {
3636
onClick={() => { this.handleChangeImg(index); }}
3737
>
3838
<img src={item.src} alt={item.alt} />
39-
</li>
39+
</li>,
4040
)
4141
}
4242
</ul>

src/ViewerToolbar.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export default class ViewerToolbar extends React.Component<ViewerToolbarProps, a
9191
<li
9292
key={config.key}
9393
className={`${this.props.prefixCls}-btn`}
94-
onClick={() => {this.handleAction(config);}}
94+
onClick={() => {this.handleAction(config); }}
9595
data-key={config.key}
9696
>
9797
{content}

0 commit comments

Comments
 (0)