Skip to content

Is there a way to add labels to links on the place where I dbclick? #2788

Answered by kumilingus
Naveena1321 asked this question in Q&A
Discussion options

You must be logged in to vote
paper.on('link:pointerdblclick', (linkView, evt, x, y) => {
   const ratio = linkView.getClosestPointRatio({ x, y });
   linkView.model.appendLabel({ attrs: { text: { text: 'Label' }}, position: { distance: ratio }});
   // update the linkView immediately
   paper.requireView(link);   
   
   const labelTextNode = linkView.findNodeLabel(0, 'text');
   // edit the `labelTextNode` with the TextEditor
});

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@Naveena1321
Comment options

@Naveena1321
Comment options

@kumilingus
Comment options

Answer selected by Naveena1321
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants