akalenuk / wordsandbuttons

A growing collection of interactive tutorials, demos, and quizzes about maths, algorithms, and programming.
https://wordsandbuttons.online
The Unlicense
486 stars 18 forks source link

Point being dragged swaps when passing over another point. #16

Closed FlyMyPG closed 4 years ago

FlyMyPG commented 4 years ago

I was playing with the interactive plots from "Bi-whatever transformations", trying to add a twist by dragging points. One odd behavior I noticed occurred when dragging one point directly over another: the point being dragged would switch to the other point! I could go back and forth this way, never able to get the points to go past each other, unless I went around and avoided the collision.

I suspect the drag logic lacks enough statefulness to "cling" to the point initially grabbed, but looking at biwhatever_transformations.html I wasn't able to quickly identify where it was missing, or where it should go.

Could it be a feature-not-a-bug? ;^)

Edit: We've chatted before (about languages), where I went by BobC.

akalenuk commented 4 years ago

Hello! Nice to hear from you again! :-)

Yes, you're absolutely right, the only state on the plot is the points. Everything else is computed, and whatever point is nearest becomes grabbed when the mouse button (or a tap) is down. If it's annoying, then there is no excuse, it's a bug. I'll get it fixed.

Thanks for bringing this up!

akalenuk commented 4 years ago

Fixed!

Thanks again! It does feel right this way.