aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/imageEditor/ImageEditor.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/nodes/imageEditor/ImageEditor.tsx')
-rw-r--r--src/client/views/nodes/imageEditor/ImageEditor.tsx69
1 files changed, 11 insertions, 58 deletions
diff --git a/src/client/views/nodes/imageEditor/ImageEditor.tsx b/src/client/views/nodes/imageEditor/ImageEditor.tsx
index 2ae6ee1dd..6b1d05031 100644
--- a/src/client/views/nodes/imageEditor/ImageEditor.tsx
+++ b/src/client/views/nodes/imageEditor/ImageEditor.tsx
@@ -551,8 +551,7 @@ const ImageEditor = ({ imageEditorOpen, imageEditorSource, imageRootDoc, addDoc
img.src = src;
if (!currImg.current || !originalImg.current || !imageRootDoc) return undefined;
try {
- const res = await createNewImgDoc(img, false);
- return res;
+ return await createNewImgDoc(img, false);
} catch (err) {
console.log(err);
}
@@ -589,9 +588,7 @@ const ImageEditor = ({ imageEditorOpen, imageEditorSource, imageRootDoc, addDoc
// disable once edited has been clicked (doesn't make sense to change after first edit)
disabled={edited}
checked={isNewCollection}
- onChange={() => {
- setIsNewCollection(prev => !prev);
- }}
+ onChange={() => setIsNewCollection(prev => !prev)}
/>
}
label="Create New Collection"
@@ -610,49 +607,13 @@ const ImageEditor = ({ imageEditorOpen, imageEditorSource, imageRootDoc, addDoc
return (
<div className="sideControlsContainer" style={{ backgroundColor: bgColor }}>
<div className="sideControls">
- <div className="imageToolsContainer">
- {imageEditTools.map(tool => {
- return ImageToolButton(tool, tool.type === currTool.type, changeTool);
- })}
- </div>
+ <div className="imageToolsContainer">{imageEditTools.map(tool => ImageToolButton(tool, tool.type === currTool.type, changeTool))}</div>
{currTool.type == ImageToolType.Cut && (
<div className="cutToolsContainer">
- <Button
- style={{ width: '100%' }}
- text="Keep in"
- type={Type.TERT}
- color={cutType == CutMode.IN ? SettingsManager.userColor : bgColor}
- onClick={() => {
- setCutType(CutMode.IN);
- }}
- />
- <Button
- style={{ width: '100%' }}
- text="Keep out"
- type={Type.TERT}
- color={cutType == CutMode.OUT ? SettingsManager.userColor : bgColor}
- onClick={() => {
- setCutType(CutMode.OUT);
- }}
- />
- <Button
- style={{ width: '100%' }}
- text="Draw in"
- type={Type.TERT}
- color={cutType == CutMode.DRAW_IN ? SettingsManager.userColor : bgColor}
- onClick={() => {
- setCutType(CutMode.DRAW_IN);
- }}
- />
- <Button
- style={{ width: '100%' }}
- text="Erase"
- type={Type.TERT}
- color={cutType == CutMode.ERASE ? SettingsManager.userColor : bgColor}
- onClick={() => {
- setCutType(CutMode.ERASE);
- }}
- />
+ <Button style={{ width: '100%' }} text="Keep in" type={Type.TERT} color={cutType == CutMode.IN ? SettingsManager.userColor : bgColor} onClick={() => setCutType(CutMode.IN)} />
+ <Button style={{ width: '100%' }} text="Keep out" type={Type.TERT} color={cutType == CutMode.OUT ? SettingsManager.userColor : bgColor} onClick={() => setCutType(CutMode.OUT)} />
+ <Button style={{ width: '100%' }} text="Draw in" type={Type.TERT} color={cutType == CutMode.DRAW_IN ? SettingsManager.userColor : bgColor} onClick={() => setCutType(CutMode.DRAW_IN)} />
+ <Button style={{ width: '100%' }} text="Erase" type={Type.TERT} color={cutType == CutMode.ERASE ? SettingsManager.userColor : bgColor} onClick={() => setCutType(CutMode.ERASE)} />
</div>
)}
<div className="sliderContainer" onPointerDown={e => e.stopPropagation()}>
@@ -669,9 +630,7 @@ const ImageEditor = ({ imageEditorOpen, imageEditorSource, imageRootDoc, addDoc
defaultValue={genFillTool.sliderDefault}
size="small"
valueLabelDisplay="auto"
- onChange={(e, val) => {
- setCursorData(prev => ({ ...prev, width: val as number }));
- }}
+ onChange={(e, val) => setCursorData(prev => ({ ...prev, width: val as number }))}
/>
)}
{currTool.type === ImageToolType.Cut && (
@@ -687,9 +646,7 @@ const ImageEditor = ({ imageEditorOpen, imageEditorSource, imageRootDoc, addDoc
defaultValue={cutTool.sliderDefault}
size="small"
valueLabelDisplay="auto"
- onChange={(e, val) => {
- setCursorData(prev => ({ ...prev, width: val as number }));
- }}
+ onChange={(e, val) => setCursorData(prev => ({ ...prev, width: val as number }))}
/>
)}
</div>
@@ -701,9 +658,7 @@ const ImageEditor = ({ imageEditorOpen, imageEditorSource, imageRootDoc, addDoc
e.stopPropagation();
handleUndo();
}}
- onPointerUp={e => {
- e.stopPropagation();
- }}
+ onPointerUp={e => e.stopPropagation()}
color={activeColor}
tooltip="Undo"
icon={<IoMdUndo />}
@@ -714,9 +669,7 @@ const ImageEditor = ({ imageEditorOpen, imageEditorSource, imageRootDoc, addDoc
e.stopPropagation();
handleRedo();
}}
- onPointerUp={e => {
- e.stopPropagation();
- }}
+ onPointerUp={e => e.stopPropagation()}
color={activeColor}
tooltip="Redo"
icon={<IoMdRedo />}