Skip to content

Commit

Permalink
fix:이미지 에디터 저장 안 됨 + 배경 transparent
Browse files Browse the repository at this point in the history
  • Loading branch information
jinlee0 committed Dec 2, 2023
1 parent a37254d commit c09fa4c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/component/order/editor/Preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ const Preview = ({ isOpen, setIsOpen }) => {
setLoading(false);
}, [editor, selectedEffect]);

const makePreview = async () => {
if (!editor) return;
const makePreview = React.useCallback(async () => {
if (!editor || !selectedEffect) return;
// set frame background by options

selectedEffect.name.includes('실버')
Expand All @@ -80,7 +80,7 @@ const Preview = ({ isOpen, setIsOpen }) => {

setState({ image });
setLoading(false);
};
}, [editor, selectedEffect]);

React.useEffect(() => {
makePreview();
Expand All @@ -90,6 +90,7 @@ const Preview = ({ isOpen, setIsOpen }) => {
const handleSave = React.useCallback(async () => {
await rollbackPreview();

editor.frame.setBackgroundColor('transparent');
const template = editor.scene.exportToJSON();
const image = await editor.renderer.render(template);

Expand All @@ -100,7 +101,7 @@ const Preview = ({ isOpen, setIsOpen }) => {
a.remove();
setIsOpen(false);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [editor]);
}, [editor, selectedEffect]);

const handleChangeRadio = async (e) => {
const currentTargetValue = e.currentTarget.value;
Expand Down

0 comments on commit c09fa4c

Please sign in to comment.