Reworked coordinates, scaling fixes

Improved scaling and reworked coordinate algorithms to get accurate
absolute and relative coordinates (canvas, layers).