From 02df23530b79a4698dd58a6718239c44619d87fd Mon Sep 17 00:00:00 2001 From: zhangmanyan <2811095858@qq.com> Date: Wed, 11 Jul 2018 18:37:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9B=BE=E7=89=87=E6=94=BE?= =?UTF-8?q?=E5=A4=A7=E6=83=85=E5=86=B5=E4=B8=8B=E7=A7=BB=E5=8A=A8=E4=BC=9A?= =?UTF-8?q?=E9=A3=98=E7=A7=BB=E7=9A=84=E6=84=9F=E8=A7=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ImageContainer.jsx | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/components/ImageContainer.jsx b/src/components/ImageContainer.jsx index b864a1c..ea8dd41 100644 --- a/src/components/ImageContainer.jsx +++ b/src/components/ImageContainer.jsx @@ -392,7 +392,7 @@ class ImageContainer extends PureComponent { let x; let y; const { scale } = this.state; - // const width = scale * this.originWidth; + const width = scale * this.originWidth; const height = scale * this.originHeight; // 使用相同速度算法 @@ -401,11 +401,14 @@ class ImageContainer extends PureComponent { if (this.state.scale === this.originScale) { x = 0; - if (height > this.props.screenHeight) { - y = setScope(y, this.props.screenHeight - height, 0); - } else { - y = this.originTop; - } + } else { + x = setScope(x, this.originWidth - width, 0); + } + + if (height > this.props.screenHeight) { + y = setScope(y, this.props.screenHeight - height, 0); + } else { + y = _this.originTop; } // x = setScope(x, this.originWidth - width, 0);