MinJieLiu / react-photo-view

An exquisite React photo preview component.
https://react-photo-view.vercel.app
Apache License 2.0
1.56k stars 130 forks source link

只有一张图片时调用onSacle、onRodate,scale和rotate数值会变化但图片不会进行缩放和旋转 #144

Closed soyox closed 10 months ago

soyox commented 1 year ago
 <PhotoProvider
        loop={true}
        onIndexChange={handleIndexChange}
        toolbarRender={({ onScale, scale, rotate, onRotate }) => {
          return (
            <div>
              {/*scale在每次点击后打印的值都会+1直至最大值,但图片不会缩放*/}
              <PlusCircleOutlined onClick={() => { console.log('scale', scale); onScale(scale + 1) }} />
              <MinusCircleOutlined onClick={() => onScale(scale - 1)} />
              <RedoOutlined onClick={() => onRotate(rotate + 90)} />
              <UndoOutlined onClick={() => onRotate(rotate - 90)} />
              <SyncOutlined onClick={() => onRotate(0)} />
              {editable && <DownloadOutlined onClick={download} />}
            </div>
          );
 }}>
...
</PhotoProvider>
soyox commented 1 year ago

在有多张图片时能正常缩放和旋转

big-camel commented 1 year ago

https://github.com/MinJieLiu/react-photo-view/issues/141

看起来是这个原因吧

MinJieLiu commented 10 months ago

fix: https://github.com/MinJieLiu/react-photo-view/commit/2ccf505e9ec2cd61335a9653a5d8845ae1d73644