# Making 2 independent points stick together

I want to have 2 points, like (x1, 0) and (x2, 1) that are can be dragged left-right independently.

But once you drag either point so x1 and x2 are equal (so the points line up vertically), then dragging x1 causes x2 to be dragged as well, and dragging x2 causes x1 to be dragged as well…so the two points get linked together.

x1 and x2 both have slider limits, say from -4 to 0.

Any thoughts?

I thought I had a solution, but it actually doesn’t work. If anyone can help me out, I’d really appreciate it.

Can you post a link? I tried recreating and didn’t have any problems. Is there some other dependency that’s affecting it?

This is fairly complicated, but I’m working on a pan balance for equation-solving. It allows combining like terms. Here’s what it looks like when combining like terms is working properly.

Here’s when things go wrong. In this video, the first stack of x’s is shorter than the 2nd stack of x’s. When you combine them, they get combined into the first stack. If you drag down all the x’s, you can actually drag down more than the first stack originally had. This is no problem, unless you try to separate the stacks after that point. Then the calculator doesn’t know how many x’s there should be. So the stacks need to get locked together once they’re combined.

Here’s is the actual activity.

You weren’t kidding. There’s a lot going on (460 lines!). It would be helpful to maybe give the numbers for the possible expressions where there are problems (e.g. i_0 and h_0). It’s a lot to sift through without really knowing the flow of the coding.