Skip to content

Commit f620462

Browse files
APAP
authored andcommitted
z index
1 parent 62cd43a commit f620462

File tree

3 files changed

+55
-8
lines changed

3 files changed

+55
-8
lines changed

src/components/ComponentDisplay.vue

Lines changed: 53 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
:key="componentData.componentName"
88
:x="componentData.x"
99
:y="componentData.y + 20"
10+
:z="componentData.z"
1011
:w="componentData.w"
1112
:h="componentData.h"
1213
:parent="true"
@@ -25,19 +26,22 @@
2526
<!-- <p v-for="child in childList" :key="childList.indexOf(child)"> {{ child.text }}</p> -->
2627
</ul>
2728
<q-menu context-menu>
28-
<q-list class="menu">
29+
<q-list color='black' class="menu">
2930
<q-item clickable v-ripple v-close-popup @click="handleAddChild">
3031
<q-item-section style="color: white">Update Children</q-item-section>
3132
<q-item-section avatar>
3233
<q-icon color="primary" name="add" />
3334
</q-item-section>
3435
</q-item>
35-
<!-- <q-item clickable v-ripple v-close-popup auto-close>
36-
<q-item-section style="color: pink">Delete Children</q-item-section>
37-
<q-item-section avatar>
38-
<q-icon color="primary" name="delete" />
39-
</q-item-section>
40-
</q-item> -->
36+
<q-item clickable v-ripple v-close-popup>
37+
<q-item-section class='layer' style="color: pink">Layer</q-item-section>
38+
<q-btn class='btn' color='transparent' text-color='primary' label='-' @click='(e)=>handleLayer(e)'/>
39+
<p id='counter' style="color: white"> {{componentData.z}} </p>
40+
<q-btn class='btn' color='transparent' text-color='primary' label='+' @click='(e)=>handleLayer(e)'/>
41+
<!-- <q-item-section avatar>
42+
<q-icon color="primary" name="layer" />
43+
</q-item-section> -->
44+
</q-item>
4145
</q-list>
4246
</q-menu>
4347
</VueDraggableResizable>
@@ -77,7 +81,8 @@ export default {
7781
abilityToDelete: false,
7882
testOptions: ["parent", "child", "grandchild"],
7983
testModel: [],
80-
mockImg: false
84+
mockImg: false,
85+
counter: 0
8186
};
8287
},
8388
mounted() {
@@ -191,6 +196,9 @@ export default {
191196
this.componentMap[this.activeComponent].y = y;
192197
this.userImage;
193198
},
199+
onLayer: function(z) {
200+
this.activeComponentData.z = z;
201+
},
194202
onActivated(componentData) {
195203
this.setActiveComponent(componentData.componentName);
196204
this.activeComponentData.isActive = true;
@@ -211,6 +219,23 @@ export default {
211219
console.log("Multiselect: ", value);
212220
this.updateActiveComponentChildrenValue(value);
213221
// this.updateComponentChildrenMultiselectValue(value)
222+
},
223+
handleLayer(e){
224+
e.preventDefault()
225+
console.log('event object', e.target.innerText)
226+
console.log('Layer handled')
227+
228+
if(e.target.innerText === '+'){
229+
this.counter++;
230+
// this.activeComponentData.z = z;
231+
}
232+
if(e.target.innerText === '-' && this.counter > 0){
233+
this.counter--;
234+
}
235+
console.log('counter', this.counter)
236+
this.activeComponentData.z = this.counter;
237+
this.componentMap[this.activeComponent].z = this.counter;
238+
214239
}
215240
// @dblclick.native="onDoubleClick(componentData)"
216241
// onDoubleClick (compData) {
@@ -233,6 +258,7 @@ export default {
233258
/* width: 1rem; */
234259
line-height: 1.2;
235260
/* margin: 10px; */
261+
z-index: 0;
236262
}
237263
.component-children {
238264
position: absolute;
@@ -293,4 +319,23 @@ export default {
293319
background-color: rgba(105, 179, 190, 0.514);
294320
border: 1px dashed rgb(227, 203, 71);
295321
}
322+
.btn {
323+
font-size: 25px;
324+
/* margin-top: 0;
325+
margin-bottom: 0; */
326+
padding: 0 20px;
327+
width: 10px;
328+
height: 10px;
329+
transition: none;
330+
}
331+
.btn:hover, .btn:focus, .btn:active {
332+
color: white;
333+
background-color: transparent;
334+
}
335+
#counter {
336+
margin-top: 20px;
337+
}
338+
/* .layer {
339+
padding: 0 20px;
340+
} */
296341
</style>

src/components/CreateComponent.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ export default {
6767
componentName: this.componentNameInputValue,
6868
x: 0,
6969
y: 0,
70+
z: 0,
7071
w: 200,
7172
h: 200,
7273
htmlList: this.selectedElementList,

src/store/mutations.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const mutations = {
1010
componentName,
1111
x: 0,
1212
y: 0,
13+
z: 0,
1314
w: 200,
1415
h: 200,
1516
children,

0 commit comments

Comments
 (0)