Hi Alex,
We could not able to drag and drop the list box component
item to diagram. Instead of using ListBox you can use the Treeview component.
From treeview component, you can able to drag and drop the node from treeview
to diagram. Once you dropped the treeview node in diagram, the treeview nodeDragStop
event get triggered. In the event get set the event args offsetX and offsetY
position to the node offsetX and offsetY position. So that node gets dropped at
mouse position. Please refer the below code example
|
function nodeDragStop(args: any): void {
let targetEle: any =
closest(args.target, '.e-droppable');
targetEle = targetEle ? targetEle
: args.target;
// check
an target as diagram
if
(targetEle.classList.contains("e-diagram")) {
let data: any =
args.draggedNodeData.text;
//add
an node at runtime
diagram.add({
id: data +
randomId(), width: 100, height: 100, offsetX: args.event.offsetX, offsetY:
args.event.offsetY,
annotations:
[{ content: data, }]
});
// Remove the treeview node after
add the node in diagram
args.clonedNode.remove();
}
}
|
We have attached a video demonstration of how drag and drop
from treeview to diagram get worked. Please find the video in the below link
Video: https://www.syncfusion.com/downloads/support/forum/176326/ze/Treeview-Diagram1489635824
For more information about how to create treeview , please
refer to the below UG link
UG Link: https://ej2.syncfusion.com/vue/documentation/treeview/getting-started/
Regards
Aravind Ravi