Drag and Drop the objects into the line border

Hi All

I would like to know how to drag and drop the objects into the line border of a object such as I drag a circle and drop it into the line border of rectangle.

Did u have any the example to do this problem ?

Thank you

Could you describe what you want more precisely by including two sketches or screenshots, showing both before and after?

Thank walter

It’s like as BPMN example (http://gojs.net/latest/extensions/BPMN.html) but this example show how to add the events by using right click on the node task but I would like to drag the event and drop into the line border of the node task.

Thank you.

OK, if you understand how to add such objects to a node by means of a context menu command, then you can call the same mechanism from a GraphObject | GoJS API event handler. Look at the Diagram | GoJS API collection to see what the user is dragging.

Thank walter

Did you mean I have to calculate the position the node event is dropped by myself? Is it possible to implement like as the dragged and dropped the object into the lane ?

Thank you

No, any GraphObject.mouseDrop event handler is only called when the user completes a drag-and-drop operation somewhere onto that GraphObject. You can look at the InputEvent.documentPoint if you want to know exactly where. You can call GraphObject.getLocalPoint to convert the point in document coordinates into a point in that object’s local coordinates, if you want to find out which side of the object the user dropped the selection.

Thank walter

It’s very clear.

But I have a question, How to check the node event that is dropped into the line of border exactly because sometime the use can drag-and-drop the node event into the inside of the another object.

Thank you very much

I’m not sure what situation you are concerned about.

A Shape with a null Shape.fill will not receive any mouse events except exactly on the stroke. That means not anywhere inside the shape’s geometry.

Thank you very much walter