Skip to content

Let's use AI to Earn!

fix: Fixed the bug where clicking on the preset cropping ratio had a probability of being invalid

gaoSir47f90eda8ff6
diff --git a/src/components/ImageEditorModal/index.tsx b/src/components/ImageEditorModal/index.tsx
index af8f7dcc..546b9744 100644
--- a/src/components/ImageEditorModal/index.tsx
+++ b/src/components/ImageEditorModal/index.tsx
@@ -78,15 +78,14 @@ const ImageEditorModal = memo(
newPreset.classList.remove(originClass);
newPreset.classList.add(newClass);
cropCon.appendChild(newPreset);
- cropCon.addEventListener("click", (e) => {
- const target = e.target as HTMLElement;
- if (target.closest(`.${newClass}`)) {
+ newPreset.onclick = () => {
+ setTimeout(() => {
const inst = imageEditorRef.current?.getInstance();
inst.stopDrawingMode();
inst.startDrawingMode("CROPPER");
inst.setCropzoneRect(mode);
- }
- });
+ }, 10);
+ };
}
useEffect(() => {
@@ -113,7 +112,10 @@ const ImageEditorModal = memo(
width={1100}
footer={
<>
- <Button size="large" onClick={onCancel}>
+ <Button
+ size="large"
+ onClick={onCancel}
+ >
{account.t("deleteConfirm.cancel")}
</Button>
<Button