Moving two Rect in Sync with each other

I have two rectangles “A” and “B”

I want to move “A” and have “B” track along with it.

So if “C” is the new position of “A” then I thought it would be

newPos = (b.x-a.x) // how far b is from left edge of "a"
newPos = newPos + c.x // offset same distance from left edge of "C"
b.x=newPos
a.x=c.x

but b.x changes way faster than then “B” moves

What about:

deltaX = c.x - a.x
b.x = b.x + deltaX
a.x = c.x

I think I may have found it…
the value of “A” is supposed to be "where it was before I moved it to “C”)
but is seems that isn’t always the case… so I’m going to try something differne to track the delta between “A” and “C”

thanks

turns out the mousedrag event was propagating too far up the responder chain cause the sync event to be called out of seqeunce…