code: private int getXForY(int newX, int newY) {
  
          int width = (int)Math.floor((newY - m_firstY) / m_heightToWidth);
          int result = m_firstX + width;
          if (((m_firstX - newX) * (m_firstX - result)) < 0) {
              result = m_firstX - width;
          }
          return result;
      }
docs: Calculates the matching X (left/width) value in case of a fixed height/width ratio.<p>
  
  @param newX the cursor X offset to the selection area
  @param newY the cursor Y offset to the selection area
  
  @return the matching X value