12
12
v-on:click =" handleClick"
13
13
v-on:click.right =" handleRight"
14
14
>
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
-
78
15
<!-- This is the actual component box -->
79
16
<!-- https://www.npmjs.com/package/vue-draggable-resizable -->
80
17
<vue-draggable-resizable
112
49
name =" edit_note"
113
50
class =" compNoteLogoEmpty"
114
51
@click =" handleAddNotes" />
52
+ <q-icon
53
+ size =" 30px"
54
+ z-layer =" 0"
55
+ name =" palette"
56
+ class =" colorLogo"
57
+ @click =" handleEditColor" />
115
58
116
59
<!-- start of right click function-->
117
60
<q-menu context-menu >
152
95
<q-icon color =" primary" name =" upload" />
153
96
</q-item-section >
154
97
</q-item >
155
- <q-item clickable v-ripple v-close-popup @click =" handleAddChild " >
98
+ <q-item clickable v-ripple v-close-popup @click =" handleEditColor " >
156
99
<q-item-section >Edit Color</q-item-section >
157
100
<q-item-section avatar >
158
101
<q-icon color =" primary" name =" edit" />
224
167
</div >
225
168
</div >
226
169
</q-dialog >
170
+
171
+
172
+ <!-- color selector-->
173
+ <q-dialog v-model =" colorModal" @update:model-value =" handleEditColor" >
174
+ <ColorPicker
175
+ class =" colorPicker"
176
+ default-format =" hex"
177
+ id =" color-picker-1"
178
+ :visible-formats =" ['hex']"
179
+ :color =" {
180
+ h: 1,
181
+ s: 1,
182
+ l: 0.5,
183
+ a: 1
184
+ }"
185
+ @color-change =" updateColor"
186
+ >
187
+ <template #hue-range-input-label >
188
+ <span class =" sr-only" >Hue</span >
189
+ </template >
190
+
191
+ <template #alpha-range-input-label >
192
+ <span class =" sr-only" >Alpha</span >
193
+ </template >
194
+
195
+ <template #copy-button >
196
+ <span class =" sr-only" >Copy color</span >
197
+
198
+ <svg
199
+ aria-hidden =" true"
200
+ xmlns =" http://www.w3.org/2000/svg"
201
+ width =" 15"
202
+ height =" 15"
203
+ viewBox =" 0 0 15 15"
204
+ >
205
+ <path
206
+ d =" M5 0v2H1v13h12v-3h-1v2H2V5h10v3h1V2H9V0zm1 1h2v2h3v1H3V3h3z"
207
+ fill =" currentColor"
208
+ />
209
+
210
+ <path
211
+ d =" M10 7v2h5v2h-5v2l-3-3zM3 6h5v1H3zm0 2h3v1H3zm0 2h3v1H3zm0 2h5v1H3z"
212
+ fill =" currentColor"
213
+ />
214
+ </svg >
215
+ </template >
216
+
217
+ <template #format-switch-button >
218
+ <span class =" sr-only" >Switch format</span >
219
+
220
+ <svg
221
+ aria-hidden =" true"
222
+ xmlns =" http://www.w3.org/2000/svg"
223
+ width =" 16"
224
+ height =" 15"
225
+ viewBox =" 0 0 16 15"
226
+ >
227
+ <path
228
+ d =" M8 15l5-5-1-1-4 2-4-2-1 1zm4-9l1-1-5-5-5 5 1 1 4-2z"
229
+ fill =" currentColor"
230
+ />
231
+ </svg >
232
+ </template >
233
+ </ColorPicker >
234
+ </q-dialog >
235
+
227
236
</div >
228
237
</div >
229
238
</template >
230
239
231
240
241
+
232
242
<script >
233
243
import { useExportComponent } from " ./composables/useExportComponent.js" ;
234
244
import { mapState , mapActions } from " vuex" ;
235
245
import VueDraggableResizable from " vue-draggable-resizable/src/components/vue-draggable-resizable.vue" ;
246
+ import Vue3DraggableResizable from ' vue3-draggable-resizable'
236
247
import VueMultiselect from " vue-multiselect" ;
237
248
import " vue-draggable-resizable/src/components/vue-draggable-resizable.css" ;
249
+ import ' vue3-draggable-resizable/dist/Vue3DraggableResizable.css'
238
250
import { ColorPicker } from ' vue-accessible-color-picker'
239
251
240
252
const { fs , ipcRenderer } = window ;
@@ -244,6 +256,7 @@ const cloneDeep = require("lodash.clonedeep");
244
256
export default {
245
257
name: " Canvas" ,
246
258
components: {
259
+ Vue3DraggableResizable,
247
260
VueDraggableResizable,
248
261
VueMultiselect,
249
262
ColorPicker,
@@ -255,6 +268,7 @@ export default {
255
268
wasDragged: false ,
256
269
testModel: [],
257
270
noteModal: false ,
271
+ colorModal: false ,
258
272
mockImg: false ,
259
273
initialPosition: { x: 0 , y: 0 },
260
274
initialSize: { w: 0 , h: 0 },
@@ -302,10 +316,12 @@ export default {
302
316
" activeComponentObj" ,
303
317
" exportAsTypescript" ,
304
318
" noteModalOpen" ,
319
+ " colorModalOpen" ,
305
320
" activeRouteDisplay"
306
321
]),
307
322
// used in VueDraggableResizeable component
308
323
activeRouteArray () {
324
+ console .log (this .routes [this .activeRoute ])
309
325
return this .routes [this .activeRoute ];
310
326
},
311
327
// used to delete active component
@@ -398,6 +414,7 @@ export default {
398
414
" addActiveComponentNote" ,
399
415
" deleteActiveComponentNote" ,
400
416
" openNoteModal" ,
417
+ " openColorModal" ,
401
418
]),
402
419
useExportComponentBound (){
403
420
useExportComponent .bind (this )();
@@ -503,6 +520,13 @@ export default {
503
520
this .openNoteModal ();
504
521
}
505
522
},
523
+
524
+ handleEditColor (){
525
+ if (this .wasDragged === false && this .activeComponent !== ' ' ){
526
+ this .openColorModal ();
527
+ }
528
+ },
529
+
506
530
handleAddChild () {
507
531
this .modalOpen = true ;
508
532
},
@@ -550,6 +574,9 @@ export default {
550
574
noteModalOpen (){
551
575
this .noteModal = this .noteModalOpen ;
552
576
},
577
+ colorModalOpen (){
578
+ this .colorModal = this .colorModalOpen ;
579
+ },
553
580
activeComponent: {
554
581
handler (){
555
582
if (this .activeComponent !== ' ' &&
@@ -603,6 +630,16 @@ li:hover{
603
630
height: 65vh ;
604
631
max- height: 80vh ;
605
632
}
633
+ .colorBox {
634
+ background- color: $subsecondary;
635
+ color: $menutext;
636
+ width: 65 % ;
637
+ padding: 15px ;
638
+ height: 65vh ;
639
+ max- height: 80vh ;
640
+ }
641
+
642
+
606
643
.noteNum {
607
644
width: 10 % ;
608
645
}
@@ -723,6 +760,20 @@ li:hover{
723
760
left: 4px ;
724
761
}
725
762
763
+ .colorLogo {
764
+ background: rgba ($subprimary, .9 );
765
+ color: $secondary;
766
+ border- radius: 4px ;
767
+ position: absolute;
768
+ top: 4px ;
769
+ left: 40px ;
770
+ }
771
+
772
+ .colorLogo : hover{
773
+ background: rgba ($subprimary, .6 );
774
+ color: rgba ($secondary, .8 );
775
+ }
776
+
726
777
.compNoteLogoEmpty {
727
778
background: rgba ($subprimary, .9 );
728
779
color: rgba ($primary, 1 );
@@ -736,6 +787,7 @@ li:hover{
736
787
color: rgba ($secondary, .8 );
737
788
}
738
789
790
+
739
791
.compNoteLogoEmpty : hover{
740
792
background: rgba ($subprimary, .6 );
741
793
color: rgba ($menutext, .4 );
@@ -816,4 +868,9 @@ li:hover{
816
868
background: rgba (177 , 171 , 171 , 0.562 );
817
869
}
818
870
871
+ .colorContainer {
872
+ position: relative;
873
+ background: black
874
+ }
875
+
819
876
< / style>
0 commit comments