clientIO / joint

A proven SVG-based JavaScript diagramming library powering exceptional UIs
https://jointjs.com
Mozilla Public License 2.0
4.73k stars 853 forks source link

feat(dia.ElementView): add getTargetParentView() method #2748

Closed kumilingus closed 2 months ago

kumilingus commented 2 months ago

Description

dia.ElementView.prototype.getTargetParentView(evt: dia.Event): dia.CellView | null;

The method returns a cell view (if any) that would become the parent of the currently dragged element view if the dragging were to finish immediately.

Usage

paper.on('element:pointermove', (elementView, evt) => {
    console.log(elementView.getTargetParentView(evt));
});

// It can also be used while the user is dragging an element from the stencil
stencil.on('element:drag', (cloneView, evt) => {
    console.log(cloneView.getTargetParentView(evt));
});