Page Index Toggle Pages: [1] 2 3  Send TopicPrint
Very Hot Topic (More than 25 Replies) Drag & Drop Panel Bar Items to Diagram ! (Read 14964 times)
Kannan Thirumal
Senior Member
****
Offline


I Love Mind Fusion Diagram
:-)

Posts: 270
Location: Bangalore, India
Joined: Jan 18th, 2019
Drag & Drop Panel Bar Items to Diagram !
Aug 29th, 2019 at 1:01pm
Print Post  
Hi,

I've a panel bar in the right side of my application and it has some icons. I'm trying to drag and drop the icon to the diagram so that I can create a similar node dynamically. But drag is not enabled in diagram. May I know how to handle drag and drop? If you have any articles, please let me know.

Attached the screen shot of the scenario.

Sample code in the below link,

https://drive.google.com/open?id=1KP_uqiJ-vJPeeGKAAxztWSk8bynFMzxj

Regards,
Kannan
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3154
Joined: Oct 19th, 2005
Re: Drag & Drop Panel Bar Items to Diagram !
Reply #1 - Aug 29th, 2019 at 1:34pm
Print Post  
Hi,

There's some built-in drag and drop support provided by NodeListView control. Try implementing your palette component using NodeListView instances, maybe one for each page in the palette. You can add your node instances to NodeListView and they will get cloned when you drag them to the diagram canvas.

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
Kannan Thirumal
Senior Member
****
Offline


I Love Mind Fusion Diagram
:-)

Posts: 270
Location: Bangalore, India
Joined: Jan 18th, 2019
Re: Drag & Drop Panel Bar Items to Diagram !
Reply #2 - Aug 30th, 2019 at 8:35am
Print Post  
Hi,

Thank you. I'm using typescript/angular. I couldn't find much help in the mindfusion site. Could you please provide any sample/demo link url to achieve this?

I've uploaded the sample code in the below url. If possible please provide a solution.

https://drive.google.com/open?id=1KP_uqiJ-vJPeeGKAAxztWSk8bynFMzxj

Regards,
Kannan
  
Back to top
 
IP Logged
 
Lyubo
God Member
*****
Offline


MindFusion team

Posts: 511
Joined: Jun 17th, 2010
Re: Drag & Drop Panel Bar Items to Diagram !
Reply #3 - Sep 2nd, 2019 at 10:26am
Print Post  
Hi,

You can find an example of using the NodeListView control here: https://mindfusion.eu/samples/javascript/diagram/tutorial4.html, with its code available here: https://mindfusion.eu/samples/javascript/diagram/Tutorial4.zip.

This sample uses custom nodes that inherit from ShapeNode. Our JsDiagram package (https://mindfusion.eu/JsDiagramTrial.zip has a version of the same sample, but using CompositeNodes.

Regards,
Lyubo

P.S. I can't seem to run the recent samples you provide, it one above gives the following error: "Error: Can't resolve 'stream'".
  
Back to top
 
IP Logged
 
Kannan Thirumal
Senior Member
****
Offline


I Love Mind Fusion Diagram
:-)

Posts: 270
Location: Bangalore, India
Joined: Jan 18th, 2019
Re: Drag & Drop Panel Bar Items to Diagram !
Reply #4 - Sep 3rd, 2019 at 9:04am
Print Post  
Hi,

Could you please check this sample?

https://drive.google.com/open?id=1At0B45vEiYmZG-Tw-2fA2Q5Bufd8nSok

Regards,
Kannan
  
Back to top
 
IP Logged
 
Kannan Thirumal
Senior Member
****
Offline


I Love Mind Fusion Diagram
:-)

Posts: 270
Location: Bangalore, India
Joined: Jan 18th, 2019
Re: Drag & Drop Panel Bar Items to Diagram !
Reply #5 - Sep 6th, 2019 at 9:14am
Print Post  
Hi,

I added the code from Tutorial4 to my application. I can add those icons to the NodeListView (to the left side of the diagram) and do drag and drop to the canvas and the node gets created automatically in the canvas. But still couldn't add the icons to my panel-bar component.

Please check the attached screen shot (Panel Bar Item, "Level-0") and code in the below url,

https://drive.google.com/open?id=1_90t4FOYhWfkY3Qa0pvKoCZT0sydPBtE

Also another approach is: I'm able to add my icons to my panel bar (in the right side of the diagram). But I'm not able to drag and drop to the canvas. Is it possible to get an event when dragged the palette icon and drop the same to the canvas? Because it is not necessary to automatically add the dropped icon to the diagram. I can add the node in the diagram myself when an event is raised.

Regards,
Kannan

Lyubo wrote on Sep 2nd, 2019 at 10:26am:
Hi,

You can find an example of using the NodeListView control here: https://mindfusion.eu/samples/javascript/diagram/tutorial4.html, with its code available here: https://mindfusion.eu/samples/javascript/diagram/Tutorial4.zip.

This sample uses custom nodes that inherit from ShapeNode. Our JsDiagram package (https://mindfusion.eu/JsDiagramTrial.zip has a version of the same sample, but using CompositeNodes.

Regards,
Lyubo

P.S. I can't seem to run the recent samples you provide, it one above gives the following error: "Error: Can't resolve 'stream'".

  

Drag_And_Drop_Panel_Diagram_Nodes.png ( 213 KB | 135 Downloads )
Drag_And_Drop_Panel_Diagram_Nodes.png
Back to top
 
IP Logged
 
liza
Full Member
***
Offline


I Love MindFusion!

Posts: 132
Joined: Apr 25th, 2019
Re: Drag & Drop Panel Bar Items to Diagram !
Reply #6 - Sep 6th, 2019 at 9:37am
Print Post  
Hi,
Can you tell me how you bought checkboxes in background of the canvas?
  
Back to top
AIM  
IP Logged
 
Kannan Thirumal
Senior Member
****
Offline


I Love Mind Fusion Diagram
:-)

Posts: 270
Location: Bangalore, India
Joined: Jan 18th, 2019
Re: Drag & Drop Panel Bar Items to Diagram !
Reply #7 - Sep 6th, 2019 at 11:13am
Print Post  
It is an image. That can be done by creating CompositeNode where we can use a template to define the node.

liza wrote on Sep 6th, 2019 at 9:37am:
Hi,
Can you tell me how you bought checkboxes in background of the canvas?

  
Back to top
 
IP Logged
 
Kannan Thirumal
Senior Member
****
Offline


I Love Mind Fusion Diagram
:-)

Posts: 270
Location: Bangalore, India
Joined: Jan 18th, 2019
Re: Drag & Drop Panel Bar Items to Diagram !
Reply #8 - Sep 9th, 2019 at 3:41am
Print Post  
Hi,

     Did you had a chance to check this?

Regards,
Kannan

Kannan Thirumal wrote on Sep 6th, 2019 at 9:14am:
Hi,

I added the code from Tutorial4 to my application. I can add those icons to the NodeListView (to the left side of the diagram) and do drag and drop to the canvas and the node gets created automatically in the canvas. But still couldn't add the icons to my panel-bar component.

Please check the attached screen shot (Panel Bar Item, "Level-0") and code in the below url,

https://drive.google.com/open?id=1_90t4FOYhWfkY3Qa0pvKoCZT0sydPBtE

Also another approach is: I'm able to add my icons to my panel bar (in the right side of the diagram). But I'm not able to drag and drop to the canvas. Is it possible to get an event when dragged the palette icon and drop the same to the canvas? Because it is not necessary to automatically add the dropped icon to the diagram. I can add the node in the diagram myself when an event is raised.

Regards,
Kannan

Lyubo wrote on Sep 2nd, 2019 at 10:26am:
Hi,

You can find an example of using the NodeListView control here: https://mindfusion.eu/samples/javascript/diagram/tutorial4.html, with its code available here: https://mindfusion.eu/samples/javascript/diagram/Tutorial4.zip.

This sample uses custom nodes that inherit from ShapeNode. Our JsDiagram package (https://mindfusion.eu/JsDiagramTrial.zip has a version of the same sample, but using CompositeNodes.

Regards,
Lyubo

P.S. I can't seem to run the recent samples you provide, it one above gives the following error: "Error: Can't resolve 'stream'".


  
Back to top
 
IP Logged
 
Lyubo
God Member
*****
Offline


MindFusion team

Posts: 511
Joined: Jun 17th, 2010
Re: Drag & Drop Panel Bar Items to Diagram !
Reply #9 - Sep 9th, 2019 at 10:04am
Print Post  
Hi,

To use drag and drop from other controls, you can try with the HTML Drag and Drop API. In short, you can set the draggable attribute of the diagram's canvas element to true, and then you can handle the DragOver and Drop events to create your nodes.

On your panel-bar component, you'll handle the DragStart event, to provide the node data that will be used to create the node later in the Drop event.

We have an example of that in the DragDrop sample that comes with the JsDiagram package. There you can see how to handle the drag/drop events, and in addition to that, a way to show an indication of the node, during the drag operation. The sample is available in the latest release: https://mindfusion.eu/JsDiagramTrial.zip, or online here: https://mindfusion.eu/javascript-demo.html?sample=drag-drop

Regards,
Lyubo
MindFusion
  
Back to top
 
IP Logged
 
Kannan Thirumal
Senior Member
****
Offline


I Love Mind Fusion Diagram
:-)

Posts: 270
Location: Bangalore, India
Joined: Jan 18th, 2019
Re: Drag & Drop Panel Bar Items to Diagram !
Reply #10 - Sep 10th, 2019 at 5:13am
Print Post  
Hi,

I downloaded this sample (https://mindfusion.eu/JsDiagramTrial.zip) and tried. Javascript code is working but Typescript code doesn't seems working. Could you please check it?

\Samples\TypeScript\DragDrop.html
\Samples\TypeScript\DragDrop.ts

Regards,
Kannan

Lyubo wrote on Sep 9th, 2019 at 10:04am:
Hi,

To use drag and drop from other controls, you can try with the HTML Drag and Drop API. In short, you can set the draggable attribute of the diagram's canvas element to true, and then you can handle the DragOver and Drop events to create your nodes.

On your panel-bar component, you'll handle the DragStart event, to provide the node data that will be used to create the node later in the Drop event.

We have an example of that in the DragDrop sample that comes with the JsDiagram package. There you can see how to handle the drag/drop events, and in addition to that, a way to show an indication of the node, during the drag operation. The sample is available in the latest release: https://mindfusion.eu/JsDiagramTrial.zip, or online here: https://mindfusion.eu/javascript-demo.html?sample=drag-drop

Regards,
Lyubo
MindFusion

  
Back to top
 
IP Logged
 
Lyubo
God Member
*****
Offline


MindFusion team

Posts: 511
Joined: Jun 17th, 2010
Re: Drag & Drop Panel Bar Items to Diagram !
Reply #11 - Sep 10th, 2019 at 6:14am
Print Post  
Hi,

The sample works fine for me (see attached screenshot). Are you seeing any errors in the browser console?

The TypeScript files are not transpiled to JavaScript, so you need to either use the provided Samples Visual Studio project, or use tsc to transpile the sample code before running it in a browser.

Regards,
Lyubo
MindFusion
  

dragdrop.png ( 42 KB | 151 Downloads )
dragdrop.png
Back to top
 
IP Logged
 
Kannan Thirumal
Senior Member
****
Offline


I Love Mind Fusion Diagram
:-)

Posts: 270
Location: Bangalore, India
Joined: Jan 18th, 2019
Re: Drag & Drop Panel Bar Items to Diagram !
Reply #12 - Sep 10th, 2019 at 6:53am
Print Post  
Hi,

I opened the Samples.sln and run the application. The container node is not created and also showing error in the browser console after dragging. Please see the attached screen shot.

Regards,
Kannan
  
Back to top
 
IP Logged
 
Kannan Thirumal
Senior Member
****
Offline


I Love Mind Fusion Diagram
:-)

Posts: 270
Location: Bangalore, India
Joined: Jan 18th, 2019
Re: Drag & Drop Panel Bar Items to Diagram !
Reply #13 - Sep 10th, 2019 at 7:10am
Print Post  
Sorry, it is working now (previously when it was not working, I did some changes in the sample code and once undo, it works now). Thank you.

Kannan Thirumal wrote on Sep 10th, 2019 at 6:53am:
Hi,

I opened the Samples.sln and run the application. The container node is not created and also showing error in the browser console after dragging. Please see the attached screen shot.

Regards,
Kannan

  
Back to top
 
IP Logged
 
Kannan Thirumal
Senior Member
****
Offline


I Love Mind Fusion Diagram
:-)

Posts: 270
Location: Bangalore, India
Joined: Jan 18th, 2019
Re: Drag & Drop Panel Bar Items to Diagram !
Reply #14 - Sep 10th, 2019 at 2:18pm
Print Post  
Hi,

I tried to integrate the sample code to my typescript/angular application but the drag and drop events are not getting invoked. I've uploaded the sample code (MindFusionDiagram.sln). May I know where I'm wrong?

https://drive.google.com/open?id=1kkpK_q1WXYXB_bp-A_9dyhDe-IbRJiuj

Regards,
Kannan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: [1] 2 3 
Send TopicPrint