@@ -91,7 +91,7 @@ export default {
91
91
testOptions: [" parent" , " child" , " grandchild" ],
92
92
testModel: [],
93
93
mockImg: false ,
94
- counter: 0 ,
94
+ // counter: 6 ,
95
95
initialPosition: {x: 0 , y: 0 ,},
96
96
initialSize: {w: 0 ,h: 0 ,},
97
97
};
@@ -119,7 +119,7 @@ export default {
119
119
]),
120
120
// used in VueDraggableResizeable component
121
121
activeRouteArray () {
122
- // console.log("active route array method", this.routes[this.activeRoute]);
122
+ console .log (" active route array method" , this .routes [this .activeRoute ]);
123
123
return this .routes [this .activeRoute ];
124
124
},
125
125
// used to delete components
@@ -185,16 +185,16 @@ export default {
185
185
},
186
186
updated () {
187
187
// console.log("updated")
188
- if (this .activeComponent === ' ' ) {
189
- if (this .$refs .boxes ) {
190
- this .$refs .boxes .forEach ((element ) => {
188
+ if (this .activeComponent === ' ' )
189
+ {
190
+ if (this .$refs .boxes ){
191
+ this .$refs .boxes .forEach ((element )=> {
191
192
element .enabled = false ;
192
193
element .$emit (' deactivated' )
193
194
element .$emit (' update:active' , false )
194
- })
195
- }
196
- }
197
- else {
195
+
196
+ })}
197
+ } else {
198
198
this .$refs .boxes .forEach ((element )=> {
199
199
// added "element.enabled === false to stop it from emitting a change every frame the box moves
200
200
// may need to re-enable to track box movement and resizing since that stuff isn't part of a single source of truth.
@@ -214,6 +214,7 @@ export default {
214
214
" updateActiveComponentChildrenValue" ,
215
215
" updateComponentPosition" ,
216
216
" updateStartingPosition" ,
217
+ " updateComponentLayer" ,
217
218
" updateStartingSize" ,
218
219
" updateComponentSize" ,
219
220
]),
@@ -300,11 +301,6 @@ export default {
300
301
this .componentMap [this .activeComponent ].y = y;
301
302
this .userImage ;
302
303
},
303
- // onLayer: function(z) {
304
- // this.activeComponentData.z = z;
305
- // // Want to change the "Z" of the component found in Routes[activeRoute][whatever the component is]
306
- // //have to do this via an action or it won't be preserved in our undo/redo
307
- // },
308
304
309
305
finishedDrag : function (x ,y ) {
310
306
console .log (" FINISHED DRAGGING" )
@@ -322,11 +318,11 @@ export default {
322
318
}
323
319
},
324
320
325
- onActivated (componentData ) {
321
+ onActivated (componentData ) {
326
322
// console.log("I RAN!")
327
- this .$refs .boxes .forEach ((element ) => {
328
- if (element .$attrs .id !== componentData .componentName ) {
329
- element .enabled = false ;
323
+ this .$refs .boxes .forEach ((element )=> {
324
+ if (element .$attrs .id !== componentData .componentName ){
325
+ element .enabled = false ;
330
326
element .$emit (' deactivated' )
331
327
element .$emit (' update:active' , false )
332
328
}
@@ -371,31 +367,24 @@ export default {
371
367
},
372
368
handleLayer (e ) {
373
369
e .preventDefault ()
374
- console .log (' event object' , e .target .innerText )
375
- console .log (' Layer handled' )
376
-
377
- if (e .target .innerText === ' +' ) {
378
- this .counter ++ ;
379
- // this.activeComponentData.z = z;
380
- }
381
- if (e .target .innerText === ' -' && this .counter > 0 ) {
382
- this .counter -- ;
370
+ const payload = {
371
+ activeComponent: this .activeComponent ,
372
+ routeArray: this .routes [this .activeRoute ],
373
+ activeComponentData: this .activeComponentData ,
374
+ z: this .activeComponentData .z ,
383
375
}
384
- console .log (' counter' , this .counter )
385
- this .activeComponentData .z = this .counter ;
386
- this .componentMap [this .activeComponent ].z = this .counter ;
387
-
376
+ if (e .target .innerText === ' +' ) payload .z ++ ;
377
+ if (e .target .innerText === ' -' && payload .z > 0 ) payload .z -- ;
378
+ this .updateComponentLayer (payload)
388
379
},
389
380
// @dblclick.native="onDoubleClick(componentData)"
390
381
// onDoubleClick (compData) {
391
382
// this.setActiveComponent(compData.componentName)
392
383
// this.activeComponentData.isActive = true
393
384
// }
394
- handleClick (event ) {
395
- if (event .target .className === " component-display grid-bg" ) {
396
- if (! (' ' === this .activeComponent )) {
397
- this .setActiveComponent (' ' );
398
- }
385
+ handleClick (event ){
386
+ if (event .target .className === " component-display grid-bg" ) {
387
+ if (! (' ' === this .activeComponent )) this .setActiveComponent (' ' );
399
388
}
400
389
}
401
390
}
0 commit comments