16
16
<!-- https://www.npmjs.com/package/vue-draggable-resizable -->
17
17
<p class =" cssContainerText" > {{this.activeRoute}} Preview </p >
18
18
<!-- each component box in canvas will have these properties-->
19
- <!-- :onDragStart="recordInitialPosition" :onResizeStart="recordInitialSize" :preventDeactivation="true" graveyard attribute -->
20
19
<vue-draggable-resizable
21
20
class-name =" component-box"
22
21
v-for =" componentData in activeRouteArray"
347
346
import { useExportComponent } from " ./composables/useExportComponent.js" ;
348
347
import { mapState , mapActions } from " vuex" ;
349
348
import VueDraggableResizable from " vue-draggable-resizable/src/components/vue-draggable-resizable.vue" ;
350
- // import Vue3DraggableResizable from 'vue3-draggable-resizable'
351
349
import VueMultiselect from " vue-multiselect" ;
352
350
import " vue-draggable-resizable/src/components/vue-draggable-resizable.css" ;
353
351
import ' vue3-draggable-resizable/dist/Vue3DraggableResizable.css'
@@ -360,7 +358,6 @@ const cloneDeep = require("lodash.clonedeep");
360
358
export default {
361
359
name: " Canvas" ,
362
360
components: {
363
- // Vue3DraggableResizable,
364
361
VueDraggableResizable,
365
362
VueMultiselect,
366
363
ColorPicker,
@@ -374,8 +371,6 @@ export default {
374
371
noteModal: false ,
375
372
colorModal: false ,
376
373
mockImg: false ,
377
- // initialPosition: { x: 0, y: 0 },
378
- // initialSize: { w: 0, h: 0 },
379
374
htmlElements: [],
380
375
childrenSelected: [],
381
376
};
@@ -523,21 +518,7 @@ export default {
523
518
useExportComponentBound () {
524
519
useExportComponent .bind (this )();
525
520
},
526
- // !records component's initial position in case of drag - CHRIS: probably don't need this function?
527
- // recordInitialPosition: function (e) {
528
- // if (this.activeComponent !== e.target.id) {
529
- // if (e.target.parentElement?.classList.contains('draggable')) {
530
- // // this.setActiveComponent(e.target.parentElement.id)
531
- // }
532
- // else if (typeof `${e.target.id}` !== 'number') {
533
- // // this.setActiveComponent(e.target.id);
534
- // }
535
- // }
536
- // this.initialPosition.x = this.activeComponentData.x;
537
- // this.initialPosition.y = this.activeComponentData.y;
538
- // },
539
521
isElementPlus (htmlList ) {
540
- console .log (htmlList);
541
522
return htmlList .find (({ text }) => text[0 ] === ' e' );
542
523
},
543
524
// color change function
@@ -551,14 +532,6 @@ export default {
551
532
this .updateColor (payload)
552
533
this .refresh ();
553
534
},
554
-
555
- // records component's initial size/position in case of resize (also graveyard - dont need initial size?)
556
- // recordInitialSize: function (e) {
557
- // this.initialSize.h = this.activeComponentData.h;
558
- // this.initialSize.w = this.activeComponentData.w;
559
- // this.initialPosition.x = this.activeComponentData.x;
560
- // this.initialPosition.y = this.activeComponentData.y;
561
- // },
562
535
// sets component's ending size/position
563
536
finishedResize : function (x , y , w , h ) {
564
537
let payload = {
@@ -570,19 +543,12 @@ export default {
570
543
routeArray: this .routes [this .activeRoute ],
571
544
activeComponentData: this .activeComponentData ,
572
545
};
573
- // if (
574
- // payload.x !== this.initialPosition.x ||
575
- // payload.y !== this.initialPosition.y ||
576
- // payload.w !== this.initialSize.w ||
577
- // payload.h !== this.initialSize.h
578
- // ) {
579
546
this .updateComponentSize (payload);
580
547
this .updateComponentGridPosition (payload);
581
- // }
582
548
this .refresh ();
583
549
},
584
550
585
- // refresh function - super ghetto refresh function
551
+ // refresh function
586
552
refresh () {
587
553
const payload = {
588
554
activeComponent: this .activeComponent ,
@@ -595,7 +561,7 @@ export default {
595
561
payload .z -- ;
596
562
this .updateComponentLayer (payload);
597
563
},
598
- // ! drag and drop function
564
+ // drag and drop function
599
565
finishedDrag : function (x , y ) {
600
566
let payload = {
601
567
x: x,
@@ -647,12 +613,11 @@ export default {
647
613
648
614
// renders modal with Update Children and Layer in it
649
615
handleAddNotes () {
650
- console .log (this .activeComponentData );
651
616
if (this .wasDragged === false && this .activeComponent !== ' ' ) {
652
617
this .openNoteModal ();
653
618
}
654
619
},
655
- // color editor - opens the pop up
620
+ // color editor - opens the pop up
656
621
handleEditColor () {
657
622
if (this .wasDragged === false && this .activeComponent !== ' ' ) {
658
623
this .openColorModal ();
@@ -894,7 +859,6 @@ behavior: url(/pie/PIE.htc);
894
859
height : 720px ;
895
860
background-color : rgba (223 , 218 , 218 , 0.886 );
896
861
background-size : 100px 100px , 100px 100px , 20px 20px , 20px 20px ;
897
- // background-position: -2px -2px, -2px -2px, -1px -1px, -1px -1px;
898
862
background-image : -webkit-linear-gradient (rgba (255 , 255 , 255 , 0.8 ) 1px , transparent 1px ),
899
863
-webkit-linear-gradient (0 , rgba (255 , 255 , 255 , 0.8 ) 1px , transparent 1px ),
900
864
-webkit-linear-gradient (rgba (255 , 255 , 255 , 0.3 ) 1px , transparent 1px ),
@@ -973,15 +937,13 @@ behavior: url(/pie/PIE.htc);
973
937
.component-box {
974
938
color : $menutext ;
975
939
border : 1.2px dashed $darktext ;
976
- // background-color: rgba($darktext, .42);
977
940
-webkit-transition : background-color 200ms linear ;
978
941
-ms-transition : background-color 200ms linear ;
979
942
transition : background-color 200ms linear ;
980
943
position : absolute ;
981
944
}
982
945
983
946
.active {
984
- // background-color: rgba($secondary, .42);
985
947
border : 3px solid $primary ;
986
948
}
987
949
0 commit comments