Skip to content

Commit bec4898

Browse files
committed
pulled from Allison
2 parents 50cc65c + 4e51614 commit bec4898

File tree

4 files changed

+33
-13
lines changed

4 files changed

+33
-13
lines changed

src/components/ComponentDisplay.vue

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export default {
9191
testOptions: ["parent", "child", "grandchild"],
9292
testModel: [],
9393
mockImg: false,
94-
counter: 0,
94+
// counter: 6,
9595
initialPosition:{x:0, y:0,},
9696
initialSize:{w:0,h:0,},
9797
};
@@ -119,7 +119,7 @@ export default {
119119
]),
120120
// used in VueDraggableResizeable component
121121
activeRouteArray() {
122-
// console.log("active route array method", this.routes[this.activeRoute]);
122+
console.log("active route array method", this.routes[this.activeRoute]);
123123
return this.routes[this.activeRoute];
124124
},
125125
// used to delete components
@@ -223,6 +223,7 @@ export default {
223223
"updateActiveComponentChildrenValue",
224224
"updateComponentPosition",
225225
"updateStartingPosition",
226+
"updateComponentLayer",
226227
"updateStartingSize",
227228
"updateComponentSize",
228229
]),
@@ -310,11 +311,6 @@ export default {
310311
this.componentMap[this.activeComponent].y = y;
311312
this.userImage;
312313
},
313-
// onLayer: function(z) {
314-
// this.activeComponentData.z = z;
315-
// // Want to change the "Z" of the component found in Routes[activeRoute][whatever the component is]
316-
// //have to do this via an action or it won't be preserved in our undo/redo
317-
// },
318314
319315
finishedDrag: function(x,y){
320316
console.log("FINISHED DRAGGING")
@@ -389,6 +385,7 @@ export default {
389385
},
390386
handleLayer(e) {
391387
e.preventDefault()
388+
<<<<<<< HEAD
392389
console.log('event object', e.target.innerText)
393390
console.log('Layer handled')
394391
@@ -398,23 +395,35 @@ export default {
398395
}
399396
if(e.target.innerText === '-' && this.counter > 0) {
400397
this.counter--;
398+
=======
399+
const payload = {
400+
activeComponent: this.activeComponent,
401+
routeArray: this.routes[this.activeRoute],
402+
activeComponentData: this.activeComponentData,
403+
z: this.activeComponentData.z,
404+
>>>>>>> master
401405
}
402-
console.log('counter', this.counter)
403-
this.activeComponentData.z = this.counter;
404-
this.componentMap[this.activeComponent].z = this.counter;
405-
406+
if(e.target.innerText === '+') payload.z++;
407+
if(e.target.innerText === '-' && payload.z > 0) payload.z--;
408+
this.updateComponentLayer(payload)
406409
},
407410
// @dblclick.native="onDoubleClick(componentData)"
408411
// onDoubleClick (compData) {
409412
// this.setActiveComponent(compData.componentName)
410413
// this.activeComponentData.isActive = true
411414
// }
415+
<<<<<<< HEAD
412416
handleClick(event) {
413417
if(event.target.className === "component-display grid-bg")
414418
{
415419
if(!('' === this.activeComponent)){
416420
this.setActiveComponent('');
417421
}
422+
=======
423+
handleClick(event){
424+
if(event.target.className === "component-display grid-bg") {
425+
if(!('' === this.activeComponent)) this.setActiveComponent('');
426+
>>>>>>> master
418427
}
419428
}
420429
}

src/store/actions.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ const actions = {
6363
commit(types.UPDATE_COMPONENT_POSITION, payload)
6464

6565
},
66+
[types.updateComponentLayer]: ({ commit }, payload) => {
67+
commit(types.UPDATE_COMPONENT_LAYER, payload)
68+
},
6669

6770
//does the same as update component position, but needed to record the initial spot of the draggable resizeable in component display
6871
// or else undo/redo won't work

src/store/mutations.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,8 +297,14 @@ const mutations = {
297297
updatedComponent.x = payload.x
298298
updatedComponent.y = payload.y
299299
},
300-
301-
300+
[types.UPDATE_COMPONENT_LAYER]: (state, payload) => {
301+
const updatedComponent = state.routes[state.activeRoute].filter(element => {
302+
return element.componentName === payload.activeComponent
303+
})[0]
304+
updatedComponent.z = payload.z
305+
state.componentMap[payload.activeComponent].z = payload.z
306+
// payload.activeComponentData.z = payload.z
307+
},
302308
[types.UPDATE_ACTIVE_COMPONENT_CHILDREN_VALUE]: (state, payload) => {
303309
// original line
304310
let temp = state.componentMap[state.activeComponent].children // b c and we are removing c

src/store/types.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export const UPDATE_COMPONENT_NAME_INPUT_VALUE =
3535
export const UPDATE_COMPONENT_CHILDREN_VALUE =
3636
'UPDATE_COMPONENT_CHILDREN_VALUE'
3737
export const UPDATE_COMPONENT_POSITION = "UPDATE_COMPONENT_POSITION"
38+
export const UPDATE_COMPONENT_LAYER = "UPDATE_COMPONENT_LAYER"
3839
export const UPDATE_ACTIVE_COMPONENT_CHILDREN_VALUE =
3940
'UPDATE_ACTIVE_COMPONENT_CHILDREN_VALUE'
4041
export const ADD_COMPONENT_TO_COMPONENT_CHILDREN =
@@ -92,6 +93,7 @@ export const updateActiveComponentChildrenValue =
9293
export const updateComponentChildrenValue = 'updateComponentChildrenValue'
9394
export const updateComponentNameInputValue = 'updateComponentNameInputValue'
9495
export const updateComponentPosition = 'updateComponentPosition'
96+
export const updateComponentLayer = 'updateComponentLayer'
9597
export const updateOpenModal = 'updateOpenModal'
9698
export const parentSelected = 'parentSelected'
9799
export const deleteRoute = 'deleteRoute'

0 commit comments

Comments
 (0)