@@ -5,8 +5,13 @@ Description:
5
5
-->
6
6
7
7
<script setup lang="ts">
8
- import VueTree from "@ssthouse/vue3-tree-chart";
9
- import "@ssthouse/vue3-tree-chart/dist/vue3-tree-chart.css";
8
+ // import VueTree from "@ssthouse/vue3-tree-chart";
9
+ // import "@ssthouse/vue3-tree-chart/dist/vue3-tree-chart.css";
10
+
11
+ // OverVue v.10.0 –– edited @sst-house files to remove background drag functionality
12
+ import VueTree from "@overvue/vue3-tree-chart";
13
+ import "@overvue/vue3-tree-chart/dist/vue3-tree-chart.css";
14
+
10
15
import { useStore } from "../../store/main.js";
11
16
import { ref, computed, watch } from "vue";
12
17
@@ -157,6 +162,40 @@ watch(
157
162
158
163
{ deep: true }
159
164
);
165
+
166
+ /*METHODS FOR DRAG-AND-DROP */
167
+ const startDrag = (event: Event) => {
168
+ // //add a class to make the html element currently being drag transparent
169
+ (event.target as HTMLElement).classList.add("currentlyDragging");
170
+ // const dragId = id;
171
+ // //store the id of dragged element
172
+ // if (activeComponent.value === "") setSelectedIdDrag(dragId);
173
+ // else setIdDrag(dragId);
174
+ console.log("drag event: ", event);
175
+ };
176
+
177
+ const dragEnter = (event: Event, id: string) => {
178
+ // event.preventDefault();
179
+ // const dropId = id;
180
+ // //store the id of the html element whose location the dragged html element could be dropped upon
181
+ // if (activeComponent.value === "") setSelectedIdDrop(dropId);
182
+ // else setIdDrop(dropId);
183
+ };
184
+
185
+ const dragOver = (event: Event) => {
186
+ // //needed stop the dragend animation so endDrag is invoked automatically
187
+ // event.preventDefault();
188
+ };
189
+
190
+ const endDrag = (event: Event) => {
191
+ // //remove the 'currentlyDragging' class after the HTML is dropped to remove transparency
192
+ event.preventDefault();
193
+ (event.target as HTMLElement).classList.remove("currentlyDragging");
194
+ console.log("drag ended: ", event);
195
+ // //invoke the action that will use the idDrag and idDrop to sort the HtmlList
196
+ // if (activeComponent.value === "") dragDropSortSelectedHtmlElements();
197
+ // else dragDropSortHtmlElements();
198
+ };
160
199
</script>
161
200
162
201
<template>
@@ -169,7 +208,14 @@ watch(
169
208
@wheel="zoom"
170
209
>
171
210
<template v-slot:node="{ node }">
172
- <span v-if="activeComponent === node.value" class="tree-node-active">
211
+ <span
212
+ v-if="activeComponent === node.value"
213
+ class="tree-node-active"
214
+ @dragstart="startDrag($event)"
215
+ draggable="true"
216
+ :stop-propagation="true"
217
+ @dragend="endDrag($event)"
218
+ >
173
219
{{ node.value }}
174
220
</span>
175
221
<span
@@ -178,7 +224,15 @@ watch(
178
224
>
179
225
{{ node.value }}
180
226
</span>
181
- <span v-else class="tree-node" @click="activateNode(node.value)">
227
+ <span
228
+ v-else
229
+ class="tree-node"
230
+ @click="activateNode(node.value)"
231
+ @dragstart="startDrag($event)"
232
+ draggable="true"
233
+ :stop-propagation="true"
234
+ @dragend="endDrag($event)"
235
+ >
182
236
{{ node.value }}
183
237
</span>
184
238
</template>
0 commit comments