implemented auto-alignment for magnifier