Code: Select all
on mouseMove x,y -- handle dragging if the user is dragging the stack
if not tDragging then exit mouseMove
put (x - cx) + (dx div 2) into dx
add (x - cx) to sx
put (y - cy) + (dy div 2) into dy
add (y - cy) to sy
set the loc of this stack to sx,sy
put dx
end mouseMove
You could try limiting the values (eg 20, either positive or negative) as in this adjustment:
Code: Select all
on mouseMove x,y -- handle dragging if the user is dragging the stack
if not tDragging then exit mouseMove
put x - cx into tDragLengthX
if tDragLengthX < 0 then
put max(-20, tDragLengthX + (dx div 2)) into dx
else
put min (20, tDragLengthX + (dx div 2)) into dx
end if
add (x - cx) to sx
put y - cy into tDragLengthY
if tDragLengthY < 0 then
put max(-20, tDragLengthY + (dx div 2)) into dy
else
put min (20, tDragLengthY + (dx div 2)) into dy
end if
add (y - cy) to sy
set the loc of this stack to sx,sy
end mouseMove