Skip to content

Commit bf124c5

Browse files
committed
Merge branch 'dev' into keyla/dragAndDrop
2 parents 03154aa + 45811d5 commit bf124c5

File tree

6 files changed

+70
-30
lines changed

6 files changed

+70
-30
lines changed

src/components/Canvas.vue

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,8 @@ export default {
451451
activeComponentData: this.activeComponentData,
452452
}
453453
this.updateColor(payload)
454-
},
454+
this.refresh();
455+
},
455456
456457
// records component's initial size/position in case of resize
457458
recordInitialSize: function (e) {
@@ -478,8 +479,25 @@ export default {
478479
payload.h !== this.initialSize.h
479480
) {
480481
this.updateComponentSize(payload);
482+
481483
}
484+
this.refresh();
482485
},
486+
487+
//refresh function - super ghetto refresh function
488+
refresh() {
489+
const payload = {
490+
activeComponent: this.activeComponent,
491+
routeArray: this.routes[this.activeRoute],
492+
activeComponentData: this.activeComponentData,
493+
z: this.activeComponentData.z,
494+
};
495+
payload.z++;
496+
this.updateComponentLayer(payload);
497+
payload.z--;
498+
this.updateComponentLayer(payload);
499+
},
500+
483501
finishedDrag: function (x, y) {
484502
let payload = {
485503
x: x,
@@ -496,6 +514,7 @@ export default {
496514
}
497515
this.wasDragged = true;
498516
setTimeout(()=>this.wasDragged = false, 100)
517+
this.refresh();
499518
},
500519
onActivated(componentData) {
501520
if (!componentData){
@@ -571,6 +590,7 @@ export default {
571590
activeComponentData: this.activeComponentData,
572591
z: this.activeComponentData.z,
573592
};
593+
574594
if (e.target.innerText === "+") payload.z++;
575595
if (e.target.innerText === "" && payload.z > 0) payload.z--;
576596
this.updateComponentLayer(payload);

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

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
</q-list>
1818
</q-btn-dropdown>
1919

20-
2120
<q-input
2221
@keyup.enter="createAttribute(attributeText)"
2322
color="white"
@@ -35,6 +34,9 @@
3534
</template>
3635
</q-input>
3736

37+
<button v-if = "this.activeComponentObj.htmlAttributes.class !== ''" class = "deleteButton" @click="deleteAttribute('class')" color="primary">Remove class</button>
38+
39+
<button v-if = "this.activeComponentObj.htmlAttributes.id !== ''" class = "deleteButton" @click="deleteAttribute('id')" color="primary">Remove id</button>
3840

3941
<!-- <div>
4042
<q-btn
@@ -61,7 +63,8 @@ export default {
6163
data() {
6264
return {
6365
attributeText: "",
64-
attributeSelection: "ID",
66+
attributeSelection: "id",
67+
deleteText:"",
6568
};
6669
},
6770
computed: {
@@ -94,8 +97,19 @@ export default {
9497
activeComponentData: this.activeComponentData,
9598
})
9699
},
100+
97101
changeAttribute(attribute) {
98102
this.attributeSelection = attribute;
103+
},
104+
105+
deleteAttribute(attribute) {
106+
this.editAttribute({
107+
attribute: attribute,
108+
value: "",
109+
activeComponent: this.activeComponent,
110+
routeArray: this.routes[this.activeRoute],
111+
activeComponentData: this.activeComponentData,
112+
})
99113
}
100114
},
101115
};
@@ -110,9 +124,23 @@ export default {
110124
}
111125
112126
.input-add {
113-
position:absolute;
114-
margin-left: 7em;
115-
bottom:-60%;
116-
// padding:20px;
127+
// position:absolute;
128+
// margin-left: 7em;
129+
// bottom:-100%;
130+
margin-top:1em;
131+
margin-bottom: -1em;
117132
}
133+
.deleteButton{
134+
width:100px;
135+
height:30px;
136+
background-color:rgba(204, 190, 190, 0.164);
137+
color: $menutext;
138+
margin-right:2em;
139+
}
140+
141+
.deleteButton:hover{
142+
cursor: pointer;
143+
}
144+
145+
118146
</style>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ Description:
1010
group="people"
1111
class="list-group"
1212
>
13+
1314
<div
14-
:class="activeHTML === element[2] ? 'list-group-item-selected' : 'list-group-item'"
1515
@dblclick.self="setActiveElement(element)"
1616
v-for="(element) in renderList" :key="element[1] + Date.now()"
1717
@dragenter="dragEnter($event, element[2])"

src/components/right-sidebar/CodeSnippet.vue

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,7 @@ Description:
1111
<div class="top-p" v-if="this.activeComponent === ''">
1212
Select a component
1313
</div>
14-
<div v-else>{{ `${this.activeComponent}.vue` }}</div> <button class="refreshCode">
15-
<q-icon
16-
size="25px"
17-
z-layer="0"
18-
name="refresh"
19-
@click="this.snippetInvoke" />
20-
</button>
14+
<div v-else>{{ `${this.activeComponent}.vue` }}</div>
2115
<prism-editor v-model="code" :highlight="highlighter" line-numbers class="my-editor" readonly />
2216
</div>
2317
</template>
@@ -92,6 +86,7 @@ export default {
9286
},
9387
// Creates <template> boilerplate
9488
writeTemplateTag(componentName) {
89+
// console.log(this.activeComponentObj)
9590
// create reference object
9691
const htmlElementMap = {
9792
div: ["<div", "</div>"],
@@ -254,14 +249,13 @@ export default {
254249
styleString += `.${this.activeComponentObj.htmlAttributes.class} {\nbackground-color: ${this.activeComponentObj.color};
255250
width: ${this.activeComponentObj.w}px;
256251
height: ${this.activeComponentObj.h}px;
257-
z-index: ${this.activeComponentObj.z}px;
252+
z-index: ${this.activeComponentObj.z};
258253
}\n`
259254
}
260255
261256
for (const html of htmlArray) {
262257
if (html.class === ' ') styleString = "";
263258
if (html.class) {
264-
console.log(this.activeComponentObj)
265259
styleString += `.${html.class} {\n
266260
}\n`
267261
}

src/components/right-sidebar/HTMLQueue.vue

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,13 @@ Description:
1717
<div group="people" class="list-group">
1818

1919
<p v-if='!this.componentMap[this.activeComponent]?.htmlList.length'>No HTML elements in component</p>
20-
<!---->
2120
<div
22-
id="tooltipCon"
2321
v-for="(element) in renderList" :key="element[1] + Date.now()"
2422
@dragenter="dragEnter($event, element[2])"
25-
>
23+
>
2624
<div
25+
id="tooltipCon"
2726
:class="activeHTML === element[2] ? 'list-group-item-selected' : 'list-group-item'"
28-
@dblclick.self="setActiveElement(element)"
2927
@dragstart="startDrag($event, element[2])"
3028
@dragend="endDrag($event)"
3129
draggable="true"
@@ -42,7 +40,7 @@ Description:
4240
</div>
4341
</div>
4442

45-
<!--START OF CHANGES-->>
43+
<!--START OF CHANGES-->
4644
<!-- &nbsp; &nbsp; Viewing Elements in {{ this.activeComponent }} '{{ depth }}'
4745
<hr>
4846
</span>
@@ -67,11 +65,13 @@ Description:
6765
<q-dialog v-model="attributeModal">
6866
<!-- @update:model-value="setActiveElement" -->
6967
<div class="AttributeBox">
70-
<p class="title">Added attributes to {{ this.activeComponent }}</p>
68+
<p class="title">Add attributes to: {{ this.activeComponent }}</p>
69+
<!--attribute child-->
7170
<div class="AttributeContainer" v-for="element in this.componentMap[this.activeComponent].htmlList"
7271
:key="element.id + Date.now()">
7372
<p v-if="element.id === this.activeHTML">Your class is - {{ element.class }}</p>
7473
</div>
74+
7575
<div class="formBox">
7676
<q-form autofocus v-on:submit.prevent="submitClass">
7777
<p class="title">Add Class Name:</p>
@@ -152,13 +152,12 @@ export default {
152152
if (this.activeComponent !== '') {
153153
this.setActiveHTML(element);
154154
this.openAttributeModal(element);
155-
}
155+
}
156+
156157
},
157158
setLayer(element) {
158159
this.setActiveLayer(element)
159160
element.id = this.activeHTML
160-
console.log(element)
161-
console.log(this.activeHTML)
162161
},
163162
setParentLayer() {
164163
if (this.activeLayer.id !== '') {
@@ -298,7 +297,7 @@ hr {
298297
}
299298
300299
.currentlyDragging {
301-
opacity: .5;
300+
opacity: 1;
302301
}
303302
304303
.ignoreByDragover {
@@ -307,7 +306,7 @@ hr {
307306
#tooltipCon {
308307
position: relative;
309308
cursor: pointer;
310-
margin-top: 2em;
309+
margin-top: 1em;
311310
}
312311
313312
.tooltip {

src/store/mutations.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -715,12 +715,11 @@ const mutations = {
715715

716716
updatedComponent.color = payload.color
717717
},
718-
718+
//Attribute updater for parent
719719
[types.EDIT_ATTRIBUTE]: (state, payload) => {
720720
const updatedComponent = state.routes[state.activeRoute].filter(
721721
(element) => element.componentName === payload.activeComponent
722722
)[0];
723-
console.log(updatedComponent)
724723
updatedComponent.htmlAttributes[payload.attribute] = payload.value
725724
},
726725

0 commit comments

Comments
 (0)