1818 style =" border-radius : 12px 12px 12px 12px ; width : calc (100% ); resize : none ; "
1919 class =" form-control outpaint_textbox"
2020 v-bind:class =" { 'disabled' : !stable_diffusion.is_input_avail}"
21- :rows =" 2" >
21+ :rows =" is_negative_prompt_avail ? 1:2" >
22+ </textarea >
23+ <textarea
24+ v-if =" is_negative_prompt_avail"
25+ v-model =" negative_prompt"
26+ placeholder =" Enter your negative prompt here"
27+ style =" border-radius : 12px 12px 12px 12px ; width : calc (100% );font-size :13px ; margin-top :14px ; resize : none ; "
28+ class =" form-control outpaint_textbox"
29+ v-bind:class =" { 'disabled' : !stable_diffusion.is_input_avail}"
30+ :rows =" is_negative_prompt_avail ? 1:2" >
2231 </textarea >
2332
2433
2534
2635
27- <div v-if =" stable_diffusion.is_input_avail" style =" margin-top : 20 px " >
28-
36+ <div v-if =" stable_diffusion.is_input_avail" style =" margin-top : 15 px " >
37+ < SDOptionsDropdown :style = " is_negative_prompt_avail?'margin-top:-43px':'' " :options_model_values = " this_object " :elements_hidden = " [ 'num_imgs', 'inp_img_strength', 'batch_size', 'guidence_scale', 'img_h', 'custom_model', 'seed'] " > </ SDOptionsDropdown >
2938 <div class =" l_button button_medium button_colored" style =" float :right ; " @click =" generate()" >Generate</div >
30-
31-
3239 </div >
3340 <span v-else-if =" stable_diffusion.generated_by=='outpainting'" >
3441 <div v-if =" is_stopping" class =" l_button button_medium button_colored" style =" float :right ; float :right ; margin-top : 20px ; " @click =" stop_generation" >Stopping ...</div >
4350 </div >
4451
4552 <div v-if =" !stable_diffusion.is_input_avail && stable_diffusion.generated_by=='outpainting'" >
46- <LoaderModal :loading_percentage =" done_percentage" loading_title =" Generating" :loading_desc =" stable_diffusion.generation_state_msg" ></LoaderModal >
53+ <LoaderModal :loading_percentage =" done_percentage" loading_title =" Generating" :loading_desc =" stable_diffusion.generation_state_msg" :remaining_times = " stable_diffusion.remaining_times " ></LoaderModal >
4754 </div >
4855
4956 <p style =" opacity :0.5 ; zoom :0.8 ; float :left ; max-width : calc (100vw - 200px ); margin-bottom : 0 ; " > Please describe image you want to draw in the box. </p >
5461import Konva from ' konva' ;
5562import LoaderModal from ' ../components_bare/LoaderModal.vue'
5663import Vue from ' vue'
64+ import SDOptionsDropdown from ' ../components_bare/SDOptionsDropdown.vue'
5765
5866function onVisible (element , callback ) {
5967 new IntersectionObserver ((entries , observer ) => {
@@ -74,7 +82,7 @@ export default {
7482 app_state : Object ,
7583 stable_diffusion : Object ,
7684 },
77- components: {LoaderModal},
85+ components: {LoaderModal, SDOptionsDropdown },
7886 mounted () {
7987 this .init_state ();
8088 this .resize_stage ()
@@ -94,6 +102,9 @@ export default {
94102
95103 is_earasing: false ,
96104 is_eraser_enabled: false ,
105+ is_negative_prompt_avail : false ,
106+ negative_prompt : " " ,
107+ selected_model : ' Default'
97108 };
98109 },
99110 watch: {
@@ -116,7 +127,11 @@ export default {
116127 deep: true
117128 } ,
118129 },
119-
130+ computed: {
131+ this_object (){
132+ return this ;
133+ }
134+ },
120135 methods: {
121136 init_state (){
122137 let that = this ;
@@ -200,6 +215,19 @@ export default {
200215 this .box_layer = new Konva.Layer ();
201216 this .stage .add (this .box_layer );
202217 this .box_layer .add (box);
218+
219+ let tr = new Konva.Transformer ({keepRatio : true , rotateEnabled: false , flipEnabled: false , enabledAnchors: [' top-left' , ' top-right' , ' bottom-left' , ' bottom-right' ] });
220+ this .box_layer .add (tr);
221+ tr .nodes ([box]);
222+
223+ box .on (' transform' , function () {
224+ box .setAttrs ({
225+ width: Math .round (box .width () * box .scaleX ()),
226+ height: Math .round (box .height () * box .scaleY ()),
227+ scaleX: 1 ,
228+ scaleY: 1
229+ });
230+ });
203231
204232 this .resize_stage ()
205233
@@ -304,7 +332,7 @@ export default {
304332 add_img_to_stage (img_path , is_resizable ){
305333
306334 let that = this ;
307- let scale = that .box .width () / 512 // IMP rn i am assuming that the returned image will be 512x512
335+ let scale = that .box .scaleX ()
308336
309337 this .freeze_last_resizable_img ()
310338
@@ -315,8 +343,18 @@ export default {
315343 x: that .box .x (),
316344 y: that .box .y (),
317345 scaleX: scale,
318- scaleY: scale ,
346+ scaleY: scale,
347+ });
348+
349+
350+ if (imgg .width () == imgg .height ()){
351+ imgg .setAttrs ({
352+ width: that .box .width (),
353+ height: that .box .height (),
319354 });
355+ }
356+
357+
320358 that .images_layer .add (imgg);
321359
322360 let box = new Konva.Rect ({
@@ -474,6 +512,9 @@ export default {
474512 this .done_percentage = - 1 ;
475513 this .is_stopping = false ;
476514
515+ if (this .is_negative_prompt_avail )
516+ params[' negative_prompt' ] = this .negative_prompt ;
517+
477518 let that = this ;
478519
479520 let callbacks = {
@@ -489,6 +530,9 @@ export default {
489530 },
490531 }
491532
533+ if (this .is_negative_prompt_avail )
534+ params[' negative_prompt' ] = this .negative_prompt ;
535+
492536 if (this .stable_diffusion )
493537 this .stable_diffusion .text_to_img (params, callbacks, ' outpainting' );
494538
0 commit comments