Skip to content

Commit

Permalink
画像の外をクリックした場合の挙動を本家に合わせる
Browse files Browse the repository at this point in the history
  • Loading branch information
mohemohe committed Jan 15, 2023
1 parent 14aeda1 commit 6803fce
Showing 1 changed file with 5 additions and 4 deletions.
Expand Up @@ -51,9 +51,10 @@ export default class ImageLoader extends PureComponent {
this.removers = [];
}

onClickContainer = onClick => e => {
onClickImage = e => {
e.stopPropagation();
onClick();
e.preventDefault();
return false;
}

onLoadImage = e => {
Expand Down Expand Up @@ -110,7 +111,7 @@ export default class ImageLoader extends PureComponent {
});

return (
<div className={className} onClick={this.onClickContainer(onClick)}>
<div className={className} onClick={onClick}>
{loading && (
<>
<div className='loading-bar__container'>
Expand Down Expand Up @@ -142,7 +143,7 @@ export default class ImageLoader extends PureComponent {
transformOrigin: 'left top',
}}
>
<img src={src} alt={alt} onLoad={this.onLoadImage} style={{ visibility: this.state.visibility }} />
<img src={src} alt={alt} onLoad={this.onLoadImage} style={{ visibility: this.state.visibility }} onClick={this.onClickImage} />
</TransformComponent>
);
}}
Expand Down

0 comments on commit 6803fce

Please sign in to comment.