feat(Image): support reset action in toolbarRender (#48936)

* feat: support reset action in toolbarRender

* feat: support reset action in toolbarRender

* Update components/image/index.zh-CN.md

Co-authored-by: afc163 <afc163@gmail.com>
Signed-off-by: kiner-tang <1127031143@qq.com>

* Update components/image/index.en-US.md

Signed-off-by: kiner-tang <1127031143@qq.com>

---------

Signed-off-by: kiner-tang <1127031143@qq.com>
Co-authored-by: afc163 <afc163@gmail.com>
This commit is contained in:
kiner-tang 2024-05-16 15:33:22 +08:00 committed by GitHub
parent 1d138e999c
commit 7a2f5f6f1b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 18 additions and 3 deletions

View File

@ -1,6 +1,7 @@
import React from 'react';
import {
DownloadOutlined,
UndoOutlined,
RotateLeftOutlined,
RotateRightOutlined,
SwapOutlined,
@ -38,7 +39,15 @@ const App: React.FC = () => {
_,
{
transform: { scale },
actions: { onFlipY, onFlipX, onRotateLeft, onRotateRight, onZoomOut, onZoomIn },
actions: {
onFlipY,
onFlipX,
onRotateLeft,
onRotateRight,
onZoomOut,
onZoomIn,
onReset,
},
},
) => (
<Space size={12} className="toolbar-wrapper">
@ -49,6 +58,7 @@ const App: React.FC = () => {
<RotateRightOutlined onClick={onRotateRight} />
<ZoomOutOutlined disabled={scale === 1} onClick={onZoomOut} />
<ZoomInOutlined disabled={scale === 50} onClick={onZoomIn} />
<UndoOutlined onClick={onReset} />
</Space>
),
}}

View File

@ -156,6 +156,8 @@ type TransformAction =
onRotateRight: () => void;
onZoomOut: () => void;
onZoomIn: () => void;
onReset: () => void; // support after 5.17.3
onClose: () => void;
};
transform: TransformType,
current: number;

View File

@ -135,7 +135,8 @@ type TransformAction =
| 'wheel'
| 'doubleClick'
| 'move'
| 'dragRebound';
| 'dragRebound'
| 'reset';
```
### ToolbarRenderInfoType
@ -157,6 +158,8 @@ type TransformAction =
onRotateRight: () => void;
onZoomOut: () => void;
onZoomIn: () => void;
onReset: () => void; // 5.17.3 之后支持
onClose: () => void;
};
transform: TransformType,
current: number;

View File

@ -137,7 +137,7 @@
"rc-drawer": "~7.1.0",
"rc-dropdown": "~4.2.0",
"rc-field-form": "~2.2.0",
"rc-image": "~7.7.0",
"rc-image": "~7.8.0",
"rc-input": "~1.4.5",
"rc-input-number": "~9.0.0",
"rc-mentions": "~2.11.1",