[Tex/LaTex] Issue with placement of figure using wrapfig environment

positioningwrapfigure

As seen, I have used wrapfig package. However, I can see the fifth point (in the image attached) covers only half the width of the page. But that shouldn't happen, it should cover whole line. I do not know what wrong I am doing. Any hints? And also the placement looks bad, thereis lot of space at top and below of figure. Can I also reduce the gap between text and the figure?

\usepackage{graphicx}
\usepackage{listings}
\usepackage{wrapfig}

\begin{document}

\par The TCP/IP based communication between the client and the server is through sockets. A browser enabled with WebGL is used for the rendering process at the client side. The volume rendered is displayed on the canvas. The interaction is done on the canvas and volume is rendered and updated back to the canvas.

\begin{wrapfigure}[10]{R}{0.5\textwidth}
% \vspace{-5pt}
 \centering
  \includegraphics[width=7cm, height=8cm]{arch1sysflow.png}
 \vspace{-10pt} 
\caption{Pictorial representation of system interactions for Architecture-I}
%\vspace{-10pt}
\label{flow1}
\end{wrapfigure}

\par The system interactions flow of architecture-I is shown in Figure.~\ref{flow1}. The step by step interaction flow are given below:
\begin{enumerate}
\item The server is always listening on sockets for any client connections.
\item Downloading the volumetric dataset
\begin{enumerate}
\item User clicks the link {\lq}Downlaod Volumetric Dataset\rq.
\item The client connects to the server and requests for the dataset.
\item The server receives the request and sends the requested dataset.
\end{enumerate}
\item User loads the downloaded volumetric dataset and client renders the     volume based on initial settings.
\item Continuous canvas interaction
\begin{enumerate}
\item User interacts with the canvas continuously.
\item The client renders the volume and keeps updating the canvas with the   rendered image until the interaction stops.
\end{enumerate}
\item When user interaction stops, the client also stops rendering.
\end{enumerate}

\end{document}

enter image description here

Best Answer

Here is a work-around: I split the enumerate environment in two, using the resume* key from enumitem. I also slightly improved the layout of the nested enumerate environment:

    \documentclass{article}
    \usepackage{amsmath}
\usepackage{enumitem} \usepackage[demo]{graphicx}
\usepackage{wrapfig}


\begin{document}

\par The TCP/IP based communication between the client and the server is through sockets. A browser enabled with WebGL is used for the rendering process at the client side. The volume rendered is displayed on the canvas. The interaction is done on the canvas and volume is rendered and updated back to the canvas.

\begin{wrapfigure}[10]{R}{0.5\textwidth}
  % \vspace{-5pt}
  \centering
  \includegraphics[width=7cm, height=8cm]{arch1sysflow.png}
  \vspace{-10pt}
  \caption{Pictorial representation of system interactions for Architecture-I}
  %\vspace{-10pt}
  \label{flow1}
\end{wrapfigure}

The system interactions flow of architecture-I is shown in Figure.~\ref{flow1}. The step by step interaction flow are given below:
\begin{enumerate}
  \item The server is always listening on sockets for any client connections.
  \item Downloading the volumetric dataset
        \begin{enumerate}[wide=0pt, leftmargin=*]
          \item User clicks the link {\lq}Downlaod Volumetric Dataset\rq.
          \item The client connects to the server and requests for the dataset.
          \item The server receives the request and sends the reques\-ted dataset.
        \end{enumerate}
  \item User loads the downloaded volumetric dataset and client renders the volume based on initial settings.
\end{enumerate}

\begin{enumerate}[resume*, topsep = \itemsep]
  \item Continuous canvas interaction
        \begin{enumerate}[wide=0pt, leftmargin=*]
          \item User interacts with the canvas continuously.
          \item The client renders the volume and keeps updating the canvas with the rendered image until the interaction stops.
        \end{enumerate}
  \item When user interaction stops, the client also stops rendering.
\end{enumerate}

\end{document}

enter image description here