From 4b18969a243754f6b643d895cd8d0719c752fb97 Mon Sep 17 00:00:00 2001 From: linexjlin Date: Tue, 5 Dec 2023 17:05:18 +0800 Subject: [PATCH] fix for npm run build --- src/Editor.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Editor.tsx b/src/Editor.tsx index c28df2c..f235af9 100644 --- a/src/Editor.tsx +++ b/src/Editor.tsx @@ -101,7 +101,7 @@ export default function Editor(props: EditorProps) { throw new Error('could not retrieve mask canvas') } // Just need the finishing touch - const line = lines.at(-1) + const line = lines.slice(-1)[0] if (line) drawLines(ctx, [line], 'white') }, [context?.canvas.height, context?.canvas.width, lines, maskCanvas]) @@ -153,7 +153,7 @@ export default function Editor(props: EditorProps) { if (!original.src || showOriginal) { return } - if (lines.at(-1)?.pts.length === 0) { + if (lines.slice(-1)[0]?.pts.length === 0) { return } setIsInpaintingLoading(true) @@ -175,7 +175,7 @@ export default function Editor(props: EditorProps) { const start = Date.now() console.log('inpaint_start') // each time based on the last result, the first is the original - const newFile = renders.at(-1) ?? file + const newFile = renders.slice(-1)[0] ?? file const res = await inpaint(newFile, maskCanvas.toDataURL()) if (!res) { throw new Error('empty response')