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,19 +518,6 @@ 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
522
return htmlList .find (({ text }) => text[0 ] === ' e' );
541
523
},
@@ -550,14 +532,6 @@ export default {
550
532
this .updateColor (payload)
551
533
this .refresh ();
552
534
},
553
-
554
- // records component's initial size/position in case of resize (also graveyard - dont need initial size?)
555
- // recordInitialSize: function (e) {
556
- // this.initialSize.h = this.activeComponentData.h;
557
- // this.initialSize.w = this.activeComponentData.w;
558
- // this.initialPosition.x = this.activeComponentData.x;
559
- // this.initialPosition.y = this.activeComponentData.y;
560
- // },
561
535
// sets component's ending size/position
562
536
finishedResize : function (x , y , w , h ) {
563
537
let payload = {
@@ -569,19 +543,12 @@ export default {
569
543
routeArray: this .routes [this .activeRoute ],
570
544
activeComponentData: this .activeComponentData ,
571
545
};
572
- // if (
573
- // payload.x !== this.initialPosition.x ||
574
- // payload.y !== this.initialPosition.y ||
575
- // payload.w !== this.initialSize.w ||
576
- // payload.h !== this.initialSize.h
577
- // ) {
578
546
this .updateComponentSize (payload);
579
547
this .updateComponentGridPosition (payload);
580
- // }
581
548
this .refresh ();
582
549
},
583
550
584
- // refresh function - super ghetto refresh function
551
+ // refresh function
585
552
refresh () {
586
553
const payload = {
587
554
activeComponent: this .activeComponent ,
@@ -594,7 +561,7 @@ export default {
594
561
payload .z -- ;
595
562
this .updateComponentLayer (payload);
596
563
},
597
- // ! drag and drop function
564
+ // drag and drop function
598
565
finishedDrag : function (x , y ) {
599
566
let payload = {
600
567
x: x,
@@ -650,7 +617,7 @@ export default {
650
617
this .openNoteModal ();
651
618
}
652
619
},
653
- // color editor - opens the pop up
620
+ // color editor - opens the pop up
654
621
handleEditColor () {
655
622
if (this .wasDragged === false && this .activeComponent !== ' ' ) {
656
623
this .openColorModal ();
@@ -892,7 +859,6 @@ behavior: url(/pie/PIE.htc);
892
859
height : 720px ;
893
860
background-color : rgba (223 , 218 , 218 , 0.886 );
894
861
background-size : 100px 100px , 100px 100px , 20px 20px , 20px 20px ;
895
- // background-position: -2px -2px, -2px -2px, -1px -1px, -1px -1px;
896
862
background-image : -webkit-linear-gradient (rgba (255 , 255 , 255 , 0.8 ) 1px , transparent 1px ),
897
863
-webkit-linear-gradient (0 , rgba (255 , 255 , 255 , 0.8 ) 1px , transparent 1px ),
898
864
-webkit-linear-gradient (rgba (255 , 255 , 255 , 0.3 ) 1px , transparent 1px ),
@@ -971,15 +937,13 @@ behavior: url(/pie/PIE.htc);
971
937
.component-box {
972
938
color : $menutext ;
973
939
border : 1.2px dashed $darktext ;
974
- // background-color: rgba($darktext, .42);
975
940
-webkit-transition : background-color 200ms linear ;
976
941
-ms-transition : background-color 200ms linear ;
977
942
transition : background-color 200ms linear ;
978
943
position : absolute ;
979
944
}
980
945
981
946
.active {
982
- // background-color: rgba($secondary, .42);
983
947
border : 3px solid $primary ;
984
948
}
985
949
0 commit comments