I have 2 lines, one of which I can move or resize by dragging the points. The 2nd line should always remain in the middle of the 1st line… Works actually already, only when moving the points moves the 2nd line always in the middle (to the left). The starting point of the 2nd line should always be at the 1st line n (so as in the initial situation).
Could someone help me on the jumps or say where my thinking error is?
You could try a direct message to the author of the original post, @nithindavis for help with this.
Near the bottom is a section titled, Moving the line with drag & The Offset Complication
So with this approach, the lines are represented as rectangles that get resized and rotated, and the anchor point for a widget–its (x, y) reference point–is basically where it would be if the widget were not rotated, and not where you would expect/want it to be. Also, your initial “vertical line” starts with a 90° rotation, so it is hard to understand if the x-position or y-position needs to be referred…or both. It does seem like your line2 widget is treated as a center-anchored widget instead of top-left.
…it looks like your x-position in the **Move line2" action follows the offset adjustment expression (with Math.sin(theta) function), but the y-position doesn’t. Interestingly, just adding it in doesn’t seem to change the line2 positioning though.
…it also looks like line2 is not always exactly midway in the middle of line1. I’m not sure if you’re calculating the midpoint correctly …nor why boxTop and boxBottom are different sizes and not center- and middle-aligned with the line1 endpoints …nor what the dragLine panel is for. If you increase the opacity for these dynamic panels, you’ll see they are not moving with perfect alignment with line1, as they do with the prototype in the original post.
To help with troubleshooting this, you could have line2 report its position, like a Set Text or Set Variable action it its Moved event, to give you real-time info on where its (x, y) anchor location is. Compare that to where it shows up, either by moving your mouse there and looking at the Cursor location, or moving a test widget to that location to see how far off it is. That might help narrow down what needs to be adjusted.