Skip to content

Commit a20bf92

Browse files
committed
updated with class into code snippet
1 parent 507799e commit a20bf92

File tree

5 files changed

+192
-86
lines changed

5 files changed

+192
-86
lines changed

package-lock.json

Lines changed: 15 additions & 34 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
"quasar": "^2.5.5",
4444
"quasar-dotenv": "^1.0.5",
4545
"vue": "^3.2.31",
46+
"vue-accessible-color-picker": "^4.0.3",
4647
"vue-draggable-resizable": "^2.3.0",
4748
"vue-multiselect": "^3.0.0-alpha.2",
4849
"vue-prism-editor": "^2.0.0-alpha.2",

src/components/Canvas.vue

Lines changed: 99 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,69 @@
1212
v-on:click="handleClick"
1313
v-on:click.right="handleRight"
1414
>
15+
<!--color selector-->
16+
<ColorPicker
17+
class="colorPicker"
18+
default-format="hex"
19+
id="color-picker-1"
20+
:visible-formats="['hex']"
21+
:color="{
22+
h: 1,
23+
s: 1,
24+
l: 0.5,
25+
a: 1
26+
}"
27+
@color-change="updateColor"
28+
>
29+
<template #hue-range-input-label>
30+
<span class="sr-only">Hue</span>
31+
</template>
32+
33+
<template #alpha-range-input-label>
34+
<span class="sr-only">Alpha</span>
35+
</template>
36+
37+
<template #copy-button>
38+
<span class="sr-only">Copy color</span>
39+
40+
<svg
41+
aria-hidden="true"
42+
xmlns="http://www.w3.org/2000/svg"
43+
width="15"
44+
height="15"
45+
viewBox="0 0 15 15"
46+
>
47+
<path
48+
d="M5 0v2H1v13h12v-3h-1v2H2V5h10v3h1V2H9V0zm1 1h2v2h3v1H3V3h3z"
49+
fill="currentColor"
50+
/>
51+
52+
<path
53+
d="M10 7v2h5v2h-5v2l-3-3zM3 6h5v1H3zm0 2h3v1H3zm0 2h3v1H3zm0 2h5v1H3z"
54+
fill="currentColor"
55+
/>
56+
</svg>
57+
</template>
58+
59+
<template #format-switch-button>
60+
<span class="sr-only">Switch format</span>
61+
62+
<svg
63+
aria-hidden="true"
64+
xmlns="http://www.w3.org/2000/svg"
65+
width="16"
66+
height="15"
67+
viewBox="0 0 16 15"
68+
>
69+
<path
70+
d="M8 15l5-5-1-1-4 2-4-2-1 1zm4-9l1-1-5-5-5 5 1 1 4-2z"
71+
fill="currentColor"
72+
/>
73+
</svg>
74+
</template>
75+
</ColorPicker>
76+
77+
1578
<!-- This is the actual component box -->
1679
<!-- https://www.npmjs.com/package/vue-draggable-resizable -->
1780
<vue-draggable-resizable
@@ -33,6 +96,7 @@
3396
:onDragStart="recordInitialPosition"
3497
:onResizeStart="recordInitialSize"
3598
>
99+
36100
<div class="component-title">
37101
<p>{{ componentData.componentName }}</p>
38102
</div>
@@ -48,6 +112,8 @@
48112
name="edit_note"
49113
class="compNoteLogoEmpty"
50114
@click="handleAddNotes" />
115+
116+
<!-- start of right click function-->
51117
<q-menu context-menu>
52118
<q-list color="black" class="menu">
53119
<q-item clickable v-ripple v-close-popup id="layer-item">
@@ -86,11 +152,17 @@
86152
<q-icon color="primary" name="upload" />
87153
</q-item-section>
88154
</q-item>
155+
<q-item clickable v-ripple v-close-popup @click="handleAddChild">
156+
<q-item-section>Edit Color</q-item-section>
157+
<q-item-section avatar>
158+
<q-icon color="primary" name="edit" />
159+
</q-item-section>
160+
</q-item>
89161
</q-list>
90162
</q-menu>
91163

92164
</vue-draggable-resizable>
93-
<div>
165+
<div>
94166
<q-dialog v-model="modalOpen">
95167
<div class="addChild">
96168
<p>Add/Remove Children</p>
@@ -163,6 +235,7 @@ import { mapState, mapActions } from "vuex";
163235
import VueDraggableResizable from "vue-draggable-resizable/src/components/vue-draggable-resizable.vue";
164236
import VueMultiselect from "vue-multiselect";
165237
import "vue-draggable-resizable/src/components/vue-draggable-resizable.css";
238+
import { ColorPicker } from 'vue-accessible-color-picker'
166239
167240
const { fs, ipcRenderer } = window;
168241
@@ -173,6 +246,7 @@ export default {
173246
components: {
174247
VueDraggableResizable,
175248
VueMultiselect,
249+
ColorPicker,
176250
},
177251
data() {
178252
return {
@@ -340,6 +414,11 @@ export default {
340414
this.initialPosition.x = this.activeComponentData.x;
341415
this.initialPosition.y = this.activeComponentData.y;
342416
},
417+
//color change function
418+
updateColor (data) {
419+
console.log(data)
420+
},
421+
343422
// records component's initial size/position in case of resize
344423
recordInitialSize: function (e) {
345424
this.initialSize.h = this.activeComponentData.h;
@@ -484,6 +563,7 @@ export default {
484563
},
485564
},
486565
};
566+
487567
</script>
488568
489569
<style scoped lang="scss">
@@ -718,4 +798,22 @@ li:hover{
718798
margin-bottom: 10px;
719799
}
720800
801+
.sr-only {
802+
position: absolute;
803+
overflow: hidden;
804+
clip: rect(0 0 0 0);
805+
width: 1px;
806+
height: 1px;
807+
margin: -1px;
808+
padding: 0;
809+
border: 0;
810+
white-space: nowrap;
811+
}
812+
813+
814+
.colorPicker {
815+
color: black;
816+
background: rgba(177, 171, 171, 0.562);
817+
}
818+
721819
</style>

0 commit comments

Comments
 (0)