joint icon indicating copy to clipboard operation
joint copied to clipboard

feat(linkTools.Vertices): add vertexAdding interactiveLinkNode option

Open kumilingus opened this issue 8 months ago • 0 comments

Description

The current solution with the linkTools.Vertices and its extra path overlay has several disadvantages. For example, it was not possible to move labels and create vertices at the same time (because an invisible path was rendered above the link and the labels).

This PR allows you to choose an existing node from the link view to serve as an interactive hit area for creating vertices.

Docs

https://docs.jointjs.com/api/linkTools/#vertices

vertexAdding

Can the user add new vertices (by clicking a segment of the link)?

Value Description
false The user can not add new vertices.
true An invisible path is rendered above the link which creates vertices upon interaction with it.
{} See VertexAddingOptions

VertexAddingOptions

Option Description
interactiveLinkNode: string; A selector of an existing link node, e.g. "wrapper". When the node is interacted with, a vertex is created.

The default is true.

const verticesTool = new linkTools.Vertices({ vertexAdding: { interactiveLinkNode: 'outline' }}),

Implements https://github.com/clientIO/joint/issues/2688. Solves: https://github.com/clientIO/joint/discussions/2370

kumilingus avatar Jun 08 '24 16:06 kumilingus