My drawing tool has two anchor points. The tool is point and click that plots a moving average starting from the users bar of choice, then automatically sets the endAnchor at the current bar; however, the user can click and move either start or endAnchor after they have been set. The issue arising is when I grab the startAnchor and move it further right, past the endAnchor the drawing disappears an I cannot click it anymore and vice versa with dragging the endAnchor further left, past the startAnchor.
What I am aiming for is not allowing the anchors to cross each other. I was thinking doing something like creating a barrier where the anchor cannot move past a bar index no matter how much you try to drag it past. I am not even sure if that is possible but I would like to hear any suggestions or examples of how I might accomplish this. Thanks.
Comment