Skip to content

Commit f485539

Browse files
Shanon LeeShanon Lee
authored andcommitted
Functional ComponentDisplay with VueDraggableResizable; bug in handles & resize
1 parent 506ef14 commit f485539

File tree

4 files changed

+35
-65
lines changed

4 files changed

+35
-65
lines changed

package-lock.json

Lines changed: 15 additions & 0 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
@@ -30,6 +30,7 @@
3030
"node-gyp": "^8.4.1",
3131
"quasar": "^2.0.0",
3232
"quasar-dotenv": "^1.0.5",
33+
"vue-draggable-resizable": "^2.3.0",
3334
"vue-multiselect": "^3.0.0-alpha.1",
3435
"vue-prism-editor": "^2.0.0-alpha.2",
3536
"vued3tree": "^5.1.0",

quasar.conf.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ module.exports = configure(function (ctx) {
2626
// --> boot files are part of "main.js"
2727
// https://quasar.dev/quasar-cli/boot-files
2828
boot: [
29-
// "globals"
3029
],
3130

3231
// https://quasar.dev/quasar-cli/quasar-conf-js#Property%3A-css

src/components/ComponentDisplay.vue

Lines changed: 19 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -13,40 +13,8 @@ Description:
1313
>
1414
<!-- This is the actual component box -->
1515
<!-- https://www.npmjs.com/package/vue-draggable-resizable -->
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"
16+
<vue-draggable-resizable
17+
class-name="component-box"
5018
v-for="componentData in activeRouteArray"
5119
ref="boxes"
5220
:key="componentData.componentName"
@@ -101,15 +69,7 @@ Description:
10169
</q-item>
10270
</q-list>
10371
</q-menu>
104-
</vue-draggable-resizable> -->
105-
106-
107-
108-
<!-- ************************ Vue3 draggable resizable ******************* -->
109-
110-
111-
112-
<!-- ********************* This part works, don't touch it *************** -->
72+
</vue-draggable-resizable>
11373
<div>
11474
<q-dialog v-model="modalOpen">
11575
<q-select
@@ -130,20 +90,16 @@ Description:
13090
</template>
13191

13292
<script>
133-
import { defineComponent } from "vue"
13493
import { mapState, mapActions } from "vuex";
135-
// import Vue3DraggableResizable from 'vue3-draggable-resizable';
94+
import VueDraggableResizable from 'vue-draggable-resizable/src/components/vue-draggable-resizable.vue'
95+
import 'vue-draggable-resizable/src/components/vue-draggable-resizable.css'
13696
137-
// import { DraggableContainer } from 'vue3-draggable-resizable'
138-
// import VueDraggableResizable from "vue-draggable-resizable";
139-
// import "vue-draggable-resizable/dist/VueDraggableResizable.css";
14097
const cloneDeep = require('lodash.clonedeep')
14198
142-
14399
export default {
144100
name: "ComponentDisplay",
145101
components: {
146-
// Vue3DraggableResizable
102+
VueDraggableResizable
147103
},
148104
data() {
149105
// console.log("Current Component Map is: ", this.componentMap);
@@ -204,6 +160,7 @@ export default {
204160
activeComponentData() {
205161
// Must deep clone this so we are not directly mutating state
206162
return cloneDeep(this.activeComponentObj);
163+
// return this.activeComponentObj;
207164
},
208165
// childList () {
209166
// return this.componentMap[componentData.componentName].children
@@ -262,10 +219,10 @@ export default {
262219
this.$refs.boxes.forEach(element => {
263220
element.enabled = false;
264221
265-
// element.$emit("deactivated");
266-
// element.$emit("update:active", false);
267-
this.$emit("deactivated");
268-
this.$emit("update:active", false);
222+
element.$emit("deactivated");
223+
element.$emit("update:active", false);
224+
// this.$emit("deactivated");
225+
// this.$emit("update:active", false);
269226
});
270227
}
271228
} else {
@@ -278,10 +235,10 @@ export default {
278235
element.enabled === false
279236
) {
280237
element.enabled = true;
281-
// element.$emit("activated");
282-
// element.$emit("update:active", true);
283-
this.$emit("activated");
284-
this.$emit("update:active", true);
238+
element.$emit("activated");
239+
element.$emit("update:active", true);
240+
// this.$emit("activated");
241+
// this.$emit("update:active", true);
285242
}
286243
});
287244
}
@@ -385,12 +342,10 @@ export default {
385342
if (element.id !== componentData.componentName) {
386343
console.log('Emit')
387344
element.enabled = false;
388-
// element.$emit("deactivated");
389-
390-
// element.$emit("update:active", false);
391-
this.$emit("deactivated");
392-
393-
this.$emit("update:active", false);
345+
element.$emit("deactivated");
346+
element.$emit("update:active", false);
347+
// this.$emit("deactivated");
348+
// this.$emit("update:active", false);
394349
}
395350
});
396351
}

0 commit comments

Comments
 (0)