diff --git a/components/image/PreviewGroup.tsx b/components/image/PreviewGroup.tsx index e081479d8d..e2f75ebdcd 100644 --- a/components/image/PreviewGroup.tsx +++ b/components/image/PreviewGroup.tsx @@ -11,6 +11,7 @@ import ZoomOutOutlined from '@ant-design/icons-vue/ZoomOutOutlined'; import CloseOutlined from '@ant-design/icons-vue/CloseOutlined'; import LeftOutlined from '@ant-design/icons-vue/LeftOutlined'; import RightOutlined from '@ant-design/icons-vue/RightOutlined'; +import SwapOutlined from '@ant-design/icons-vue/SwapOutlined'; import useStyle from './style'; import { anyType } from '../_util/type'; @@ -22,6 +23,8 @@ export const icons = { close: , left: , right: , + flipX: , + flipY: , }; const previewGroupProps = () => ({ previewPrefixCls: String, diff --git a/components/vc-image/src/Preview.tsx b/components/vc-image/src/Preview.tsx index 1bab98b653..e54f919365 100644 --- a/components/vc-image/src/Preview.tsx +++ b/components/vc-image/src/Preview.tsx @@ -36,6 +36,8 @@ export interface PreviewProps extends Omit { rotate.value -= 90; }; + + const onFlipX = () => { + flip.x = -flip.x; + }; + + const onFlipY = () => { + flip.y = -flip.y; + }; + const onSwitchLeft: MouseEventHandler = event => { event.preventDefault(); // Without this mask close will abnormal @@ -171,6 +185,16 @@ const Preview = defineComponent({ onClick: onRotateLeft, type: 'rotateLeft', }, + { + icon: flipX, + onClick: onFlipX, + type: 'flipX', + }, + { + icon: flipY, + onClick: onFlipY, + type: 'flipY', + }, ]; const onMouseUp: MouseEventHandler = () => { @@ -356,7 +380,9 @@ const Preview = defineComponent({ src={combinationSrc.value} alt={props.alt} style={{ - transform: `scale3d(${scale.value}, ${scale.value}, 1) rotate(${rotate.value}deg)`, + transform: `scale3d(${flip.x * scale.value}, ${flip.y * scale.value}, 1) rotate(${ + rotate.value + }deg)`, }} />