Skip to content

Commit

Permalink
feat(Image): support reset action in toolbarRender (#48936)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
kiner-tang and afc163 committed May 16, 2024
1 parent 1d138e9 commit 7a2f5f6
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
12 changes: 11 additions & 1 deletion components/image/demo/toolbarRender.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import {
DownloadOutlined,
UndoOutlined,
RotateLeftOutlined,
RotateRightOutlined,
SwapOutlined,
Expand Down Expand Up @@ -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">
Expand All @@ -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>
),
}}
Expand Down
2 changes: 2 additions & 0 deletions components/image/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 4 additions & 1 deletion components/image/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ type TransformAction =
| 'wheel'
| 'doubleClick'
| 'move'
| 'dragRebound';
| 'dragRebound'
| 'reset';
```

### ToolbarRenderInfoType
Expand All @@ -157,6 +158,8 @@ type TransformAction =
onRotateRight: () => void;
onZoomOut: () => void;
onZoomIn: () => void;
onReset: () => void; // 5.17.3 之后支持
onClose: () => void;
};
transform: TransformType,
current: number;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 7a2f5f6

Please sign in to comment.