Skip to content

Commit d764f31

Browse files
committed
updated hack hour
1 parent 5a13975 commit d764f31

File tree

3 files changed

+47
-31
lines changed

3 files changed

+47
-31
lines changed

src/components/left-sidebar/ComponentTab/CreateMenuHTMLQueue.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,16 @@ export default {
5858
...mapState(['selectedElementList', 'componentMap', 'activeComponent', 'activeHTML', 'activeLayer']),
5959
renderList: {
6060
get () {
61-
if (this.activeComponent === '') return this.selectedElementList.map((el, index) => [el.text, index, el.id])
61+
if (this.activeComponent === '') return this.selectedElementList.map((el, index) => [el.text, index, el.id, el.z])
6262
// change activeComponent's htmlList into an array of arrays ([element/component name, index in state])
6363
if (this.activeComponent !== '' && this.activeLayer.id === '') {
64-
let sortedHTML = this.componentMap[this.activeComponent].htmlList.map((el, index) => [el.text, index, el.id]).filter(el => {
64+
let sortedHTML = this.componentMap[this.activeComponent].htmlList.map((el, index) => [el.text, index, el.id, el.z]).filter(el => {
6565
return el[0] !== undefined
6666
})
6767
return sortedHTML
6868
}
6969
let activeElement = breadthFirstSearch(this.componentMap[this.activeComponent].htmlList, this.activeLayer.id)
70-
let sortedHTML = activeElement.children.map((el, index) => [el.text, index, el.id]).filter(el => {
70+
let sortedHTML = activeElement.children.map((el, index) => [el.text, index, el.id, el.z]).filter(el => {
7171
return el[0] !== undefined
7272
})
7373
return sortedHTML

src/components/left-sidebar/ComponentTab/InputHTMLMenu.vue

Lines changed: 44 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,13 @@
8888
@click="submitLeft(leftText, this.activeHTML)">
8989
</i>
9090
</q-input>
91-
9291
<q-item id="layer-item" filled dark autofocus true hide-bottom-space color="secondary">
93-
<q-item-section v-model="z" class="layer">Component Layer = {{z}}</q-item-section>
92+
<q-item-section class="layer">Component Layer = </q-item-section>
9493
<q-btn
9594
class="minorAction"
9695
color="transparent"
9796
text-color="primary"
98-
label="&ndash;"
97+
label="-"
9998
@click="(e) => handleLayer(e)"
10099
/>
101100
<p id="counter">{{ z }}</p>
@@ -107,9 +106,6 @@
107106
@click="(e) => handleLayer(e)"
108107
/>
109108
</q-item>
110-
111-
112-
113109
<q-btn label="Close" @click="this.openAttributeModal" />
114110
</q-form>
115111
</div>
@@ -143,13 +139,14 @@ export default {
143139
'routes',
144140
'activeComponentData',
145141
'activeComponentObj',
142+
'componentData'
146143
])
147144
},
148145
components: {
149146
},
150147
methods: {
151148
...mapActions([
152-
'setActiveHTML',
149+
'setActiveHTML',
153150
'setActiveLayer',
154151
'openAttributeModal',
155152
'addActiveComponentClass',
@@ -215,34 +212,56 @@ export default {
215212
this.leftText = '';
216213
},
217214
218-
handleLayer(e) {
219-
e.preventDefault();
215+
// addLayer(z, idNum) {
216+
// const payload = {
217+
// activeHTML: idNum,
218+
// z: z,
219+
// };
220+
// payload.z++;
221+
// this.z++;
222+
// console.log(this.activeComponentObj.htmlList[0].z)
223+
// this.updateHTMLLayer(payload);
224+
// console.log('+ clicked!')
225+
// console.log(this.activeComponentObj.htmlList[0].z)
226+
// },
220227
221-
let htmlZ;
228+
// subtractLayer(z, idNum) {
229+
// const payload = {
230+
// activeHTML: idNum,
231+
// z: z,
232+
// };
222233
223-
this.activeComponentObj.htmlList.forEach( element => {
224-
if (element.id === this.activeHTML) {
225-
htmlZ = element.z;
226-
}
227-
})
234+
235+
// payload.z--;
236+
// this.z--;
237+
// this.updateHTMLLayer(payload);
238+
239+
// console.log('- clicked!')
240+
// },
228241
242+
handleLayer(e) {
243+
e.preventDefault();
229244
const payload = {
230-
activeHTML: this.activeHTML,
231-
z: htmlZ,
245+
activeComponent: this.activeComponent,
246+
routeArray: this.routes[this.activeRoute],
247+
activeComponentData: this.activeComponentData,
248+
z: this.activeComponentData.z,
232249
};
233-
234-
if (e.target.innerText === "+") {
250+
251+
if (e.target.innerText === "+") {
235252
payload.z++;
236-
this.z++;
253+
console.log('+ clicked!')
237254
}
238255
if (e.target.innerText === "" && payload.z > 0) {
239256
payload.z--;
240-
this.z--;
257+
console.log('- clicked!')
241258
}
242-
this.updateHTMLLayer(payload);
243-
console.log('here')
244-
console.log(this.activeHTML)
245-
},
259+
this.updateComponentLayer(payload);
260+
},
261+
262+
activeRouteArray() {
263+
return this.routes[this.activeRoute];
264+
},
246265
247266
watch: {
248267
attributeModalOpen() {

src/store/mutations.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,6 @@ const mutations = {
473473
if (payload[0] === "") {
474474
state.activeHTML = "";
475475
} else {
476-
console.log(payload)
477476
state.activeHTML = payload[2];
478477
}
479478
},
@@ -782,13 +781,11 @@ const mutations = {
782781
},
783782

784783
[types.UPDATE_HTML_LAYER]: (state, payload) => {
785-
786784
state.componentMap[state.activeComponent].htmlList.forEach((el) => {
787785
if (payload.id === el.id) {
788786
el.z = payload.z
789787
}
790788
})
791-
792789
},
793790

794791
[types.UPDATE_ACTIVE_COMPONENT_CHILDREN_VALUE]: (state, payload) => {

0 commit comments

Comments
 (0)