fix the image preview display

This commit is contained in:
caranicas 2022-09-14 17:56:38 -04:00
parent 4979e176c7
commit 37592a876e
5 changed files with 21 additions and 10 deletions

View File

@ -1,3 +1,7 @@
input[size="4"] { input[size="4"] {
width: 4.5rem; width: 4.5rem;
} }
#File-Body>#File-For {
display: none;
}

View File

@ -46,3 +46,8 @@ li {
.modifierTag p { .modifierTag p {
margin: 0; margin: 0;
} }
input[type="file"] {
/* Dont show the file name */
color:transparent;
}

View File

@ -32,6 +32,7 @@ export default function CreationPanel() {
const reader = new FileReader(); const reader = new FileReader();
reader.onload = (e) => { reader.onload = (e) => {
if (e.target) { if (e.target) {
debugger;
setRequestOption("init_image", e.target.result); setRequestOption("init_image", e.target.result);
} }
}; };
@ -39,6 +40,10 @@ export default function CreationPanel() {
} }
}; };
const _handleClearImage = () => {
setRequestOption("init_image", undefined);
};
return ( return (
<div className="create-panel"> <div className="create-panel">
<div className="basic-create"> <div className="basic-create">
@ -47,11 +52,6 @@ export default function CreationPanel() {
<textarea value={promptText} onChange={handlePromptChange}></textarea> <textarea value={promptText} onChange={handlePromptChange}></textarea>
</div> </div>
{/* <div className="seed-image">
<p>Seed Image</p>
<input type="file" accept="image/*" />
</div> */}
<div id="editor-inputs-init-image" className="row"> <div id="editor-inputs-init-image" className="row">
<label> <label>
<b>Initial Image:</b> (optional){" "} <b>Initial Image:</b> (optional){" "}
@ -63,19 +63,21 @@ export default function CreationPanel() {
onChange={_handleFileSelect} onChange={_handleFileSelect}
/> />
<br /> <br />
{init_image && (
<div id="init_image_preview" className="image_preview"> <div id="init_image_preview" className="image_preview">
{init_image && (
<img <img
id="init_image_preview" id="init_image_preview"
src={init_image} src={init_image}
width="100" width="100"
height="100" height="100"
/> />
)}
<button id="init_image_clear" className="image_clear_btn"> <button id="init_image_clear" className="image_clear_btn" onClick={_handleClearImage}>
X X
</button> </button>
</div> </div>
)}
</div> </div>
<MakeButton></MakeButton> <MakeButton></MakeButton>

View File

@ -58,8 +58,8 @@ export default function GeneratedImage({
}; };
const _handleUseAsInput = () => { const _handleUseAsInput = () => {
console.log(" TODO : use as input");
debugger;
setRequestOption("init_image", imageData); setRequestOption("init_image", imageData);
// initImageSelector.value = null // initImageSelector.value = null
// initImagePreview.src = imgBody // initImagePreview.src = imgBody

View File

@ -202,7 +202,7 @@ export const useImageCreate = create<ImageCreateState>(
isCheckUseFaceCorrection: true, isCheckUseFaceCorrection: true,
isUseRandomSeed: true, isUseRandomSeed: true,
isUseAutoSave: false, isUseAutoSave: false,
isSoundEnabled: true, isSoundEnabled: false,
}, },
toggleAdvancedSettingsIsOpen: () => { toggleAdvancedSettingsIsOpen: () => {