If a text has a container ID, it means that it's a part of a labeled arrow and not a regular text. Otherwise it's a regular text. So yeah, this is this looks simple. Linking both of this is fairly simple.
Now once we have done this, what we can do is as I'm moving the labeled arrow, I can check whether this arrow has a label ID. Let me move the text as well. When I'm resizing the labeled arrow, I can check does this arrow have a label ID? Let me resize the text as well. So whatever actions you apply to the labeled arrow will be replicated to the text element as well because you are able to link both of these. So yeah, once this is done, this requirement also gets fulfilled.
Now let's jump to the next one, which is how should the label be rendered for multi-point arrows? So in this one, if you see, these are multi-point arrows. By multi-point arrow, I mean any complex arrow more than two points. So in this one, if you see, by following the older logic, where I took two extreme points and I render the text in the line, the midpoint of the line, then it would look like this because this is the line by joining the two extreme points of the arrow and this is the middle point. But this looks a little disconnected from the shapes, right? It's not really connected to the shapes. So now we need some intuitiveness, some logic here, how we can make it better.
So what we can do is an arrow can either have odd number of points or even number of points. What we can do is this is an arrow with odd number of points. So when you have odd number of points, you always have a middle point. So let's just attach the text to the middle point. Wherever this middle point is, let's just attach the text to the middle point. That way it will be intuitive for one part of the arrows where you have odd number of points. Now what do you do? This is how it will look. So now what do you do when even number of points, you don't have any midpoint here, but when you have even number of points, you have odd number of segments. So if you see one, two, three, four, five segments are here, let's take the middle segment and middle point of the middle segment. So in this one, we can just render the text in this particular position where you have even number of points. So in gist, this is how it will look like. Now the text is actually attached to these arrows and it will make you feel that, okay, these multipoint arrows are actually connected with it. So this is one way of doing it. This is how it's done in Excalibur as well. And the next one is how we want to render the label when the arrow is rotated to a certain angle. Let's consider these example.
Comments