Judging by the coordinate value ranges in your .docx building list,
I assume you are using canvas pixel coordinates for the corners
of your buildings.
In case you don't know how to calculate the center x and center y
of a building with 4 corners at (x1,y2), (x2,y2), (x3,y3), (x4,y4):
Center = ((x1+x2+x3+x4)/4, (y1+y2+y3+y4)/4)
Make 3 parallel arrays, named Building_Name, Center_x, Center_y,
and set Building_name(i) = the name of building i,
Center_x(i) = the center x value of that building (see above),
Center_y(i) = the center y value of that building (see above).
Put a small ball at the center of the canvas.
Respond to drags on the canvas by moving the ball in the same direction as the drag, an equal amount.
That lets you see the ball move without your finger blocking its view.
Set the ball to snap to the closest building center when the TouchUp canvas event happens.
To find the closest center point to the ball,
start global variables Closest_distance to 99999999,
Closest_Building_index to 0.
For each Building_Number from 1 to your number of buildings,
If distance from Ball to Building_Number < Closest_distance then
set Closest_distance = distance from Ball to Building_Number
set Closest_Building_Index to Building_Number
(no ELSE needed)
(end loop)
Move the Ball center to Center_X,y of Building_Number.
Distance formula you can use from Ball(x,y) to Center_x,Center_y:
(May need to add radius of Ball to x, subtract radius from its y value,
since Ball coordinates are at upper left.)
Distance = abs(Ball_X - Center_x) + abs(Ball_Y - Center_Y)
(This is known as Manhattan distance. You could use Pythagorean formula if you like.)
ABG