I’m able to add the node from Html Drag but it keeps on adding to center of diagram. the
dragged.offsetX = event.offsetX - dragged.clientWidth / 2;
dragged.offsetY = event.offsetY - dragged.clientHeight / 2;
above lines seems to work i’ve checked with
console.log(mx);
console.log(my);
console.log(point);
but still somehow the node is appearing in center of canvas.
Have you set Diagram.contentAlignment to go.Spot.Center, or somehow else to cause automatic scrolling of the diagram so that the new node becomes centered in the viewport?
Well, check the location of the newly created Node and compare it with the Diagram.viewportBounds.center value, to see if they are near each other, and whether it has changed since your drop code added the node. If the location hasn’t changed, then it hasn’t moved, but maybe the diagram has been scrolled.