@@ -13,8 +13,40 @@ Description:
1313 >
1414 <!-- This is the actual component box -->
1515 <!-- https://www.npmjs.com/package/vue-draggable-resizable -->
16- <VueDraggableResizable
17- class-name =" component-box"
16+
17+ <!-- // ***************** Without draggable resizable, this works *********** -->
18+ <!-- <div
19+ class="component-box"
20+ v-for="componentData in activeRouteArray"
21+ ref="boxes"
22+ :key="componentData.componentName"
23+ :id="componentData.componentName"
24+ :x="componentData.x"
25+ :y="componentData.y"
26+ :z="componentData.z"
27+ :w="componentData.w"
28+ :h="componentData.h"
29+ :parent="true"
30+ :preventDeactivation="true"
31+ @activated="onActivated(componentData)"
32+ @click="onActivated(componentData)"
33+ @deactivated="onDeactivated(componentData)"
34+ @dragstop="finishedDrag"
35+ @resizestop="finishedResize"
36+ :onDragStart="recordInitialPosition"
37+ :onResizeStart="recordInitialSize"
38+ >
39+ {{ componentData.componentName }}
40+ {{ componentData.w }}
41+ {{ componentData.x }}
42+ {{ componentData.y }}
43+ {{ componentData.z }}
44+ {{ componentData.h }}
45+ </div> -->
46+
47+ <!-- ************************** Old vue draggable resizable *************** -->
48+ <!-- <vue-draggable-resizable
49+ class="component-box"
1850 v-for="componentData in activeRouteArray"
1951 ref="boxes"
2052 :key="componentData.componentName"
@@ -69,9 +101,15 @@ Description:
69101 </q-item>
70102 </q-list>
71103 </q-menu>
72- </VueDraggableResizable >
104+ </vue-draggable-resizable> -->
105+
73106
74107
108+ <!-- ************************ Vue3 draggable resizable ******************* -->
109+
110+
111+
112+ <!-- ********************* This part works, don't touch it *************** -->
75113 <div >
76114 <q-dialog v-model =" modalOpen" >
77115 <q-select
@@ -92,16 +130,20 @@ Description:
92130</template >
93131
94132<script >
133+ import { defineComponent } from " vue"
95134import { mapState , mapActions } from " vuex" ;
96- import VueDraggableResizable from " vue-draggable-resizable" ;
97- const cloneDeep = require (' lodash.clonedeep' )
135+ // import Vue3DraggableResizable from 'vue3-draggable-resizable';
136+
137+ // import { DraggableContainer } from 'vue3-draggable-resizable'
138+ // import VueDraggableResizable from "vue-draggable-resizable";
98139// import "vue-draggable-resizable/dist/VueDraggableResizable.css";
99- // import Vue3DraggableResizable from "vue3-draggable-resizable";
100- // import "vue3-draggable-resizable/dist/Vue3DraggableResizable.css";
140+ const cloneDeep = require (' lodash.clonedeep' )
141+
142+
101143export default {
102144 name: " ComponentDisplay" ,
103145 components: {
104- VueDraggableResizable
146+ // Vue3DraggableResizable
105147 },
106148 data () {
107149 // console.log("Current Component Map is: ", this.componentMap);
@@ -156,7 +198,6 @@ export default {
156198 ]),
157199 // used in VueDraggableResizeable component
158200 activeRouteArray () {
159- // console.log(this.routes[this.activeRoute]);
160201 return this .routes [this .activeRoute ];
161202 },
162203 // used to delete active component
@@ -214,25 +255,33 @@ export default {
214255 }
215256 },
216257 updated () {
258+ // console.log(this.$refs.boxes);
217259 // if there are no active components, all boxes are unhighlighted
218260 if (this .activeComponent === " " ) {
219261 if (this .$refs .boxes ) {
220262 this .$refs .boxes .forEach (element => {
221263 element .enabled = false ;
222- element .$emit (" deactivated" );
223- element .$emit (" update:active" , false );
264+
265+ // element.$emit("deactivated");
266+ // element.$emit("update:active", false);
267+ this .$emit (" deactivated" );
268+ this .$emit (" update:active" , false );
224269 });
225270 }
226271 } else {
227272 // if a component is set to active, highlight it
228273 this .$refs .boxes .forEach (element => {
229274 if (
230- this .activeComponent === element .$attrs .id &&
275+ // this.activeComponent === element.$attrs.id &&
276+ // element.enabled === false
277+ this .activeComponent === element .id &&
231278 element .enabled === false
232279 ) {
233280 element .enabled = true ;
234- element .$emit (" activated" );
235- element .$emit (" update:active" , true );
281+ // element.$emit("activated");
282+ // element.$emit("update:active", true);
283+ this .$emit (" activated" );
284+ this .$emit (" update:active" , true );
236285 }
237286 });
238287 }
@@ -329,14 +378,19 @@ export default {
329378 */
330379 // unhighlights all inactive components
331380 onActivated (componentData ) {
381+ console .log (' This is ACTIVATED' )
332382 // console.log('onActivated - comp display, componentData', componentData)
333383 if (this .$refs .boxes ) {
334384 this .$refs .boxes .forEach (element => {
335- if (element .$attrs .id !== componentData .componentName ) {
385+ if (element .id !== componentData .componentName ) {
386+ console .log (' Emit' )
336387 element .enabled = false ;
337- element .$emit (" deactivated" );
338- // this.setActiveComponent(componentData.componentName)
339- element .$emit (" update:active" , false );
388+ // element.$emit("deactivated");
389+
390+ // element.$emit("update:active", false);
391+ this .$emit (" deactivated" );
392+
393+ this .$emit (" update:active" , false );
340394 }
341395 });
342396 }
@@ -347,6 +401,7 @@ export default {
347401 },
348402 // deactivated is emitted before activated
349403 onDeactivated () {
404+ console .log (' This is DEACTIVATED' )
350405 if (this .activeComponent !== " " ) {
351406 this .activeComponentData .isActive = false ;
352407 }
@@ -395,7 +450,7 @@ export default {
395450 }
396451 }
397452 }
398- };
453+ }
399454 </script >
400455
401456<style scoped>
0 commit comments