Thread: 2.1 update
View Single Post
09/05/15, 06:12 AM   #63
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 671
Originally Posted by Garkin View Post
You have to count with distance from the center, not from the top / left side.

scale_x = (new_dx - 0.5) / (old_dx - 0.5)
scale_y = (new_dy - 0.5) / (old_dy - 0.5)

function translate_old_coords(x, y)
return 0.5 + ((x - 0.5) * scale_x), 0.5 + ((y - 0.5) * scale_y)
end
No. new_dx and old_dx are X-distances between two POIs. Map center is not involved in my formula, precisely because the whole map might be shifted, in which case rescaling is not enough.
  Reply With Quote