|
7 | 7 | <img class="gal_img" style="width: 90%;" src="https://colormadehappy.com/wp-content/uploads/2022/02/How-to-draw-a-cute-dog-6.jpg"/> |
8 | 8 | --> |
9 | 9 |
|
10 | | - <div v-if="inp_img" class="image_area" :class="{ crosshair_cur : is_inpaint }" style="height: calc(100% - 200px); border-radius: 16px; padding:5px;"> |
| 10 | + <div v-if="inp_img" @drop.prevent="onDragFile" @dragover.prevent class="image_area" :class="{ crosshair_cur : is_inpaint }" style="height: calc(100% - 200px); border-radius: 16px; padding:5px;"> |
11 | 11 | <ImageCanvas ref="inp_img_canvas" :is_inpaint="is_inpaint" :image_source="inp_img" :is_disabled="!stable_diffusion.is_input_avail" canvas_id="img2imgcan" canvas_d_id="img2imgcand" ></ImageCanvas> |
12 | 12 | </div> |
13 | | - <div v-else @click="open_input_image" class="image_area" :class="{ pointer_cursor : is_sd_active }" style="height: calc(100% - 200px); border-radius: 16px; padding:5px;"> |
14 | | - <center> |
| 13 | + <div v-else @drop.prevent="onDragFile" @dragover.prevent @click="open_input_image" class="image_area" :class="{ pointer_cursor : is_sd_active }" style="height: calc(100% - 200px); border-radius: 16px; padding:5px;"> |
| 14 | + <center> |
15 | 15 | <p style="margin-top: calc( 50vh - 180px); opacity: 70%;" >Click to add input image</p> |
16 | 16 | </center> |
17 | 17 | </div> |
|
40 | 40 |
|
41 | 41 | <div v-if="stable_diffusion.is_input_avail" class="content_toolbox" style="margin-top:10px; margin-bottom:-10px;"> |
42 | 42 | <div class="l_button button_medium button_colored" style="float:right ; " @click="generate_img2img" >Generate</div> |
43 | | - <SDOptionsDropdown :options_model_values="this_object" :elements_hidden="['img_h' , 'img_w' , 'batch_size']"> </SDOptionsDropdown> |
| 43 | + <SDOptionsDropdown :options_model_values="this_object" :elements_hidden="['img_h' , 'img_w' ]"> </SDOptionsDropdown> |
44 | 44 | </div> |
45 | 45 | <div v-else-if="stable_diffusion.generated_by=='img2img'" class="content_toolbox" style="margin-top:10px; margin-bottom:-10px;"> |
46 | 46 | <div v-if="is_stopping" class="l_button button_medium button_colored" style="float:right" @click="stop_generation">Stopping ...</div> |
@@ -240,8 +240,18 @@ export default { |
240 | 240 | if(img_path && img_path != 'NULL'){ |
241 | 241 | this.inp_img = img_path; |
242 | 242 | this.is_inpaint = false; |
243 | | - } |
244 | | - |
| 243 | + } |
| 244 | + }, |
| 245 | + onDragFile(e){ |
| 246 | + if( !this.stable_diffusion.is_input_avail) |
| 247 | + return; |
| 248 | + if(!e.dataTransfer.files[0].type.startsWith('image/')) |
| 249 | + return; |
| 250 | + let img_path = e.dataTransfer.files[0].path; |
| 251 | + if(img_path && img_path != 'NULL'){ |
| 252 | + this.inp_img = img_path; |
| 253 | + this.is_inpaint = false; |
| 254 | + } |
245 | 255 | }, |
246 | 256 |
|
247 | 257 | stop_generation(){ |
|
0 commit comments