@@ -83,7 +83,7 @@ export default {
83
83
components: {
84
84
VueDraggableResizable
85
85
},
86
- data () {
86
+ data () {
87
87
// console.log("Component Map", this.componentMap);
88
88
return {
89
89
modalOpen: false ,
@@ -96,13 +96,13 @@ export default {
96
96
initialSize: {w: 0 ,h: 0 ,},
97
97
};
98
98
},
99
- mounted () {
99
+ mounted () {
100
100
// when component is mounted add ability to delete
101
101
102
102
window .addEventListener (" keyup" , event => {
103
103
if (event .key === " Backspace" ) {
104
- if (this .activeComponent && this .activeComponentData .isActive ) {
105
- // console.log('this:', this)
104
+ if (this .activeComponent /* && this.activeComponentData.isActive*/ ) {
105
+ // console.log('this:', this)
106
106
this .$store .dispatch (" deleteActiveComponent" );
107
107
}
108
108
}
@@ -138,7 +138,7 @@ export default {
138
138
// console.log('component parent',component.parent)
139
139
// console.log('component parent parent', component.parent.parent)
140
140
if (! Object .keys (component .parent ).length ) return lineage;
141
- for (var parents in component .parent ){
141
+ for (var parents in component .parent ) {
142
142
// for each parent in our component
143
143
console .log (' parents' , parents)
144
144
lineage .push (parents); // push the parent into lineage
@@ -168,21 +168,21 @@ export default {
168
168
});
169
169
},
170
170
userImage () {
171
- const imgSrc = this .imagePath .length ? ` file://` + this .imagePath [0 ] : " " ;
171
+ console .log (' userImage is working' )
172
+ const imgSrc = ` file://` + this .imagePath [this .activeRoute ];
172
173
// const imgSrc1 = this.imagePath;
173
174
console .log (` imgSrc: ${ imgSrc} ` );
174
175
return imgSrc;
175
176
},
176
177
mockBg () {
177
- return this .imagePath .length
178
+ console .log (' mockBg is working' , this .imagePath [this .activeRoute ])
179
+ return this .imagePath [this .activeRoute ]
178
180
? {
179
- background: ` url("${ this .userImage } ") no-repeat center` ,
180
- " background-size" : " cover"
181
- }
182
- : {};
181
+ background: ` url("${ this .userImage } ") center/contain no-repeat`
182
+ }
183
+ : {}
183
184
}
184
185
},
185
-
186
186
updated () {
187
187
// console.log("updated")
188
188
if (this .activeComponent === ' ' )
@@ -194,20 +194,18 @@ export default {
194
194
element .$emit (' update:active' , false )
195
195
196
196
})}
197
+ } else {
198
+ this .$refs .boxes .forEach ((element )=> {
199
+ // added "element.enabled === false to stop it from emitting a change every frame the box moves
200
+ // may need to re-enable to track box movement and resizing since that stuff isn't part of a single source of truth.
201
+ if (this .activeComponent === element .$attrs .id && element .enabled === false ) {
202
+ element .enabled = true
203
+ element .$emit (' activated' )
204
+ element .$emit (' update:active' , true )
205
+ }
206
+ })
197
207
}
198
- else {
199
- this .$refs .boxes .forEach ((element )=> {
200
- // added "element.enabled === false to stop it from emitting a change every frame the box moves
201
- // may need to re-enable to track box movement and resizing since that stuff isn't part of a single source of truth.
202
- if (this .activeComponent === element .$attrs .id && element .enabled === false )
203
- {
204
- element .enabled = true
205
- element .$emit (' activated' )
206
- element .$emit (' update:active' , true )
207
- }
208
- })
209
- }
210
- },
208
+ },
211
209
212
210
methods: {
213
211
... mapActions ([
@@ -236,8 +234,8 @@ export default {
236
234
console .log (" we started a drag" )
237
235
console .log (" this.intialPosition" ,this .initialPosition )
238
236
console .log (" WHAT IS THIS" , this )
239
- if (this .activeComponent !== e .target .id ){
240
- this .setActiveComponent (e .target .id )
237
+ if (this .activeComponent !== e .target .id ) {
238
+ this .setActiveComponent (e .target .id )
241
239
}
242
240
this .initialPosition .x = this .activeComponentData .x
243
241
this .initialPosition .y = this .activeComponentData .y
@@ -246,7 +244,7 @@ export default {
246
244
// console.log(this.initialPosition.x)
247
245
// console.log(this.initialPosition.y)
248
246
249
- let payload = {
247
+ let payload = {
250
248
x: this .initialPosition .x ,
251
249
y: this .initialPosition .y ,
252
250
activeComponent: this .activeComponent ,
@@ -257,15 +255,14 @@ export default {
257
255
// this.updateStartingPosition(payload);
258
256
},
259
257
260
- recordInitialSize : function (e ){
261
- console .log (" MAKE MY MONSTER GROW!" )
262
-
258
+ recordInitialSize : function (e ) {
259
+ // console.log("MAKE MY MONSTER GROW!")
263
260
this .initialSize .h = this .activeComponentData .h
264
261
this .initialSize .w = this .activeComponentData .w
265
262
this .initialPosition .x = this .activeComponentData .x
266
263
this .initialPosition .y = this .activeComponentData .y
267
264
268
- let payload = {
265
+ let payload = {
269
266
h: this .initialSize .h ,
270
267
w: this .initialSize .w ,
271
268
x: this .activeComponentData .x ,
@@ -279,7 +276,7 @@ export default {
279
276
280
277
},
281
278
282
- finishedResize : function (x ,y ,w ,h ){
279
+ finishedResize : function (x ,y ,w ,h ) {
283
280
console .log (" FINISHED RESIZING" )
284
281
let payload = {
285
282
x: x,
@@ -290,8 +287,8 @@ export default {
290
287
routeArray: this .routes [this .activeRoute ],
291
288
activeComponentData: this .activeComponentData
292
289
}
293
- if (payload .x !== this .initialPosition .x || payload .y !== this .initialPosition .y ||
294
- payload .w !== this .initialSize .w || payload .h !== this .initialSize .h ){
290
+ if (payload .x !== this .initialPosition .x || payload .y !== this .initialPosition .y ||
291
+ payload .w !== this .initialSize .w || payload .h !== this .initialSize .h ) {
295
292
this .updateComponentSize (payload)
296
293
}
297
294
},
@@ -305,7 +302,7 @@ export default {
305
302
this .userImage ;
306
303
},
307
304
308
- finishedDrag : function (x ,y ){
305
+ finishedDrag : function (x ,y ) {
309
306
console .log (" FINISHED DRAGGING" )
310
307
let payload = {
311
308
x: x,
@@ -316,7 +313,7 @@ export default {
316
313
}
317
314
// console.log("Payload.x = ", payload.x, "this.initialPosition.x", this.initialPosition.x)
318
315
// console.log("Payload.y = ", payload.y, "this.initialPosition.y", this.initialPosition.y)
319
- if (payload .x !== this .initialPosition .x || payload .y !== this .initialPosition .y ){
316
+ if (payload .x !== this .initialPosition .x || payload .y !== this .initialPosition .y ) {
320
317
this .updateComponentPosition (payload);
321
318
}
322
319
},
@@ -333,29 +330,27 @@ export default {
333
330
// console.log("this is what is currently active",this.activeComponent)
334
331
// console.log("this is this", this)
335
332
// console.log('!(componentData.componentName === this.activeComponent)?',!(componentData.componentName === this.activeComponent))
336
- if (! (componentData .componentName === this .activeComponent )){
333
+ if (! (componentData .componentName === this .activeComponent )) {
337
334
this .setActiveComponent (componentData .componentName );
338
335
}
339
336
this .activeComponentData .isActive = true ;
340
-
341
-
342
337
},
343
338
344
339
// deactivated is emitted before activated
345
340
346
- onDeactivated (componentData ) {
347
- if (this .activeComponent !== ' ' ){
348
- this .activeComponentData .isActive = false ;
341
+ onDeactivated (componentData ) {
342
+ if (this .activeComponent !== ' ' ) {
343
+ this .activeComponentData .isActive = false ;
349
344
}
350
- // console.log("Componentdataname", componentData.componentName)
351
- // console.log("active component",this.activeComponent)
345
+ // console.log("Componentdataname", componentData.componentName)
346
+ // console.log("active component",this.activeComponent)
352
347
// if(componentData.componentName === this.activeComponent)
353
348
// {
354
349
// console.log("We just clicked without making a new active component")
355
350
// }
356
351
},
357
- onDoubleClick (compData ) {
358
- if (! (componentData .componentName === this .activeComponent )){
352
+ onDoubleClick (compData ) {
353
+ if (! (componentData .componentName === this .activeComponent )) {
359
354
this .setActiveComponent (componentData .componentName );
360
355
}
361
356
this .activeComponentData .isActive = true ;
@@ -411,7 +406,7 @@ export default {
411
406
z-index : -1 ;
412
407
}
413
408
.component-children {
414
- position : absolute ;
409
+ position : relative ;
415
410
top : 0rem ;
416
411
left : 2px ;
417
412
color : black ;
0 commit comments