Ideas for limiting the area when dragging elements

Idea:

When the mouse is dragged: the sum of 1 and 3 remains unchanged. Subtract sum from the coordinates of the mouse to get 2

2 is the relative left margin left of the dragged element

When the mouse is pressed: you can get 2 and the current coordinates of the mouse to calculate sum(1+3)

Supongo que te gusta

Origin blog.csdn.net/qq_34907249/article/details/130921992
Recomendado
Clasificación