I have a shape with multiple labels. Here the shape is a rectangle that represent a class and the labels exist for the class name, properties and functions. The labels are drawn inside this shape. It looks like a traditional uml class diagram.
A mechanic to support label editing is already included.
Now i want to edit the corresponding label inside the shape on a doubleclick. When the doubleclick is fired i get from the event the shape element. From this shape element i can navigate to all labels but i don’t know which one i should select (navigate to). Could i get all model elements (here labels) from the position i double clicked from the element registry?
Do i have to implement a filter?
The basic idea is to support partial edit (here of the Class A).
First of all, thanks for sharing this marvelous screenshot. Do you build UML on top of diagram-js?
Could i get all model elements (here labels) from the position i double clicked from the element registry?
Unfortunately we do not offer the ability at the moment.
I’m not sure what exactly you’re double clicking but I presume it is the parent element of the labels? If that is the case, you may extract the actual click target from the event position + children and open the editor there.
So there exist no possibility to get all elements for a specific position from the element registry.
Therefore intersections between two connections (edges) are also hard and “inefficient” with the current data structure. Do i have to iterate through all elements from the registry to find possible elements that are intersected?
We’d love to see it open source so we’re able to link to it as an example. I’m sure it would serve as a great example of building editors on top of diagram-js .
Therefore intersections between two connections (edges) are also hard and “inefficient” with the current data structure. Do i have to iterate through all elements from the registry to find possible elements that are intersected?
The element registry is not meant as a bit map for element positions. You would need to maintain your own efficient data structure to figure out that information or turn to the browser for the heavy lifting.